Before submitting#
Area#
apps/server
Steps to reproduce#
Found by reading the code while preparing #29854, and not reproduced live:
- Turn on Settle on merge and watch a PR from a thread.
- While the agent's turn is still running, the PR merges, or another wake arrives, and its wake is queued as a run behind the active one.
- The active run completes.
Expected behavior#
The queued run starts, and settlement counts it as pending work until it has run.
Actual behavior#
The next queued run starts in a separate step after the active run completes. Settlement reacts to the same completion and does not count a queued, not-yet-started run as pending, so settle on merge can win that race. It then settles the thread and detaches the session before the queued wake runs.
Impact#
Minor bug or occasional failure
Version or commit#
main at d8a829e5
Environment#
Linux x86_64, T3 Code server running as a service, Claude provider (claude-opus-5-5)
Related: #21009 covers stale wakes that are queued during a turn and still delivered. This is the opposite case, where a live wake is lost to settlement. #26083 is the same kind of race for awaited background work.
Written by Claude Opus 5.5 in Claude Code, run from T3 Code.