Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: t3_background_wait times out after 15 s on a busy Claude session and reports it as "Failed to update the awaited background work." #33646

OpenZenYoda3(GitHub profile, opens in a new tab) opened this issue 1 comment

Note

🤖 claude-opus-5-5 responding on behalf of ZenYoda3

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

Not deterministic; it shows up when the server is under heavy load. What we see:

  1. A Claude provider thread starts a background task (for example a background Bash command).
  2. The agent calls t3_background_wait with that task's valid id.
  3. On a heavily loaded machine, the call sometimes fails after 16.6 s or more.

A deterministic test should be possible in ThreadManagementService: give it a runtime whose awaitBackgroundTasks doesn't finish within 15 s (for example one blocked on a held sdkMessageLock), then advance the test clock past 15 s.

Expected behavior

The wait registers. If it can't in time, the error says it timed out, so the agent knows to retry.

Actual behavior

Failed to update the awaited background work. Nothing in the message says it was a timeout, so the agent can't tell a busy session from a real failure.

From source (main bbdc7dc, the same as v0.1.8; v0.1.7 has the same code at other line numbers):

  • ThreadManagementService.awaitBackgroundTasks wraps the adapter call in Effect.timeout("15 seconds") and maps every failure, the timeout included, to reason "failed" (L1451-L1465; message at L342). The MCP handler passes that message through unchanged.
  • ClaudeAdapterV2.awaitBackgroundTasks runs under sdkMessageLock.withPermits(1) (L12063-L12095). That is the same one-permit semaphore (L5138) that each incoming SDK message holds while it is handled (L11073-L11075), and that continuation starts also take (L11356, L11450). The roster update itself only writes to memory, so the likely place the 15 s goes is waiting for that lock.
  • What we can't tell from outside: whether the lock was held by slow message handling or the whole server was stalled. Time is also lost outside the timed section (the caller lookup and getThreadRecords run before it): 22 of our successful waits also took over 15 s end to end.

Possible fixes, your call: give the timeout its own reason so the error says "timed out, retry", don't hold the message lock for the roster update, or both.

Related but different: #29772 and PR #29773 (a wait on task ids that don't exist succeeds); this report is about valid ids timing out.

Impact

Minor bug or occasional failure

Version or commit

Desktop 0.1.7 (where it happened). The code is unchanged in v0.1.8 and on main bbdc7dc.

Environment

macOS 27.2 on an 8-core Mac, T3 Code desktop (Beta) 0.1.7, Claude provider (Claude Code 2.1.318). Many Claude threads at once on 4 accounts: in the 10-minute windows with a failure, 15 to 54 sessions were active.

Logs or stack traces

From our agent transcripts, 3 to 10 Nov 2026 (all failures fell between 6 and 10 Nov):

t3_background_wait calls that failed with this error: 25, in 22 threads, on 4 accounts
time to fail:     16.6 s to 69.1 s, end to end (every one over the 15 s timeout)
successful waits: 1,976, median 0.04 s, p95 4.0 s
clusters:         13 of the 25 failures within one hour (7 Nov, 08:41-09:42 UTC),
                  5 more within 20 minutes (9 Nov, 06:04-06:24 UTC)
load:             1-min load averages our agents logged within 30 min of a failure:
                  median 68 on 8 cores (median 42 at other times)

Screenshots, recordings, or supporting files

No response

Workaround

Call t3_background_wait again with the same id. Of the 19 failures followed by another wait on the same thread, the next call succeeded 16 times.

Created with claude-opus-5-5 in Claude Code inside T3 Code.

  1. tanstack-source added labelsbug

  2. Note

    🤖 claude-opus-5-5 responding on behalf of ZenYoda3

    More data from v0.1.13, measured from one machine's Claude session transcripts over about 2h45m on a busy day (around 10 Claude threads active at once).

    • 9 of 78 t3_background_wait calls (12%) returned Failed to update the awaited background work.
    • Every one of those took 15.1 to 20.4 s to return, and every awaited task was still running when the call was made. That matches the 15 s Effect.timeout in ThreadManagementService.awaitBackgroundTasks and a wait on sdkMessageLock in ClaudeAdapterV2.
    • The 9 failures formed 5 episodes of retries. 2 episodes succeeded on the next call, 1 on the third, and 2 never succeeded.
    • One cluster came during a 5-minute period when the server logged Trace writer could not keep up, just before a restart.

    The cost is larger than a retry. After a server restart, RestartContinuation only starts a turn for a thread with open awaited work. A thread whose registration timed out got no continuation, and sat idle for 39 minutes after its background command was cancelled. A failed registration silently turns a restart-safe wait into a stranded one.

    Code is still the same on main (bare 15 s timeout, every cause mapped to failed). #33658 would at least let an agent tell a timeout from a real failure.

Sign in to join this conversation.