Skip to content

fix(server): t3_background_wait error says Workflow runs already keep the thread working - #42661

Merged
juliusmarminge merged 2 commits into
mainfrom
factory/issue-42655
Nov 25, 2026
Merged

juliusmarminge merged 2 commits into
mainfrom
factory/issue-42655

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

When a Claude agent passed a Workflow task ID to t3_background_wait, the error told it which IDs don't belong there but left out Workflow. Agents then told users that workflows can't be waited on, although T3 already keeps the thread working until a workflow finishes. The unmatched message of ThreadManagementBackgroundWaitError now says that subagent, Agent tool and Workflow runs already keep the thread working, and still says delegate_task IDs don't go there.

Fixes #42655

Reproduction on main

Commit: origin/main 95411e3. From a Claude Code session running inside T3 Code, I loaded t3_background_wait with ToolSearch and called it with {"taskIds":["wg53xzo6q"],"waiting":true}, an ID shaped like a workflow task ID. It failed with invalid_request and the reporter's exact text: "None of these IDs is running background work on this thread, so this request registers no wait for them. If the task already finished, read its output now. Otherwise pass the task ID of a background command or Monitor you started. Subagent, Agent tool, and delegate_task IDs don't go here." That server is this VM's preview build, not origin/main; main has the identical string in ThreadManagementService.ts (ThreadManagementBackgroundWaitError, reason 'unmatched'). I did not start a real Workflow, because agents may launch one only when the user asks. In the code, ClaudeAdapterV2.awaitBackgroundTasks matches IDs only against pendingBackgroundTasksByNativeThread, which holds only CLAUDE_OPAQUE_BACKGROUND_TASK_KINDS (local_bash). local_workflow tasks are tracked as subagent items, so a workflow ID can never match and always gets this message. CLAUDE_BACKGROUND_WAIT_INSTRUCTIONS in ClaudeAdapterV2.ts does not mention workflows either. I added a test to ThreadManagementService.test.ts that checks the unmatched message contains 'Workflow'; it fails on main with the message above.

Evidence

Run the same real Claude call on both commits: load t3_background_wait through ToolSearch, call {"taskIds":["wg53xzo6q"],"waiting":true}, then expand the raw tool response in T3 Code. No Workflow was launched. Environment: fresh isolated dev servers, synthetic project, Claude Haiku 5.5, browser viewport 1280ร—800 at 2ร— density, light theme.

Before After
95411e3cd7 e8593ef4ae
Before: error omits Workflow After: error explains Workflow runs already keep the thread working
Before recording After recording

Seed and reproduction driver ยท Browser steps ยท Runtime transcript

The call remains invalid on both commits, as expected. The verified fix is the explanatory error text.

Not shown:

  • Claude background-wait instructions were not improved by this commit: the diff changes only the unmatched error message, so the optional instruction improvement remains outstanding.
  • Actual Workflow lifetime and Working-state retention were not exercised; this follows the supplied reproduction using a Workflow-shaped ID without launching a Workflow.

Tests

  • vp test run src/orchestration-v2/ThreadManagementService.test.ts (apps/server): 39 passed, including the repro test from factory/repro-42655
  • vp run check:changed: format, lint, knip, graphql, typecheck (3 packages) and tests (2 files) all pass
  • CI on e8593ef: all 8 required checks passed

Not in this change

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

