Repository navigation
Conversation
When the daemon refused a turn start with anything other than competing_turn while a provider turn was open, bb set the thread to error but left the turn open and never told the daemon to stop it, so the provider kept working behind an errored thread. Settling that failure now records the open turn as interrupted and dispatches thread.stop to the daemon. Steer refusals are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closing the open turn on the server and then receiving the provider's own interrupted completion stored two turn/completed events. The second one was treated as an unexplained interruption, so a child thread's parent notice changed from failed to interrupted. Mark the turn stopped before sending the stop, as a normal stop does, and let the provider's completion close the turn. If the stop settles without one, closing the errored thread's open turn is now done when the stop is finalized. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
Author
|
Closing: live QA with real Claude Code found no real trigger. Background-task wakes do open unrequested turns, but in 12 timed races no start was refused with anything other than competing_turn (already handled on main). The bug only reproduced with an injected daemon fault. |
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.
Human comments
What was wrong
When the daemon refused a turn start with any error other than
competing_turnwhile a provider turn was open,settleThreadCommandFailureinapps/server/src/services/threads/thread-lifecycle.tsmoved the thread toerror. It never checked for an open turn, so bb left the turn open and sent the daemon no stop. The provider kept working behind a thread showingerror. This is item 6 from the investigation of #6552's stop fixes against main. #6727, #6728, #6736 and #6870 didn't touch this path, and the repro still failed on current main.What changed
settleThreadCommandFailure: when a start refusal (thread.start, orturn.submitin start mode) fails the run, bb records any open turn asturn/completedwith statusinterruptedin the same transaction. After the commit, it sendsthread.stopwith intentinterrupt, using the existing dispatcher andthread.stopin-flight guard.applyActiveTurnInterruptionInTransactioninto a helper that both paths use.What a user sees differently
errorbadge.error. If the thread has never been stopped before, a stopped marker may appear in the timeline, and queued messages get a chance to send, as after any stop.errorignores a late "stop settled".How you verified
The existing test "still fails the run for other refusals while a root turn is stored" in
apps/server/test/threads/thread-send-dispatch.test.tsalready set up this case but only checked forerror. It is renamed to "fails the run and stops the open root turn for other refusals" and now also checks that the turn is closed and an interruptthread.stopwas queued.{ openTurn: 'turn-unrequested', stopSent: false }thread-send-dispatch.test.tsexpected 'turn-unrequested' to be nullerror, turn open, no stoppnpm exec turbo run typecheck lint --filter='...[origin/main]'pnpm exec turbo run test --filter=@bb/server@bb/serverhas nolintscript, so I also ran oxlint and prettier on the changed files; neither reports anything in this diff.🤖 Generated with Claude Code