Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: A run for a background-command notice the provider already consumed hangs `running` for hours and blocks the thread's queued runs #26537

Closedrickdiculousli(GitHub profile, opens in a new tab) opened this issue 2 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

This happened once, and it depends on timing. All times below are UTC, taken from orchestration_v2_projection_runs and orchestration_events in statev2.sqlite, for thread ae40089f-f48e-4be6-b351-62d8a3c78077.

  1. In a Claude thread, start a background command (Bash with run_in_background) and end the turn.
  2. Send a user message at about the moment the background command finishes, so that T3 creates two runs within about 130 ms:
    • run 146 at 06:58:25.045, for the user message (createdBy: user)
    • run 147 at 06:58:25.172, for the background-command notification (createdBy: agent, creationSource: provider, notification.source.kind: background_command, "Command … finished")
  3. Run 146 starts. Claude Code delivers the background-command completion inside that same turn, together with the user message, and the turn ends normally at 06:59:36.394.
  4. Run 147 starts at 06:59:36.831, and its provider turn is created at 06:59:36.885.

Expected behavior

A background-command notification that the provider already consumed in the previous turn doesn't start a run of its own; if such a run does start, it settles. In either case, later queued runs on the thread start, and a delegated task's completion reaches its parent.

Actual behavior

  • Run 147 emits no provider output for 8 h 14 min. Claude Code had nothing new to answer, so it never began a turn, and the run stayed running.
  • Every run queued behind it waited, unstarted:
    • run 148 at 07:08:59.986: a user message (creationSource: mobile)
    • run 149 at 07:37:36.848: the completion wake for a delegate_task child whose last run completed at 07:37:36.215
  • At 15:13–15:14 the user sent another message:
    • runs 148, 149 and 150 were cancelled
    • the new message was steered into run 147, which then produced a normal turn
  • Neither the queued user message nor the delegated child's completion was ever delivered to the agent. The child's result could still be read with task_status.
  • The thread looked idle for the whole time. Its parent agent sat waiting for the delegate's completion, and the user's message got no reply.
runcreatedstartedendedstatusfor
14606:58:25.04506:58:25.23906:59:36.394completeduser message
14706:58:25.17206:59:36.83115:19:56.043completedbackground-command notification, already consumed in 146
14807:08:59.986—15:13:28.086cancelleduser message (never delivered)
14907:37:36.848—15:14:28.251cancelleddelegated-task completion wake (never delivered)
15015:13:12.726—15:13:29.515cancelleduser message, steered into 147

In orchestration_events, this thread has 16 events between 07:00 and 15:13: the queued runs being created, and nothing from run 147's provider turn.

How often: this is the only case in this database (1,163 runs across 136 threads since 2026-10-16) of a run that held a thread for an hour or more while later runs waited unstarted.

Related, but each has a different trigger:

  • #16449: a run stuck running after a provider error (fixed for Stop by #15442; nothing here detects the stall)
  • #22423: steered or queued input lost around a provider crash
  • #21837: a delegated completion lost while nested work runs

Impact

Blocks work completely

Version or commit

T3 Code (Beta) 0.1.3 (desktop)

Environment

macOS 26.5.2, Claude Code 2.1.311, provider claudeAgent with claude-opus-5-5

Logs or stack traces

# runs on the thread, from orchestration_v2_projection_runs (UTC)
146|completed|2026-10-28T06:58:25.045Z|2026-10-28T06:59:36.394Z
147|completed|2026-10-28T06:58:25.172Z|2026-10-28T15:19:56.043Z
148|cancelled|2026-10-28T07:08:59.986Z|2026-10-28T15:13:28.086Z
149|cancelled|2026-10-28T07:37:36.848Z|2026-10-28T15:14:28.251Z
150|cancelled|2026-10-28T15:13:12.726Z|2026-10-28T15:13:29.515Z

Workaround

Sending any message to the thread steers it into the stuck run and wakes it. A lost delegated result can be read with task_status, and the lost user message has to be sent again.

  1. Note

    opus-5.5 responding on behalf of Ryan.

    A second occurrence, on Linux (AppImage) on 2026-10-29. It took no user message at all. A queued watch_pull_request wake was the turn that answered the background-command notice, so an agent that babysits a PR while a background command runs can hit this on its own. The thread was blocked for 9 h 3 min.

    Times are UTC, from orchestration_events in statev2.sqlite.

    runcreatedstartedendedstatusmessage
    311:31:06.73511:31:06.93211:32:11.921completedPR-watch wake (createdBy: agent, creationSource: server). Starts Bash with run_in_background at 11:31:45 and ends the turn.
    411:31:06.82911:32:12.21411:35:54.258completedPR-watch wake, queued behind run 3
    511:32:12.00311:35:54.47520:38:51.902interrupted by handbackground-command notice (notification.source.kind: background_command, creationSource: provider)
    6–1211:33:08 to 12:27:37never—queuedPR-watch wakes, queueHeld: true after the interrupt

    What happened:

    1. The background command finished as run 3 ended. T3 created run 5 for the notice 82 ms after run 3 completed.
    2. Run 4 was already queued, so it started first, 211 ms after run 5 was created. Claude delivered the completion inside run 4. Three seconds in, the agent read the command's output, then worked on for another 3.5 minutes.
    3. Run 5 started when run 4 ended. Its provider turn opened at 11:35:54.496 and produced no frames for 9 h 3 min. Seven PR-watch wakes queued behind it.

    This is the same mechanism as the original report, but the turn that answered the wake was a T3-sent wake, not a user message. #26554 looks like it covers this: it marks the buffered frames on the userMessage !== null path, and a PR-watch message (creationSource: server) fails isClaudeProviderContinuationTurn, so it gets a prompt UUID. A test case where the answering turn is a server-created message would pin that down, since that is the case that needs no human timing.

    Not checked: whether a build with #26554 stops this exact sequence. I haven't run one.

  2. tanstack-source added labelsbug

  3. This is the same problem as #28010, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.

  4. juliusmarminge closed this

Sign in to join this conversation.