juliusmarminge and others added 2 commits November 25, 2026 06:25
Fails on main: the message lists Subagent, Agent tool and delegate_task IDs
but not Workflow, so agents conclude workflows cannot be waited on (#42655).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
โ€ฆ the thread working

A Workflow task ID passed to t3_background_wait never matches a background
command, so the agent gets the 'unmatched' error. That error listed only
Subagent, Agent tool and delegate_task IDs as not belonging there, and agents
concluded workflows could not be waited on. Name Workflow too, and say these
runs already keep the thread working until they finish (#42655).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

โœ… Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB โœ…
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB โœ…
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB โœ…
Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB โœ…
Codex Live turn messages 1 1 0 (0.0%) 8 โœ…
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB โœ…
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB โœ…
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB โœ…
Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB โœ…
Claude Live turn messages 1 1 0 (0.0%) 8 โœ…

Other scenarios

All 64 scenario measurements match main.

All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling
Codex short turn resume WebSocket decoded 10.5 KiB 10.5 KiB 0 B (0.0%) 12.7 KiB โœ…
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 โœ…
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB โœ…
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 โœ…
Codex long turn running, history page HTTP decoded 92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB โœ…
Codex long turn running, history page rows 75 75 0 (0.0%) 75 โœ…
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB โœ…
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 โœ…
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB โœ…
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 โœ…
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 โœ…
Codex long turn finished, work page HTTP decoded 186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB โœ…
Codex long turn finished, work page rows 150 150 0 (0.0%) 150 โœ…
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B โœ…
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 โœ…
Codex fleet shell snapshot HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB โœ…
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 โœ…
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B โœ…
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 โœ…
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B โœ…
Codex fleet shell resume check rows 0 0 0 0 โœ…
Codex stale shell reload HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB โœ…
Codex stale shell reload rows 27 27 0 (0.0%) 27 โœ…
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B โœ…
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 โœ…
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB โœ…
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 โœ…
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 โœ…
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 โœ…
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 โœ…
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 โœ…
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 โœ…
Claude short turn resume WebSocket decoded 10.6 KiB 10.6 KiB 0 B (0.0%) 12.7 KiB โœ…
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 โœ…
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB โœ…
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 โœ…
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB โœ…
Claude long turn running, history page rows 75 75 0 (0.0%) 75 โœ…
Claude long turn finished, cold open HTTP decoded 384.2 KiB 384.2 KiB 0 B (0.0%) 410.2 KiB โœ…
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 โœ…
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB โœ…
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 โœ…
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 โœ…
Claude long turn finished, work page HTTP decoded 188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB โœ…
Claude long turn finished, work page rows 150 150 0 (0.0%) 150 โœ…
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B โœ…
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 โœ…
Claude fleet shell snapshot HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB โœ…
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 โœ…
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B โœ…
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 โœ…
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B โœ…
Claude fleet shell resume check rows 0 0 0 0 โœ…
Claude stale shell reload HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB โœ…
Claude stale shell reload rows 27 27 0 (0.0%) 27 โœ…
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B โœ…
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 โœ…
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB โœ…
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 โœ…
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 โœ…
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 โœ…
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 โœ…
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 โœ…
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 โœ…

Baseline: c6c8b20 ยท PR result: e8593ef ยท Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change โ†’

No actionable comments were generated in the recent review.

Walkthrough

The unmatched background-task wait error now explains that delegate_task IDs are not accepted and that Subagent, Agent tool, and Workflow runs keep the thread working until completion. A unit test checks that the message mentions Workflow.

Changes: Background wait guidance

Layer / File(s) Summary
Update unmatched error guidance
apps/server/src/orchestration-v2/ThreadManagementService.ts, apps/server/src/orchestration-v2/ThreadManagementService.test.ts
The unmatched error message now names Workflow runs and explains that these runs keep the thread working. A unit test checks for โ€œWorkflowโ€ in the message.

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

Change: Bug fix ยท Severity of issue fixed: Low

Suggested reviewers: voltcrash

Merge Risk: Minimal ยท up to e8593

This updates an error message to mention Workflow runs. It does not change wait behavior, and no meaningful merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the t3_background_wait error for background-task waits now says Workflow runs already keep the thread working. It is specific and matches the changeset (the unmatched โ€ฆ
Linked Issues check Passed [#42655] The expected behavior requires that an unmatched workflow ID produce an error that says workflows already hold the thread, as subagents, Agent tool and delegate_task IDs do. The head changes โ€ฆ
Out of Scope Changes check Passed The whole-PR diff against the merge base 95411e3 touches two files. ThreadManagementService.ts changes one string in the unmatched case of ThreadManagementBackgroundWaitError, which is the erroโ€ฆ
Description check Passed The description follows the repository template closely. It has a clear Problem section (agents told users workflows cannot be waited on, though the thread already stays Working until a workflow finisโ€ฆ
Full details: Title check

Explanation

The title names the main change: the t3_background_wait error for background-task waits now says Workflow runs already keep the thread working. It is specific and matches the changeset (the unmatched message in ThreadManagementService.ts and its test). It follows a conventional commit format with a 'fix(server)' scope.

Full details: Linked Issues check

Explanation

[#42655] The expected behavior requires that an unmatched workflow ID produce an error that says workflows already hold the thread, as subagents, Agent tool and delegate_task IDs do. The head changes the unmatched message of ThreadManagementBackgroundWaitError in apps/server/src/orchestration-v2/ThreadManagementService.ts to: "Subagent, Agent tool, and Workflow runs already keep the thread working until they finish, and delegate_task IDs don't go here either." The diff shows this change and no other source change. The added test in ThreadManagementService.test.ts asserts that the message contains "Workflow". The test is a substring check and does not exercise the full wait path, but it covers the stated error requirement. The issue title and the 'Actual behavior' section also mention CLAUDE_BACKGROUND_WAIT_INSTRUCTIONS. The PR leaves that constant unchanged and states the reason (an MCP tool-use eval and model API keys are needed). The issue's expected behavior does not require that constant to change, and the issue says no eval case is needed. This deferral is noted, not treated as a failure. The coding requirement for the error text is met.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base 95411e3 touches two files. ThreadManagementService.ts changes one string in the unmatched case of ThreadManagementBackgroundWaitError, which is the error text the linked issue targets. ThreadManagementService.test.ts adds one test that checks that message. Both changes connect directly to #42655. No unrelated code, refactoring, or configuration change appears in the diff. The PR description's deferred items (CLAUDE_BACKGROUND_WAIT_INSTRUCTIONS, open PR #37015) are not implemented here, so they add no out-of-scope change.

Full details: Description check

Explanation

The description follows the repository template closely. It has a clear Problem section (agents told users workflows cannot be waited on, though the thread already stays Working until a workflow finishes), a Change section (the unmatched message of ThreadManagementBackgroundWaitError now names Subagent, Agent tool, and Workflow runs), a Scope section linking issue #42655, and a Verification section with specific focused test commands, observed results (39 passed), a before/after reproduction with evidence, and an explicit list of what was not exercised. It also names the models and harness used, as the template asks. The description is complete and specific, so it passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • 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 c6c8b20 and e8593ef.

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; 5 remain after this review.

@juliusmarminge
juliusmarminge merged commit 6adff22 into main Nov 25, 2026
39 checks passed
@juliusmarminge
juliusmarminge deleted the factory/issue-42655 branch November 25, 2026 06:49
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Nov 25, 2026
**v0.1.12-nightly.20261125.5230** ยท 41 changes from 11 contributors

- **Richer workflow questions.** Workflow questions can include described choices, required reasons, links, and records of who answered and when.
- **Thread actions in command palette.** Pin, snooze, settle, archive, and manage the current thread from the command palette.
- **Withdraw workflow questions.** Workflows can withdraw waiting questions without cancelling the run.
- **Antigravity swarm workers.** See Antigravity swarm workers as subagents, including who is working and what they found.
- **Faster thread switching.** Thread timelines now appear in the first frame instead of after a noticeable delay.
- **Browser select menus.** Native dropdown menus now open in streamed browser tabs so you can choose an option.
- **Permanent thread deletion.** Deleting a thread now removes its conversation history instead of only hiding it.

### Plus 32 more bug fixes.

<details>
<summary>Full changelog</summary>

## What's Changed
* fix(cli): exclude spans before the trace summary window by @jadelike-wine in pingdotgg/t3code#42571
* fix(grok): expose context usage by @gujunxiang in pingdotgg/t3code#42568
* fix(web): timeline minimap previews no longer cut an emoji in half by @only21mil in pingdotgg/t3code#42575
* fix(web): Option and Cmd arrows reach full-screen terminal apps by @Mnigos in pingdotgg/t3code#42574
* fix(web): element context preview no longer ends in a split surrogate by @only21mil in pingdotgg/t3code#42585
* fix(server): Antigravity sends undecodable text attachments as a path instead of failing the turn by @juliusmarminge in pingdotgg/t3code#42594
* fix(resource-monitor): Windows stops reading memory and command lines of untracked processes by @juliusmarminge in pingdotgg/t3code#42577
* fix(server): ODT attachments no longer start with text from number styles by @only21mil in pingdotgg/t3code#42592
* feat(server): workflow questions take described choices, required reasons, links, and keep who answered by @juliusmarminge in pingdotgg/t3code#42515
* fix(web): citation comment box stays open when its cited row scrolls out by @juliusmarminge in pingdotgg/t3code#42603
* fix(web,mobile): author avatars keep emoji initials whole by @only21mil in pingdotgg/t3code#42598
* fix(gitlab): incident links are read as issue links by @Michel-Liao in pingdotgg/t3code#42605
* fix(server): workflow schedules given as bigint nanoseconds no longer crash by @only21mil in pingdotgg/t3code#42607
* fix(pi): reject generated text from failed responses by @StiensWout in pingdotgg/t3code#42602
* fix(preview): streamed browser tabs show native select menus by @juliusmarminge in pingdotgg/t3code#31561
* fix(web): long Workflows links no longer end in a broken character by @only21mil in pingdotgg/t3code#42617
* fix(server): filter open device sessions by the selected host by @AppsAtMe in pingdotgg/t3code#42600
* fix(antigravity): link directly to Google account verification on failed turns by @t3dotgg in pingdotgg/t3code#41210
* fix(server): Needs you lists paused runs older than the newest 500 by @KyrosHendrix in pingdotgg/t3code#42618
* feat(server): CI runners don't need telemetry by @t3dotgg in pingdotgg/t3code#42630
* fix: screenshots after a caption render full size instead of as chips by @juliusmarminge in pingdotgg/t3code#42627
* fix(pi): rewind turns after an extension switches sessions by @StiensWout in pingdotgg/t3code#42616
* fix(mobile): Compose without a project opens the picker in one push by @juliusmarminge in pingdotgg/t3code#42593
* fix(web): project name field restores the saved name when cleared by @only21mil in pingdotgg/t3code#42622
* fix(mobile): a share sent while a new-task draft is open joins that draft by @juliusmarminge in pingdotgg/t3code#42597
* fix(telemetry): honor DO_NOT_TRACK by @t3dotgg in pingdotgg/t3code#42629
* fix(server): device host errors no longer cut an emoji in half by @only21mil in pingdotgg/t3code#42628
* fix(pi): let background subagents finish after coordinator errors by @StiensWout in pingdotgg/t3code#42624
* fix(server): deleting a thread actually removes its history by @t3dotgg in pingdotgg/t3code#42119
* fix(server): unreadable sessions no longer block older history by @StiensWout in pingdotgg/t3code#42613
* fix(server): skip incomplete Pi records during project discovery by @StiensWout in pingdotgg/t3code#42636
* fix(server): restore the default provider name when clearing a label by @StiensWout in pingdotgg/t3code#42632
* test(provider-testing): replay workspaces start no background git maintenance by @juliusmarminge in pingdotgg/t3code#42651
* fix(antigravity): /swarm workers show as subagents by @t3dotgg in pingdotgg/t3code#42649
* feat(web): settle, pin, snooze and more for the current thread from cmd+k by @t3dotgg in pingdotgg/t3code#40742
* feat(server): withdraw a waiting workflow question without cancelling its run by @juliusmarminge in pingdotgg/t3code#42506
* fix(web): fade project picker tooltips in place on scroll by @Yash-Singh1 in pingdotgg/t3code#42657
* fix(server): shells with a backslash in their name no longer get zsh flags on Linux and macOS by @only21mil in pingdotgg/t3code#42648
* perf(web): thread switches paint the timeline in their first frame by @juliusmarminge in pingdotgg/t3code#42582
* fix(server): t3_background_wait error says Workflow runs already keep the thread working by @juliusmarminge in pingdotgg/t3code#42661
* fix(server): preserve spaces and tabs in checkpoint LFS storage by @jadelike-wine in pingdotgg/t3code#42634

## New Contributors
* @gujunxiang made their first contribution in pingdotgg/t3code#42568
* @AppsAtMe made their first contribution in pingdotgg/t3code#42600

**Full Changelog**: pingdotgg/t3code@v0.1.12-nightly.20261125.5222...v0.1.12-nightly.20261125.5230

</details>


Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.1.12-nightly.20261125.5230
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). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: t3_background_wait error and Claude instructions don't say Workflow tasks already hold the thread

1 participant