Skip to content

Thread messages are never blocked: every send is accepted and queued until the agent can take it #1499

Backlog

Description

@scuttletoby

Goal (owner, 11-30)

The owner sometimes cannot send a message to a thread in T3: the composer refuses or holds it. Wanted: a code change, not a written rule, so that a person's message to a thread is never blocked or stuck, and sending it never ruins what the agent is working on.

Rule to build

  1. A message typed into a thread is always accepted and stored durably (survives a page reload, a disconnect and a server restart).
  2. If the agent is busy (running turn, waiting on an approval or a question, reconnecting, starting), the message is shown as queued and is delivered at the next safe point: when the turn ends in any way (done, error, interrupt, restart), or as a mid-turn steer only when the person picks that. It never interrupts the running turn by itself.
  3. A queued message never waits forever: if the thread's turn ends with no delivery, the queue delivers it; if delivery fails, the message stays visible with the reason and a retry, never silently dropped.
  4. The only sends that may still be refused are ones where nothing could run it at all (no provider, no model picked). Even then the text stays as a draft with a clear reason.

Part 1: inventory

List every path where a send is refused, held or lost today, in the web app (send-disabled reasons, the collapsed composer while running, "Sending when ready", the approval/question panels, a stuck busy state, environment unavailable, provider block reasons) and on the server (turn-start/queue refusals, queued messages after an error/interrupt/restart). For each: upstream or fork, how often it can happen, and the fix.

Part 2+: fixes

One PR per cause, most common first. Build on upstream T3's own queue/steer mechanism; thin fork add-on behind a seam. One table test of the block cases.

