Repository navigation
Description
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
- Use a top-level thread with
claudeAgent/claude-opus-5-5in full access, inside a Git project. - Have the agent call
t3_worktree_handoffwith acontinuationPrompt. My call was{"branch":"repro-b","startFromOrigin":false,"runSetupScript":false,"continuationPrompt":"run pwd and git branch --show-current, …"}.
This is the open part of #15136, split out as requested in #15136 (comment). #17028 fixed the delegated-task side, where the parent stayed "running" behind a held wake. It did not fix the handoff itself.
Expected behavior
The handoff turn ends cleanly, and the continuation starts on its own in the new worktree. Codex threads already work this way.
Actual behavior
On 0.1.2-nightly.20261021.3457, built from main on 2026-10-21, using a throwaway repo:
- The worktree and branch are created, and the thread is rebound to them.
- About 1.6 s after the handoff
tool_use, T3 sendsquery.closeto the Claude session (10:06:50.8Z → 10:06:52.4Z). - Run 1 is recorded as a provider failure:
ProviderAdapterEventStreamError … [cause]: Error: Workspace changed.. The UI shows "The provider event stream closed unexpectedly." - The continuation never starts. No new provider session is opened, and the thread stays idle until a user message is sent.
This matches every agent-initiated handoff in my logs since 2026-10-06. I reported 4 of 4 in #15136, and it still happens on today's build.
Impact
Major degradation or frequent failure
Version or commit
0.1.2-nightly.20261021.3457
Environment
Linux (Ubuntu 26.04, kernel 7.0), t3 serve as a user service, Claude Code 2.1.306
Logs or stack traces
[provider events]
10:06:50.773Z incoming assistant tool_use mcp__t3-code__t3_worktree_handoff
10:06:52.390Z outgoing query.close
(no further query.open for this thread)
[server]
WARN orchestration V2 provider event ingestion failed
runId: run:thread:mcp%3Ac6c415ab-…:ordinal:1
RunExecutionIngestError: Failed while ingesting orchestration V2 run execution …
[cause]: ProviderAdapterEventStreamError: Failed while streaming claudeAgent provider session …
[cause]: Error: Workspace changed.Workaround
Start the thread already bound to the worktree with t3_thread_launch + workspaceStrategy: {type: "worktree", …}. Alternatively, call the handoff without continuationPrompt and send the next message by hand.
Related
- fix(orchestration): resume continuations after planned worktree handoffs #15203: open PR that fixes exactly this (planned detach settles the turn as an intentional stop, so the continuation is promoted). I can test a build of it on Linux with Claude.
- [Bug]: Stale "Waiting on background task T3 Worktree Handoff" banner persists after a Claude worktree handoff #15993: stale "Waiting on background task … worktree handoff" banner after the same failure.
- [Bug]: t3_worktree_handoff never runs the project setup script (call interrupted when the session detaches) #21953: the setup script never runs, because the same detach interrupts the call.
- Agent archiving its own thread with t3_thread_organize fails the running turn with "provider event stream closed unexpectedly" #15135: the same planned-detach failure, triggered by archiving a thread.
Posted by Claude Opus 5.5, running in T3 Code through the Claude Code harness, on behalf of @iamtoled.
Activity
betacatsling commentedon Oct 24, 2026
Additional report from Linux using GPT through the Claude Code harness, with a check of current upstream source before posting.
Observed environment
0.1.2-nightly.20261021.3473, running as a Linux x86_64 user service.claudeAgent(claude-agent-sdk.query), model:codex/gpt-6.1-solvia a custom provider, efforthigh, full access (bypassPermissions).2.1.309.Observed sequence on 2026-10-24 (UTC)
The agent called:
{ "branch": "docs/example-handoff", "baseRef": "main", "startFromOrigin": false, "continuationPrompt": "<remaining task instructions>" }The branch name and task instructions above are anonymized. The relevant provider/server logs are:
The worktree creation/binding succeeded. The handoff run was persisted as
failed, and the UI showed:It also showed Waiting on background task mcp__t3-code__t3_worktree_handoff, matching #15993. After a subsequent Stop/Resume interaction, a previously queued user follow-up ran in the new worktree. At inspection time, the separate handoff-continuation run was still
queuedwith nostartedAt. Thequery.openabove therefore does not demonstrate that thecontinuationPromptauto-resumed.This adds a GPT-backed Claude Code reproduction: the lifecycle failure follows the Claude harness/session, rather than requiring a Claude model. T3 itself issued
query.closeabout 5 ms before the ingestion warning.Current release / main source check
I have not runtime-reproduced this on the newest release, and have not upgraded the affected installation. The following is source inspection only:
v0.1.2.v0.1.3-nightly.20261023.3592.main:aaf4a901c490da4f0943afe1d941f3a8d58dc1c8.All three refs have the same
ProviderSessionManager.tsblob (e82995d1db77f3beb2ecc20c2fff6a59a7dde33e). The relevant path remains:Workspace changed.(Orchestrator.ts).releaseEntrywithreason: "manual_shutdown"and nogracefulSubscribers(ProviderSessionManager.ts).failSubscribers, producingProviderAdapterEventStreamError(release path, error construction).#22825 (draft) and #15203 are both still open/unmerged at checking time. #22863 was closed as a duplicate with an explicit note that closure did not mean the fix had shipped. Posting here instead of opening another duplicate.
Posted by a coding assistant on behalf of @betacatsling; private project paths, conversation IDs, and task text omitted.
Adrish7 commentedon Oct 25, 2026
Another report, from the macOS desktop app: server
0.1.2-nightly.20261021.3473(desktop-managed), darwin arm64, Node 26.12.1, Claude Code 2.1.310. DriverclaudeAgent/claude-opus-5-5, full access. The user reports it also happened on earlier nightlies and in unrelated repos.Frequency: 5 of 5 agent-initiated
t3_worktree_handoffcalls in the retained provider logs (2026-10-15 → 2026-10-25). All five passed acontinuationPrompt.Why the continuation doesn't start: in all five cases the continuation run was set to
queueHeld: truewithin ~10 ms of being queued, right after the handoff run was markedfailed. It stayed held until the user clicked Continue (after 5 s, 7 s, 12 s, 1 m 39 s and 24 m 21 s). The cases that looked "automatic" were also manual clicks. This matches the hold instartNextQueuedRun. The handoff run's failure has classunknown(ProviderAdapterEventStreamError), which is neither undefined norvalidation_error, and it's the same provider instance, so every queued run for the thread is held. That includes the handoff's own continuation and, in one case, a user message that was already queued.Most recent case (UTC):
Not verified here: the inner
Workspace changed.cause quoted above (my server traces had already rotated past these events), whether Codex threads are affected on this machine, and whether #15203 fixes it.Investigated with
t3 triageby Claude Code (Claude Opus 5.5).teamplayer3 commentedon Oct 27, 2026
Still reproducible on
0.1.3-nightly.20261027.3754, this time withclaudeAgent/claude-sonnet-5-5(full access), so it isn't specific to Opus.t3_worktree_handoffwas called with acontinuationPrompt. The worktree and branch were created and the thread was rebound (t3_worktree_statusreportsattached: true).continuation: { status: "scheduled", delivery: "queued" }, but the continuation never started on its own. Afterwardst3_queue_listwas empty and the thread was idle. I had to send the same prompt manually to continue.init-worktree) did start and finish normally (files copied,flutter pub getdone within ~25 s), so the handoff itself works. Only the turn end and the continuation delivery are broken.theodor349 commentedon Oct 28, 2026
Another report from Linux (Ubuntu 26.04), server 0.1.2 as a user service,
claudeAgent/claude-opus-5-5, full access. Both agent handoffs on 2026-10-27 went the same way, and the state database shows where the continuation goes:continuation: scheduled, delivery: queued, and the worktree and thread binding are correct.ProviderAdapterInterruptError: Failed to interrupt claudeAgent provider turn.failed.queuedwithqueueHeld: true, so nothing starts it.Starting the held queued run by hand works, and it then runs normally in the worktree. In one thread that happened after 15 minutes (15:27:19 to 15:42:38 UTC). In the other, the user sent a new message after 5 minutes, and the stale banner from #15993 stayed for about two hours.
So on this build the continuation isn't lost. The failed handoff run holds the queue it just filled.
robbedekiennimble commentedon Oct 29, 2026
Still reproduces on desktop 0.1.3 (macOS),
claudeAgent/claude-opus-5-5, on every handoff. The server trace shows why the turn ends as a failure: the session is torn down before the turn is interrupted, so the interrupt has nothing left to write to.Order of spans after
WorktreeMcpService.handoffsucceeds (worktree created,thread.metadata.update, continuationmessage.dispatchqueued, setup script started), all within the same second:ProviderSessionManager.removeLiveEntryProviderSessionManager.failSubscribersClaudeAdapterV2.interruptTurn→ FailureProviderSessionManager.closeScopeWithin→detach→RunExecutionService.writeFinalRunEventsThe provider event log ends with outgoing
{"type":"query.close"}right after the assistant'st3_worktree_handofftool_use (stop_reason: tool_use). No tool_result is ever written for it. So the run is finalised as "provider event stream closed unexpectedly", and the pending tool call shows up as "Waiting on background task mcp__t3-code__t3_worktree_handoff" in front of the queued continuation (#15993).Suggested fix: for a handoff-initiated detach, settle the turn as completed/handed-off (or answer the pending tool_use) before
failSubscribers/closing the query, rather than interrupting an already-closed transport.ruizbrian commentedon Oct 29, 2026
Reported by Claude Opus 5.5 (an AI agent running inside T3 Code) on behalf of the account owner, who reviewed this comment and asked for it to be posted.
Still reproduces on stable v0.1.5 (Linux, server as a system service,
--mode web),claudeAgent/claude-opus-5-5, auto mode. Four of four agent-initiated handoffs today failed the same way, on 0.1.2 and again after updating to 0.1.5:tool_use, then T3's ownquery.closeabout 1 s later, thenProviderAdapterEventStreamError … [cause]: Error: Workspace changed.andfailed to interrupt turn after ingestion failure(ProcessTransport is not ready for writing).From the 0.1.5 bundle, the handoff path never goes through the interrupt-first flow T3 already has. The orchestrator handles a
thread.metadata.updatethat changesworktreePathlike archive and settle (reason "Workspace changed."). It emitsprovider-session.detach, and for the Claude adapter that becomesreleaseEntry({ reason: "manual_shutdown", detail: "Workspace changed." }), which callsfailSubscribersbefore anything interrupts the turn. The model and session change path (provider-turn.restart→interruptAndAwaitTerminal) interrupts the running turn and waits for its terminal event before detaching. Routing a workspace change on a thread with an active run through that path, or deferring the detach until the run's terminal event, should make the handoff turn end as completed or interrupted instead of failed.V1ncNet commentedon Oct 30, 2026
Still reproduces on stable v0.1.5 in the macOS desktop app (T3 Code (Beta) with its local server, darwin arm64, Node 26.12.1), top-level thread,
claudeAgent. One detail that earlier reports do not show is that the continuation was overtaken by a later user message.Timeline from the state database and
server.trace.ndjson(UTC, 2026-10-30):t3_worktree_handoffreturnscontinuation: scheduled, delivery: queued. The continuation run is created with id…:ordinal:13.failedwith "The provider event stream closed unexpectedly". In the same secondClaudeAdapterV2.interruptTurnfails withProviderAdapterInterruptError: Failed to interrupt claudeAgent provider turn …ordinal:12….ordinal:13.So the queued continuation does not run first. It runs after whatever the user sends next, out of order, with a prompt that is stale by then.
The successful handoff's
dynamic_toolitem in run 12 is stillrunning, inside a run that endedfailed. That keeps the "waiting" indicator in the thread whilet3_queue_listis empty, as in #15993.Posted by Claude Code (claude-opus-5-5) via
t3 triageon behalf of the account owner, who reviewed it.jheinem1 commentedon Oct 30, 2026
Still happening on
0.1.6-nightly.20261029.3892(WSL2,claudeAgent/claude-opus-5-5), 6 of 6 agent-initiated handoffs since 2026-10-19. The handoff run endsfailed, and the continuation sits queued withqueueHeld: trueuntil I click Resume. This matches the diagnosis in #24444.Continuation waits across the 6 handoffs: 40 min, 59 min, never started (cancelled), 2.5 min, 4 min and 15 min.
Chinoman10 commentedon Nov 2, 2026
Additional Pi evidence: successful handoff, held continuation
Observed 2026-11-02 on Linux, a locally patched T3 0.1.4 runtime (
0.1.4-owner-credentials.1), provider driver pi, modelopenai-codex/gpt-6.1-sol(not the native Codex driver). This is a live-session observation, not a clean stock-upstream reproduction.t3_worktree_handoffwith an explicit continuation,startFromOrigin: true, andrunSetupScript: falsesuccessfully created/bound a clean destination worktree.ProviderAdapterEventStreamError, caused byError: Workspace changed.The UI showed the generic unexpected event-stream-close error.queueHeld: true,startedAt: null, and no active run. The continuation was preserved, not lost, but did not automatically start.cwd; the thread'sworktreePathpointed to the new clean worktree. Pi advertisedsupportsMultipleProviderThreadsPerSession: false.The additional coverage is Pi also exhibiting the held-continuation failure, rather than only a false error followed by successful continuation. No candidate PR was applied or live-tested for this observation; it does not establish a verified fix or full losslessness.
This extends the same failed-detach/held-queue sequence to Pi single-thread sessions, not just Claude. The older Pi report #21573 described continuations getting through. Please include Pi in the coverage assessment for #15203/#24444; the local patches/version above limit any claim about current stock main.
Posted by GPT-6.1 Sol through Pi/T3, with the account owner's explicit authorization; diagnostic excerpts are sanitized.
vlad-ap commentedon Nov 9, 2026
Still happening on
0.1.7(macOS arm64,claudeAgent/claude-opus-5-5, full access), 2 of 2 agent-initiated handoffs on 2026-11-08. Same behaviour as above: the handoff run fails with "The provider event stream closed unexpectedly", and the continuation only starts after a manual Resume.Sequence from
logs/provider/events.<threadId>.log:Second thread: handoff
tool_use22:25:37Z,query.close22:25:46.615Z, run failed at the same ms,query.openin the new worktree at 22:26:08.8Z after manual Resume.server.trace.ndjsonfor the first thread shows where it fails. The ~9 s gap isGitWorkflowService.fetchWorktreeBaseCommit(2.8 s) andGitManager.createWorktree(5.5 s). Then, within about 30 ms:So
detachcannot interrupt the Claude turn while the handoff tool call is still open, the run is finalised as a provider failure, and the queue is held behind it. This matches the diagnosis in #24444; #15203 looks like it would fix both the failed run and the held continuation.