fix(session): finalize interrupted assistant messages - #27254
Merged
Conversation
Collaborator
Author
|
/review |
Contributor
|
lgtm |
AIALRA-0
pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
13 tasks
Astro-Han
added a commit
to Astro-Han/pawwork
that referenced
this pull request
Jun 10, 2026
Root cause / goal: SessionPrompt persists an assistant scaffold before processor handling fully owns the turn. Cancellation in that early window could leave an empty unfinished assistant message with no abort error or completion timestamp, poisoning later session history. This ports the focused upstream anomalyco/opencode#27254 behavior only. Change boundary: - Finalize the current unfinished assistant scaffold from the shared prompt-loop interrupt cleanup path when cancellation happens before processor cleanup owns the assistant. - Preserve existing cancel semantics and diagnostics, and avoid importing #1252 tool-drain behavior, #30804 filtering, provider/MCP/UI/package changes, or adjacent refactors. - Add regression coverage for cancellation after assistant scaffold persistence and after processor handle creation but before process starts. Verification: - RED proof: new regression first failed because the canceled scaffold had no MessageAbortedError. - Focused regression: bun test --timeout 30000 ./test/session/prompt-effect.test.ts -t "cancel after assistant scaffold save finalizes before processor handle|cancel after processor handle creation finalizes before process starts" -> 2 passed. - Prompt interruption suite: bun test --timeout 30000 ./test/session/prompt-effect.test.ts -> 65 passed. - Processor abort slice: bun test --timeout 30000 ./test/session/processor-effect.test.ts -t "abort|interrupt" -> 6 passed. - Typecheck: bun run typecheck in packages/opencode -> passed. - Whitespace: git diff --check origin/dev...HEAD -> passed. - PR CI: required checks green; full current check set including windows-advisory green. Reviews: - Terminal Claude review: PASS after final diff. - Independent terminal Occam fresh-eye review: PASS, no P0/P1/P2 after addressing the post-handle/pre-process cancellation window. - GitHub review threads: none unresolved. Residual risk: Canceled assistants still follow existing semantics and do not set finish; this PR only ensures aborted scaffolds carry MessageAbortedError and time.completed.
isaacfinnegan
pushed a commit
to isaacfinnegan/whispercode
that referenced
this pull request
Jun 15, 2026
MarsQiu007
referenced
this pull request
in MarsQiu007/openNovel
Jul 31, 2026
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing