Skip to content

fix: hold run results and chat news after Stop - #1152

Merged
small-angel merged 2 commits into
mainfrom
clo/hold-wakes-after-stop
Nov 20, 2026
Merged

small-angel merged 2 commits into
mainfrom
clo/hold-wakes-after-stop

Conversation

@small-angel

Copy link
Copy Markdown
Contributor

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

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
@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[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

  1. P1 Stopped delegates can restart ▶
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.

Summary

Adds an in-memory Stop hold for run results, flag wakes, and chat news.

  • Stopped chats wait for run results and chat news before starting work again.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Stop chat] --> B[Set in-memory hold]
  B --> C[Automatic results and news wait]
  C --> D[Next turn starts or user asks about a flag]
  D --> E[Clear hold]
  E --> F[Deliver pending updates when idle]
Loading

Reviews (1) · Last reviewed commit: "fix: hold run results and chat news afte..." · Reviewed by Greptile

Comment thread src/local/chat/mod.rs Resolved
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
@small-angel
small-angel merged commit a935005 into main Nov 20, 2026
25 checks passed
@small-angel
small-angel deleted the clo/hold-wakes-after-stop branch November 20, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant