fix: bundle C1 diagnostics follow-ups#575
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis PR consolidates repeated session abort diagnostic emission into a shared factory helper, extends abort diagnostics to capture title-generation state, integrates per-session title-generation timing into the session prompt lifecycle, and adds tests for the new helpers and expected_outputs cases. ChangesAbort diagnostics consolidation and title-generation state tracking
🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Suggested priority: P2 (includes user-path files (packages/app/src/components/prompt-input/submit.ts, packages/app/src/context/renderer-diagnostics.ts, packages/app/src/pages/session.tsx, packages/app/src/pages/session/use-session-commands.tsx)).
P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.
There was a problem hiding this comment.
Code Review
This pull request introduces tracking for title generation states during session aborts and refactors diagnostic event emission. It adds a title_generation_state field to assistant message diagnostics to capture whether title generation was not started, in flight, or completed relative to an abort event. Additionally, it introduces a sessionAbortDiagnosticEvent helper in the frontend to standardize abort diagnostics and includes new tests for bash tool artifact recording and path resolution. I have no feedback to provide.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/opencode/src/session/prompt.ts`:
- Around line 96-109: The function reconcileTitleGenerationStateAfterCompletion
currently leaves "in_flight" when completedAt === abortRecordedAt; change the
comparison in reconcileTitleGenerationStateAfterCompletion (the function name)
so that when input.state === "in_flight" and both abortRecordedAt and
completedAt are numbers and completedAt >= abortRecordedAt it returns the
terminal state "completed_after_abort" (i.e., treat equal timestamps as
completed) so any completed timestamp collapses the in-flight state into the
terminal state.
In `@packages/opencode/test/tool/bash.test.ts`:
- Around line 434-437: The test currently assumes deterministic ordering by
indexing into TurnChange.finalize(turn)?.files[0]; instead, make the assertion
order-independent by locating the file object with path "nested/report.txt"
(e.g., using Array.prototype.find or an assertion like
expect(files).toEqual(expect.arrayContaining(...))) and then assert its status
is "added"; update the assertion that references
TurnChange.finalize(turn)?.files so it searches for the entry with path
"nested/report.txt" and checks status rather than relying on files[0].
- Around line 320-360: The test "records a declared text artifact using the text
hash path" currently only writes a plain UTF-8 file; add a second subtest or
extend this test to also create a file that begins with the UTF-8 BOM (write
"\uFEFFhello\n") and include that BOM-path file in the bash.execute
expected_outputs array so the code path that handles text artifacts with BOM is
exercised; update the result.artifacts and TurnChange.finalize(turn)?.files
assertions to assert the BOM file (e.g., "notes-with-bom.txt") appears with the
same status/expandable/additions/deletions expectations as the plain text file.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a410be74-dc1a-4c0f-b42b-692f838cf076
📒 Files selected for processing (11)
packages/app/src/components/prompt-input/submit.tspackages/app/src/context/renderer-diagnostics.tspackages/app/src/pages/session.tsxpackages/app/src/pages/session/use-session-commands.tsxpackages/opencode/src/effect/runner.tspackages/opencode/src/session/export.tspackages/opencode/src/session/message-v2.tspackages/opencode/src/session/prompt.tspackages/opencode/test/session/export.test.tspackages/opencode/test/session/prompt-effect.test.tspackages/opencode/test/tool/bash.test.ts
Summary
title_generation_state, title tracing warns when its target assistant never appears, andapplied: trueis only recorded aftersessions.setTitle()really succeedsexpected_outputscoverage for text artifacts and workdir-relative pathsWhy
This PR closes the follow-up debt left by PRs #556, #561, and #563 without changing product behavior.
The missing pieces were:
applied: truebeing recorded even whensetTitle()failedexpected_outputscoverage still missed the text-hash path and workdir-relative resolution pathRelated Issue
Closes #557
Closes #562
Closes #564
Human Review Status
Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.
Review Focus
packages/app/src/context/renderer-diagnostics.tsplus the three abort emit call sites only refactor event construction, without changing abort behaviorpackages/opencode/src/session/prompt.tspreserves existing cancel/title semantics while making title-generation diagnostics more precise and observablepackages/opencode/test/tool/bash.test.tscovers the two missingexpected_outputsprotocol cases without broadening the bash contractRisk Notes
Low. This stays in diagnostics and tests only:
The only schema impact is additive: abort diagnostics now optionally include
title_generation_state.How To Verify
Screenshots or Recordings
Not applicable. No visible UI changes.
Checklist
dev, and my PR title and commit messages use Conventional Commits in EnglishSummary by CodeRabbit
New Features
Refactor
Tests