Repository navigation
fix: hold run results and chat news after Stop - #1152
Merged
Merged
Conversation
A run result or chat news that landed while a turn ran was delivered the moment Stop left the chat idle, so Claude started working again right after the user stopped it. Stop now holds both for the stopped chat and the delegates it reached until the chat's next turn starts; they arrive once that turn ends. Asking about a run flag lifts the hold. Fixes ORX-739. Assisted-by: claude-opus-5.5
Contributor
[Medium impact] The change affects automatic message delivery within chat workflows. Fix the delegate-stop race before merging so pending updates cannot restart stopped work. Findings
Fix with agent prompt### Issue 1
src/local/chat/mod.rs:7650-7651
Delegate stops set `stopped` before taking the `turns` lock. If a result turn is already starting, `launch_turn_ctx_locked` can clear that hold while `interrupt` waits for the lock. `interrupt` then cancels the turn without restoring the hold, so another pending result or chat update can restart the delegate without a new user message.
Set the hold inside `stop_turn`, under `turns`, for these delegate-stop paths too. The same gap exists in `stop_background` and the agent's `cancel` tool.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryAdds an in-memory Stop hold for run results, flag wakes, and chat news.
|
Delegate stops set the hold before taking the turn lock, so a result turn starting at that moment could clear it and leave the delegate free to restart. They now stop through StopMode::Hold, which sets the hold under the lock like a user Stop. Assisted-by: claude-opus-5.5
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.
A run result or chat news that arrived while a turn ran was delivered as a hidden turn the moment Stop left the chat idle, so Claude went straight back to work after the user stopped it (ORX-739). Stop now holds both for that chat, and for the delegates the stop reached, until the chat's next turn starts; they're delivered when that turn ends. Asking about a run flag lifts the hold.
The hold lives in memory (
ChatHost::stopped), so a restart delivers held results at startup; persisting it would mean a new store field. Queued messages and unread steers still run after Stop, as before.Proof: reproduced against real Claude Code (haiku) — before, a finished run restarted Claude 0.25s after Stop; after, the chat stayed idle for 40s and the result arrived after the next message. The outbox test gained a section that fails without the hold.
Reviewed with sol-loop: 2 rounds with gpt-6.2-sol. Sol verdict: approved
Assisted-by: claude-opus-5.5