Activity

  1. scuttletoby commented on Nov 30, 2026

    @scuttletoby
    OwnerAuthor

    Part 1: inventory of where a send is refused, held or lost (main at b8d676a)

    Every path below is upstream code: none of these files has fork lines (ChatComposer.tsx, useComposerSend.ts, ComposerPrimaryActions.tsx, Orchestrator.ts, CommandPolicy.ts, ProviderRuntimeRecoveryService.ts). Likelihood is for an owner driving threads remotely and from a phone.

    Upstream already has a durable server queue (a queued_turn run, drained by startNextQueuedRun when a run ends) and a steer that falls back to a queued turn. Upstream also has open bugs nearby, in its own tracker: a steered message is not sent after a manual cancel; a steer while a secret card is open deadlocks; a turn pinned in running starves the queued runs. Upstream PRs are open for "preserve queued steering across restarts" and "allow queued messages ahead of completion deliveries". The fork builds on that queue and does not replace it.

    Web (apps/web)

    # Path What happens Likely Fix
    W1 Environment reconnecting (ChatView activeEnvironmentUnavailable → ComposerPrimaryActions disables the button with "Environment disconnected"; useComposerSend toasts "Not connected: message not sent") Refused: send again by hand High (tunnel or relay reconnects) Hold, and send on reconnect: #1503
    W2 isSendBusy / sendInFlightRef (useComposerSend "Still sending your previous message"; button "Submitting message") Refused until the server acknowledges the previous send. Busy ends only on that acknowledgement (hasServerAcknowledgedLocalDispatch) or on a failure; there is no timeout High (two messages in a row) Hold, and send after the previous one: #1503
    W3 sendDisabledReason from ChatView: "Messages loading", "Preparing machine", "Preparing worktree" Refused: button off, and Enter is stopped by submissionBlocked Medium (opening a thread on a phone) Hold: #1503
    W4 Silent early return in onSend: !clientSettingsHydrated, a pending environment change, feedback upload in flight Refused silently (no toast). The text stays as a draft Low (short windows) Fold into the hold (next part)
    W5 sendDisabledReason: "Rewinding conversation", "Sending feedback" Refused: button off Low Hold (next part; the same wait table)
    W6 composerSendHeld "Sending when ready" (images still compressing) Held, and sent when the images finish. Editing or Esc cancels it Low Already right (upstream)
    W7 ComposerPendingApprovalActions replaces the composer while an approval waits Refused: no message can be typed Medium (approval modes) Next part: keep a composer below the approval and queue the message behind it
    W8 ComposerPendingUserInputPanel: the text answers the question By design: the text is the answer n/a Keep (rule 2: the person picks)
    W9 collapsedComposerPrimaryActionDisabled includes phase === "running" (mobile collapsed composer) The collapsed action is Stop while running (upstream fixed "disabled send instead of Stop"); expanding gives queue or steer Low None needed
    W10 !canOperateThread ("This connection cannot change threads."), no provider, "Select at least one model.", provider block reasons (Antigravity), runtime-mode ceiling, attachment block Refused, with the text kept as a draft Real but intended Rule 4: keep the refusal and the reason
    W11 A hold or a busy state is in memory only A reload drops the hold. The text stays (the draft store is persisted) Low Accepted for now (see #1503's state answers)

    Server (apps/server/src/orchestration-v2)

    # Path What happens Likely Fix
    S1 A queued run when the turn fails with a provider error, or the worktree is missing (Orchestrator.ts ~2691-2720) Held: the whole queue gets queueHeld:true and waits for the next send or a queue.resume Medium Next part: release the hold when the provider is healthy again, or show "queue paused · Resume" with the reason
    S2 Stop / thread.stop (holdStoppedThread, ~13780) Held (the person stopped work, so this is intended). A steer that Stop hit is cancelled, with the notice "Steer delivery not confirmed… Resend it if needed" Medium Keep the hold. Turn the cancelled steer into a queued message instead of a notice
    S3 Server restart (ProviderRuntimeRecoveryService.ts ~602-625) Queued runs, and user messages the provider never accepted, are re-marked queued + queueHeld → kept waiting until a send or resume. resumeQueuedRuns has no production caller, and the run-update stream starts at the latest sequence, so a queue that is not held at boot has nothing to start it Medium Next part: drain unheld queued runs at boot, and show held ones as paused with Resume
    S4 Queued start throws (failQueuedRunStart, ~2363) That message is marked failed (queued_start_failed), and the rest of the queue is held Low Keep it visible with Retry (rule 3)
    S5 Steer declined, or the turn ended first (EffectWorker.ts ~401-478) Re-sent as a queued or immediate turn with the same message id. If the provider instance is disabled, it is only logged → lost Low Keep it as a queued, held message with the reason
    S6 Refusals in dispatchMessage / ThreadManagementService: archived thread, worktree still preparing, provider disabled, explicit steer with no running turn, a workspace that cannot be recreated Refused, with a receipt; a retry with the same commandId stays refused Low from the composer (the worktree case is W3's hold) Rule 4, except "worktree still preparing", which the client now holds
    S7 Usage limit reached, runtime mode above the ceiling, or provider switch while busy (~2645, 2654, 2900) Held queue Low to medium Show the reason on the queued message (next part)

    Retried sends are idempotent by commandId (the stored receipt is replayed). A different commandId carrying the same messageId is upserted, not refused.

    Part 2 (this round)

    The most likely causes, W1-W3, are fixed by #1503: the send is held and then sent, the chip shows it waiting, and nothing interrupts the running turn. That PR needs #1502 first: it is a list-only PR that announces the seam lines in ChatView.tsx.

    Suggested next parts, most likely first: W7 (the approval panel), then S3 + S1 (held queues after a restart or error: drain them or show them paused), then W4/W5 (more waits in the same table).

    🤖 Generated with Claude Code

  2. scuttletoby commented on Nov 30, 2026

    @scuttletoby
    OwnerAuthor

    Owner's symptom (11-30): the stuck case they hit most is in a long orchestrator turn, while the agent works for a long time or waits on subagents. Their message sits queued until the turn ends. They want it to go into the running turn at its next safe point, without stopping or restarting the work, so they can correct or add to work in progress.

    The Part 1 inventory did not list this case. Part 3 (queued now, priority 1):

    1. T3's own blocking wait tools return early when a person's steer is pending. The wait stays resumable.
    2. A person's queued message is promoted to a steer automatically once the thread has a steerable run, and starts a turn when the thread goes idle. One delivery per message.
    3. The composer shows "Steering in: arrives after the current step" versus "Queued", and why.

    #1503 (approval and question holds) stays as it is.

    🤖 Generated with Claude Code

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions