Skip to content

fix(server): explain background wait registration timeouts - #33658

Open
voltcrash wants to merge 2 commits into
pingdotgg:mainfrom
voltcrash:t3/background-wait-timeout
Open

voltcrash wants to merge 2 commits into
pingdotgg:mainfrom
voltcrash:t3/background-wait-timeout

Conversation

@voltcrash

Copy link
Copy Markdown
Contributor

Problem

t3_background_wait reports its 15-second registration timeout as “Failed to update the awaited background work.” Agents cannot distinguish that timeout from an ordinary provider failure or see that they can retry.

Change

Report registration timeouts separately, with guidance to retry using the same task IDs. Keep the existing deadline, underlying cause and caller interruption behavior.

Scope and approval

Fixes #33646. This is a small, focused correction to error classification and guidance for an existing operation. Provider locking and wait registration behavior stay the same.

Verification

  • The regression failed on unchanged upstream: expected timed-out, received failed. The fixed service suite passes all 29 tests.
  • env -u DISPLAY -u WAYLAND_DISPLAY vp run check:changed upstream/main passes, including three affected package typechecks and 31 tests.
  • A native-clock probe using the real service, in-memory SQLite and synthetic session boundaries reached the actual 15-second deadline. Before: generic failed with TimeoutError. After: timed-out, retry guidance, one adapter invocation and cancellation. Success, ordinary provider failure and caller interruption retained their behavior. The MCP handler passes the service message through unchanged.

Actual loaded-Claude lock contention remains unproven. A real-model retry eval was not run because the eval runner's credentials/proxy were unavailable; no model-level retry success is claimed.

Reviewed with review-loop: 1 round with Claude Opus 5.5 on xhigh. Reviewer verdict: approved.

Created with GPT-6.1 Sol in Codex through T3 Code.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 10, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at d5be223

Macroscope's review found this PR approvable — Background-wait registration timeouts now receive a specific message with retry guidance. The existing deadline and underlying registration behavior remain unchanged, limiting exposure to error reporting.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Background-task wait timeouts now return a distinct timed-out error with retry guidance. Other runtime failures continue to return failed. Tests cover timeout and runtime-failure outcomes, plus successful, unavailable, and unsupported outcomes.

Changes: Background wait error handling

Layer / File(s) Summary
Timeout error contract and classification
apps/server/src/orchestration-v2/ThreadManagementService.ts
The error reason accepts timed-out and its message reports the 15-second timeout and advises retrying with the same task IDs. awaitBackgroundTasks maps timeout causes to this reason; other failures map to failed.
Background wait failure tests
apps/server/src/orchestration-v2/ThreadManagementService.test.ts
Tests cover runtime failure and timeout, including advancing the test clock to the 15-second limit. They also cover successful, unavailable, and unsupported outcomes.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to cac32

