Repository navigation
fix: queue steers while turns start - #2816
Merged
ymichael merged 1 commit intoSep 1, 2026
Merged
Conversation
ymichael
force-pushed
the
bb/explain-turn-submit-startup-error-thr_hsrjru7isz
branch
from
September 1, 2026 18:17
db400f3 to
ce01b98
Compare
ymichael
deleted the
bb/explain-turn-submit-startup-error-thr_hsrjru7isz
branch
September 1, 2026 19:25
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
The server marks a thread active when its first turn is accepted, before the provider's root
turn/startedevent records the active turn id. An immediatesteer,steer-if-active, or active-threadautosend therefore tried to submit while startup was still in flight. The daemon could reject it as a competing turn, and the follow-up was not reliably delivered. The existingthread-busywait cannot represent this state because it intentionally waits for the current turn to finish and dispatches the message as a later turn.What changed
waitingOn.kind: "turn-starting"for join-turn sends against an active thread that has no recorded root turn id yet.turn/startedevents wake those rows in queue order and re-attempt them as steers into the newly identified turn. Ordinarythread-busyrows remain untouched and continue waiting for the turn to finish.thread-busy, and parent-system-message delivery. Updated older fixtures that previously modeled a live steer without recordingturn/started.0.4.34and refreshed its public API inventory because the queued-message DTO exposes the new wait kind.HOST_DAEMON_PROTOCOL_VERSIONis unchanged. The solution is provider-agnostic and adds no Pi-specific behavior or held daemon command.This covers the startup-race portion investigated in closed PR #2417 with a server-owned persistent queue. It does not port #2417's separate provider-busy/compaction refusal handling.
How you verified
On the final rebase against
origin/main(026572964):pnpm exec turbo run test typecheck --filter=@get-bb/plugin-sdk --filter=@bb/plugin-api-map --filter=@bb/app --filter=bb-plugin-plugin-api-docs— 11/11 tasks passed; the app suite passed 3,688 tests and the Plugin Guide suite passed 74 tests.pnpm exec turbo run test --filter=@bb/server --force -- test/threads/thread-send-dispatch.test.ts test/threads/dispatch-hooks.test.ts test/public/public-thread-fork.test.ts— 43/43 tests passed.pnpm exec turbo run typecheck --filter=@bb/server --filter=@bb/domain --filter=@bb/db --filter=@bb/cli --filter=@bb/templates— 8/8 tasks passed.bb plugin build plugins/plugin-api-docs— backend and app artifacts built successfully.git diff --checkpassed.sawyerhood/dev-browserrendered a real queued row showingWaiting for turn to start, with the thread still working and Send now unavailable.Related to #2370