Skip to content

tell --mode auto injects into busy turn instead of queueing: provider error retry loop, status flips to error while turn continues #2370

Closed

Description

@pixexid

Summary

Sending bb thread tell --mode auto <thread> to a thread whose agent is mid-turn attempts live injection instead of queueing. The provider bridge (pi/codex) rejects with Agent is already processing a prompt. Use steer() or followUp() to queue messages, the host retries delivery repeatedly (a loop of identical errors in the thread log), and the thread's visible status flips to error while the turn continues to run normally (native transcript kept advancing throughout).

Expected

--mode auto detects the busy turn and queues the message (or the error is surfaced once, without a retry loop and without flipping thread status to error).

Actual

  • Repeated identical provider errors (observed 6+ identical error blocks for one logical delivery).
  • Thread status shows error though the turn is healthy and progressing.
  • The queued messages were lost (never delivered); recovery required thread stop, which then released the runtime and delivered queued messages.
  • Operator-visible symptom: seat looks dead/buggy in the UI while it is actually working — compounds with Visible unarchived threads are absent from the app list until opened by direct link #2326 (thread list staleness) to make healthy seats appear failed.

Environment

bb Nightly 0.39.1-nightly.32633481796.1 (commit 7e10ea4), macOS, pi provider bridge with codex/gpt-5.6 backend. Observed repeatedly over 2026-08-24 across multiple threads (orchestrator seat + a writing lane earlier the same day — the lane instance wedged hard enough to require stop + salvage).

Repro

  1. Have a thread mid-turn (long-running provider turn).
  2. bb thread tell --mode auto <thread> "msg" (possibly repeat / have multiple queued tells).
  3. Observe repeated 'already processing' errors in bb thread log, status flips to error, message never delivered.

Notes

  • --mode queue works reliably; the defect is in auto/steer busy-detection on this bridge.
  • Suggest: auto should fall back to queue on 'already processing' rather than retry-injecting; delivery errors should not flip thread status to error while the underlying turn is progressing.