Background-wait registration timeouts now return a distinct timed-out error with same-ID retry guidance, and other failures still return failed. The change is narrow and tested, with no concrete merge-blocking risk identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(server): explain background wait registration timeouts" matches the main change. The diff adds a distinct "timed-out" reason to ThreadManagementBackgroundWaitError, and the 15-second re…
Description check Passed The description follows the template's required sections: Problem, Change, Scope, and Verification. The Problem section explains the generic timeout message and why it hinders agents. The Change secti…
Linked Issues check Passed [#33646] asks that a registration timeout in t3_background_wait be reported distinctly, so the agent can tell a busy-session timeout from a failure and retry. At head cac3203, ThreadManagementService.…
Out of Scope Changes check Passed The whole-PR diff from merge base 66cc44d to head cac3203 changes two files. ThreadManagementService.ts adds the Cause import, the "timed-out" reason and message, and the timeout-based reason selectio…
Full details: Title check

Explanation

The title "fix(server): explain background wait registration timeouts" matches the main change. The diff adds a distinct "timed-out" reason to ThreadManagementBackgroundWaitError, and the 15-second registration timeout is now reported separately with same-task-ID retry guidance instead of a generic failure. The title is specific and follows the conventional commit style used in the template.

Full details: Description check

Explanation

The description follows the template's required sections: Problem, Change, Scope, and Verification. The Problem section explains the generic timeout message and why it hinders agents. The Change section states the timed-out classification and retry guidance. Scope links issue #33646 and explains why the change is a bug fix. Verification gives focused test results (29 tests passing, a regression that failed before the fix), a native-clock probe, and the limits of what was checked, including the unproven Claude lock contention and the unrun real-model eval. The template's optional agent attribution line is present. Minor gap: the Scope section does not explicitly state why no issue is needed, but a linked issue exists, so this is not required.

Full details: Linked Issues check

Explanation

[#33646] asks that a registration timeout in t3_background_wait be reported distinctly, so the agent can tell a busy-session timeout from a failure and retry. At head cac3203, ThreadManagementService.ts adds a "timed-out" reason to ThreadManagementBackgroundWaitError. The new message states the 15-second timeout and says to retry with the same task IDs. In awaitBackgroundTasks, reason is set to "timed-out" when Cause.isTimeoutError(cause) holds. All other failures keep "failed" and keep the underlying cause. The 15-second deadline and the lock and registration logic are unchanged. ThreadManagementService.test.ts adds a timed-out case. It blocks the runtime with Effect.never, advances TestClock by 14999 ms, confirms the request is still pending, advances 1 ms, and asserts reason "timed-out" with a TimeoutError cause and one adapter call. It also adds a runtime-failed case that asserts "failed" with the provider error. The issue lists lock changes as optional fixes, so leaving the lock unchanged does not fail this check. Residual uncertainty: the MCP handler's pass-through of the new message is taken from the issue and PR description. It was not re-read in this diff. Real-host lock contention is not reproduced, as the PR states.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff from merge base 66cc44d to head cac3203 changes two files. ThreadManagementService.ts adds the Cause import, the "timed-out" reason and message, and the timeout-based reason selection. ThreadManagementService.test.ts adds the runtime-failed and timed-out cases and their assertions, plus the Cause and Fiber-based flow those cases need. Each change supports the timeout classification and retry guidance for #33646. No unrelated edits appear in the diff. Residual uncertainty: the MCP handler file is not part of this diff, so no change there is in scope or out of scope.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 7b64380 and cac3203.

Files selected for processing: 2

  • apps/server/src/orchestration-v2/ThreadManagementService.test.ts
  • apps/server/src/orchestration-v2/ThreadManagementService.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@juliusmarminge

Copy link
Copy Markdown
Member

The automated pipeline stopped on this pull request and will not merge it:

the capture step could not show the problem on the base commit, so there is nothing to prove fixed.

On each commit, ran two completed batches of four concurrent threads. Each thread launched sleep 120 using background Bash, obtained its valid task ID, and repeatedly called t3_background_wait while alternating waiting=false and waiting=true for 12 requested registrations. Inspected persisted raw tool results and the web conversation. The exported transcripts contain 105 completed calls on base and 109 on head, including additional agent calls; none returned a timeout error. One head call returned unmatched after its task finished. An additional batch's launches stalled before producing results.

It stays open for a person to finish or close.

@ZenYoda3

Copy link
Copy Markdown

Note

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

I reported #33646. The capture likely missed it because the timeout needs a heavily loaded host, and four concurrent threads don't get there.

From our own Claude Code transcripts, T3 0.1.9 on macOS (8 cores), Claude provider, about 30 agent threads at once:

  • 25 of about 1,400 t3_background_wait calls between 9 and 13 Nov failed with "Failed to update the awaited background work." The failing calls took a median of about 22 s, past the 15 s registration deadline.
  • Of the 824 calls our 1-minute load-average log covers (10 to 13 Nov), 12 of 132 (about 9%) failed while load was above 150, and 3 of 692 (under 0.5%) at 150 or below. Median load was about 200 at a failure and 24 at a success.

So a capture that should show it on base is the same script with the host saturated while the waits register: far more concurrent threads, or CPU load well above the core count. We haven't run that capture ourselves, because the machine where we see it runs our agents. The new message in this PR would at least tell agents to retry.

@github-actions

Copy link
Copy Markdown
Contributor

This PR conflicts with main. Rebase it or merge main into it. If it still conflicts after 7 days with no activity, it will be closed automatically.

See the conflict window.

@github-actions github-actions Bot added the needs-rebase Conflicts with its base branch. Closes after 7 days with no activity. label Nov 13, 2026
@voltcrash
voltcrash force-pushed the t3/background-wait-timeout branch from 6b92a02 to 2d96d63 Compare November 13, 2026 07:53
@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 13, 2026
@juliusmarminge
juliusmarminge force-pushed the t3/background-wait-timeout branch from 82020dc to 7b64380 Compare November 13, 2026 16:31
@juliusmarminge

Copy link
Copy Markdown
Member

The automated pipeline stopped on this pull request and will not merge it:

the fix is written and reviewed, but proving it needs something no worker has:

  • Permanent blocker: The reported reproduction requires concurrent live Claude threads with working first-party Claude access, which the VM brief lists as unavailable. A configured OAuth token alone does not establish usable access.
  • The generic error on base, explicit timeout advice on head, and retrying with the same task IDs remain unverified under the reported host-load conditions.

It stays open for a person to finish or close.

@juliusmarminge juliusmarminge added takeover:blocked Takeover blocked; reason in the PR body and removed takeover:in-progress A takeover lead is working on this PR labels Nov 13, 2026
@github-actions github-actions Bot removed the needs-rebase Conflicts with its base branch. Closes after 7 days with no activity. label Nov 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR conflicts with main. Rebase it or merge main into it. If it still conflicts after 7 days with no activity, it will be closed automatically.

See the conflict window.

voltcrash and others added 2 commits November 30, 2026 13:15
Preserve the 15-second registration bound and report timeouts with retry guidance while leaving provider failures and interruption unchanged.

Implemented by GPT-6.1 Sol through Codex in T3 Code.

Co-authored-by: GPT-6.1 Sol <[email protected]>
AI-assisted; verified with the tests and tools listed above.
@voltcrash
voltcrash force-pushed the t3/background-wait-timeout branch from 7b64380 to cac3203 Compare November 30, 2026 07:46
@github-actions github-actions Bot removed the needs-rebase Conflicts with its base branch. Closes after 7 days with no activity. label Dec 1, 2026

This branch has not been deployed

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

Labels

size:XS 0-9 changed lines (additions + deletions). takeover:blocked Takeover blocked; reason in the PR body vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[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."

3 participants