You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(server): t3_background_wait error says Workflow runs already keep the thread working - #42661
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.
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.
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
CLAUDE_BACKGROUND_WAIT_INSTRUCTIONS in ClaudeAdapterV2.ts still does not mention workflows; changing it needs an mcp-tool-use eval case and runs, which need model API keys.
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>
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.
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.
This updates an error message to mention Workflow runs. It does not change wait behavior, and no meaningful merge risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
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
[#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
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
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
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:XS0-9 changed lines (additions + deletions).vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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. Theunmatchedmessage ofThreadManagementBackgroundWaitErrornow says that subagent, Agent tool and Workflow runs already keep the thread working, and still saysdelegate_taskIDs 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_waitthrough 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.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:
Tests
vp test run src/orchestration-v2/ThreadManagementService.test.ts(apps/server): 39 passed, including the repro test from factory/repro-42655vp run check:changed: format, lint, knip, graphql, typecheck (3 packages) and tests (2 files) all passNot in this change
Who did the work
Run by the t3code factory in T3 Code.