Activity

  1. pixexid commented on Aug 25, 2026

    @pixexid
    Author

    Regression evidence: 386 archived session transcripts from 3 days of stable 0.39.0 operation under heavy inter-thread tell traffic contain ZERO occurrences of 'already processing a prompt' delivery errors. All 13 observed occurrences are from 2026-08-24 after switching to Nightly 0.39.1 (7e10ea4), across two threads. The failure shape is new in Nightly; stable's messaging defects were limited to steer-mode visibility. Suggests the auto-mode busy-detection/delivery path changed between 0.39.0 and 0.39.1-nightly.

  2. added theissue type on Aug 25, 2026
  3. added
    threads
    cli
    providers
    provider-pi
    on Aug 25, 2026
  4. brsbl commented on Aug 25, 2026

    @brsbl
    Collaborator

    Additional confirmed repro: UI steer during slow Claude Code startup

    This same root cause reproduces from the app composer with Claude Code, not only from bb thread tell --mode auto with pi. When the provider takes longer than the daemon's fixed five-second pending-start wait to publish turn/started, a steer sent from the UI is rejected, rendered as Command turn.submit failed, marked as a generic run failure, and dropped even though the original turn starts moments later and completes normally.

    Versions and environment

    Steps to reproduce

    1. Open an idle Claude Code thread in the bb app.
    2. Submit a normal prompt.
    3. Before Claude emits turn/started, submit a second prompt using the active-thread steer action.
    4. Make the first turn's startup take more than five seconds (the two production occurrences took 11.3 seconds and 28.4 seconds from request to turn/started).
    5. After five seconds, observe that the second prompt is rejected and an error row appears; shortly afterward, the original turn starts and continues normally.

    This reproduced twice in the same real thread:

    • Attempt 1: use real icons requested at 14:42:04; wait i need comments steered at 14:42:19; steer rejected at 14:42:24; original turn/started arrived at 14:42:32. Event sequences 15222, 15224–15226, and 15230–15231.
    • Attempt 2: where are my commens requested at 14:47:04; stop using inline html i'm in the spec steered at 14:47:10; steer rejected at 14:47:15; original turn/started arrived at 14:47:16. Event sequences 15307, 15309–15313.

    Actual error, verbatim:

    Command turn.submit failed
    Refusing to start a competing turn while thr_vaqgwzbtvm is still starting
    

    Expected: preserve the second prompt and deliver it once the opening turn can accept a steer (or park it as a queued follow-up). The opening turn must remain active and healthy.

    Actual: the second prompt is persisted as client/turn/requested, then rejected after the fixed five-second wait, shown as system/error, and never delivered. The original turn is not stuck: both observed original turns began after the rejection and completed normally.

    Root cause

    • The daemon waits exactly five seconds for the opening turn id, then throws an untyped generic error if the thread is still live: thread.ts#L25-L31, thread.ts#L421-L455.
    • The server handles every such turn.submit failure as terminal: it appends client/turn/rejected, adds the visible system/error, applies run.failed to the thread, and does not park the refused input: thread-lifecycle.ts#L770-L811.
    • The original turn remains owned by the runtime and eventually emits turn/started, so the failure row describes the steer command, not a failed provider turn. Treating it as a run failure creates the false error state and makes the message loss persistent.

    Current main still codifies the first half of this behavior. The focused command below passes because the test expects the rejection verbatim:

    pnpm exec turbo run test --filter=@bb/host-daemon --force -- src/command-dispatch.test.ts -t "rejects auto input when a pending turn still has no id after the wait"
    
    Test Files  1 passed (1)
    Tests       1 passed | 39 skipped (40)
    

    PR #2417 already implements the right shared fix for this exact case: classify the pending-start refusal as thread_turn_busy, keep the live turn's status, suppress the misleading system error, and park the input for later delivery. This evidence broadens the confirmed impact from CLI + pi to the app composer + Claude Code; it does not require a separate issue.

    What this rules out

    Investigation thread: thr_sjgquuw76w

    AGENT GENERATED

  5. added
    bug
    host
    ui
    provider-claude-code
    on Aug 25, 2026
  6. added 2 commits that reference this issue on Aug 25, 2026
    a8f7597
    73dd52c
  7. SawyerHood commented on Aug 27, 2026

    @SawyerHood
    Collaborator

    Reproduction & root-cause report: https://get-bb.github.io/reports/issues/2370.html

    • Verdict: PARTIALLY REPRODUCED · root-cause confidence: high
    • Root cause (short): A five-second pending-start timeout returns a generic error, and the server drops the input and fails the healthy thread.
    • Proposed fix: Return a typed pending-start busy error. Keep the live status, park refused input, and retry after the turn ID arrives.
    • Caveats: PR Preserve stale sends by re-steering the live turn #2379 fixed the original active-turn injection at the base. Tests reproduced the residual daemon and server paths. No live provider or production transcripts were available.

    The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at the base commit, and repro artifacts. It was independently re-run by a second agent (see its Verification section).

    AGENT GENERATED: by GPT-5.6-Sol

  8. added
    partial-repro
    on Aug 27, 2026
  9. ryanbbrown commented on Aug 28, 2026

    @ryanbbrown
    Contributor

    This also matches a narrower delivery race seen with early follow-ups: a correction sent while a turn is starting can be refused or lost even though the recipient continues running. The important failure is not normal queue semantics; it is that BB accepts a plausible immediate-delivery path, then reports an error or loses the input while the live turn still owns the thread.

    This issue is the right owner for busy or starting-turn delivery and recovery. It does not cover provider permission-mode discovery, intentional queue/steer behavior, or the separate request for file/stdin message input.

  10. anluby commented on Sep 3, 2026

    @anluby

    Additional recurrence on stable 0.40.0: Claude overload extends the starting-turn race

    This reproduced in the macOS desktop app with the Claude Code provider on stable bb 0.40.0.

    Sequence

    1. An idle thread received a normal prompt.
    2. A second prompt was sent as a steer 5.2 seconds later, before any turn-start event appeared.
    3. The steer was rejected with: “Refusing to start a competing turn while the thread is still starting.” The thread then displayed an error even though the original provider process remained active.
    4. A third prompt sent shortly afterward was also rejected as a competing turn.
    5. The provider reported nine HTTP 529 overloaded retries before any turn-start event.
    6. About 129 seconds after the original request, bb emitted provider_turn_start_timeout. The provider process nevertheless remained alive until the user explicitly stopped the thread.

    The second and third prompts were not delivered. After stopping the orphaned runtime, neither a normal tell nor edit-and-rerun could recover the request: bb reported that the thread was inactive and that the selected request had not been accepted into exactly one turn. Recovery therefore required continuing from the last completed turn in a fork.

    Expected

    • A prompt sent while the opening turn is still starting is preserved and delivered when the turn can accept it, or parked as a queued follow-up.
    • Rejecting that prompt does not falsely mark the still-running provider turn as errored.
    • If startup reaches the watchdog threshold, the accepted user request remains directly retryable after the provider runtime is stopped.

    This appears to be the same starting-turn delivery and recovery defect already tracked here, with provider overload making the race long enough to reach the watchdog.

    AGENT GENERATED

  11. ymichael commented on Sep 4, 2026

    @ymichael
    Collaborator

    Re-tested this against current main. I can no longer reproduce the original auto/steer message-loss and false-error behavior.

    The relevant fixes are now covered by #2379, #2816, #2884, and #2886:

    Messages sent while an opening turn has no turn ID are persisted and delivered in order.
    Stale steer targets are handled safely.
    A healthy provider turn is not marked failed.
    I observed no automatic duplicate-delivery loop.
    The later stable-0.40.0 report is consistent with behavior before these fixes landed.

    There is a separate edge case: if the provider never starts the original request and the user stops the runtime, BB cannot explicitly retry that stored request. I explored that in #3030, but the resulting recovery experience was delayed, difficult to discover, and disproportionate to this issue. Users can resend after stopping; a dedicated recovery feature should only be revisited with a clear, persistent UI.

  12. zacklavin11 commented on Sep 6, 2026

    @zacklavin11

    A remaining server admission race related to this report reproduces on main at accd5595926b080a1e17d1ea9b2fa2d7d0505ac6. This is narrower than the provider-busy handling proposed in closed #2417 and precedes the startup state addressed by merged #2816.

    Two sends can overlap during asynchronous preparation, both observe admission as available, and dispatch competing starts. An exact BB command_failed competing-start refusal then reaches generic failure settlement, potentially losing pending delivery or marking the winning turn failed. Stopping or pausing the thread before the losing refusal arrives can also produce a false child-failure notice.

    Relevant current-main source:

    A prepared seven-file server/test fix serializes preparation per thread and durably queues only narrowly recognized, unaccepted competing-start refusals. It preserves steering, existing startup waits, notification batching, and the daemon guard. Stop/pause prevents automatic requeue without letting a losing refusal fail the winner.

    The deterministic regression uses real SQLite: hold the first send inside asynchronous mention preparation, submit a second user input or parent notice, then release preparation. Expected: one initial command and persisted subsequent input, delivered through the existing steer/busy queue. Before the fix, both inputs dispatch. Separately, settle a synthetic competing-start refusal after stopping or pausing the winning thread; expect no lifecycle failure, failure notification, or automatic requeue. These cases fail on the pinned main and pass with the patch; 94 affected tests and server typecheck pass. This is fixture validation on macOS with Node 22.23.2 and pnpm 9.15.0, not a new live-provider reproduction. With the proposed test file present, run:

    pnpm exec turbo run test --filter=@bb/server --force -- test/threads/thread-send-dispatch.test.ts

    On unchanged main: 10 failed, 28 passed. With the seven-file patch: 38 passed in that suite. The synthetic refusal is Refusing to start a competing turn for thread "<thread-id>" while another turn is active or starting.

    The enabled Provider retry plugin's overload/rate-limit retry does not cover these command refusals. Open #2639 addresses Codex turn-ID correlation; #3004 addresses ACP session-busy responses. Neither serializes server admission.

    I have a contribution ready and would like contributor approval for this focused follow-up before opening a PR, as required by CONTRIBUTING.md.

    AGENT GENERATED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugclihostpartial-reproprovider-claude-codeprovider-piprovidersthreadsui

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions