Skip to content
Source
Sign inSign up
pingdotgg/t3code

MCP orchestration tools fail with `parent_not_active` after a provider handoff, a notification turn, or a question; a restart mid-turn kills the thread #23006

Closedmagicmikek(GitHub profile, opens in a new tab) opened this issue 7 comments

Summary

An agent thread calls the T3 Code MCP orchestration tools (delegate_task, watch_pull_request, task_status, schedule_task, t3_thread_send, t3_thread_launch). In three situations these calls fail with parent_not_active, even though the thread is running a turn and the agent is the one doing the work. A fourth problem: after a T3 Code restart mid-turn, the thread never runs again.

Setup: one long-lived "control" thread on the Claude provider, with two Claude provider instances configured (claudeAgent and claudeAgent_claude_2), scheduled tasks bound to that thread, and delegated child tasks. Work happens in a private repo.

1. After a provider-instance handoff of the thread

Steps:

  1. A thread runs on claudeAgent.
  2. The thread is handed to another instance of the same provider (for example claudeAgent -> claudeAgent_claude_2, or back), e.g. on an account switch.
  3. In the next turn, call any orchestration tool.

Observed: every call returns parent_not_active for the rest of that run. Seen on:

  • 2026-10-12 19:12: t3_thread_send to another thread failed 3 times.
  • 2026-10-12 22:20: watch_pull_request and delegate_task.
  • 2026-10-13 22:00 and 22:04: task_status for two finished child tasks, then every call (task_status, delegate_task) in that run.
  • 2026-10-14 17:4x: delegate_task and watch_pull_request, after each handoff.
  • 2026-10-16 ~15:50 onward: delegate_task and task_status for 3+ turns. Finished child results could only be read with t3_thread_read.
  • 2026-10-20 18:14: delegate_task on every call.

2. In a turn started by a background task notification

Steps:

  1. The thread starts a background task (or a scheduled task fires) and ends its turn.
  2. The task-completion notification starts a new turn in the same thread.
  3. In that turn, call an orchestration tool.

Observed: parent_not_active. Seen on:

  • 2026-10-14 17:4x: delegate_task refused.
  • 2026-10-21 00:05: schedule_task refused.

3. After a turn that asked the user a question, or during the daily thread handover

Steps:

  1. The agent asks the user a question (AskUserQuestion) and the user answers.
  2. In the turn that follows, call an orchestration tool.

Observed: parent_not_active. Seen on 2026-10-20 17:38: t3_thread_send failed twice right after the answer. The same error also shows up around our daily thread handover, when one long-lived thread hands its work to the next one.

4. After a T3 Code restart mid-turn, the thread never runs again

Steps:

  1. A thread is in the middle of a turn.
  2. T3 Code restarts (in our case the machine also rebooted later that morning).
  3. Any later run of that thread (user message, scheduled task, queued wake-up).

Observed on 2026-10-21: the restart hit at 09:14Z. From 12:51Z every run of the thread failed with "Provider turn failed", the last ones with No conversation found with session ID <uuid>. The provider instance shown for the thread flipped between claudeAgent and claudeAgent_claude_2 across attempts. Nothing ran in that thread from 09:14Z to 14:23Z, when a new thread was started by hand and the scheduled tasks were rebound to it. A similar case on 2026-10-20 09:23: a scheduled-task thread failed with the same No conversation found with session ID error and had to be replaced.

Impact

Each case costs from one turn to several hours. When t3_thread_send failed, the user had to relay messages between threads by hand. When delegate_task failed, reviews and test runs stalled until the next scheduled turn (up to 30 minutes), or moved to local subagents outside T3. A missed schedule_task left a heartbeat missing for about 30 minutes. The restart in case 4 stalled all orchestration for 5 hours, a scheduled daily job did not run, and the user had to open a new thread and rebind 9 scheduled tasks by hand.

Expected behavior

  • The run that currently owns a thread can call the orchestration tools. That includes the run after a provider-instance handoff, a run started by a task notification or scheduled task, and the run after a user answers a question.
  • After a T3 Code restart, a thread either resumes its provider session or starts a clean new provider session with the thread history. It should not keep pointing at a session ID that no longer exists.

What would help

  • Make "active parent" follow the thread, not the provider run that existed when the session was created. A handoff or a notification turn should transfer ownership.
  • When the tool layer refuses a call, say why in the error: which run it expected and which run made the call.
  • On No conversation found with session ID, drop the stale session and start a new one instead of failing every run.
  • A way to rebind a thread's scheduled tasks and child tasks to a new thread in one step, for recovery.

Related: #16565 (provider switch), #16808 (background notification turn), #15103 (closed; same "No conversation found" symptom).

  1. Classified as a bug report under the revised security rule: no exploitable vulnerability is alleged. On main b5a226e49c, the reported refusal is enforced by MCP caller/provider ownership checks in threadAccess.assertLiveCaller and OrchestratorMcpService. Fixing the reported handoff behavior requires work on MCP access or credential lifecycle, which is outside the automated triage fix scope and needs Julius. No runtime reproduction was performed and no fix is claimed. Leaving open: #16565 overlaps the provider-switch case and #16808 overlaps background continuations, but neither covers the entire report.

  2. juliusmarminge added labelsneeds more info

  3. juliusmarminge removed labelsneeds more info

  4. Tested on main 27e0c684c5 in the Linux web dev app with isolated state, Claude Code 2.1.303 and two Claude provider instances. Claude A → B → A through the picker, an explicit provider selection on message dispatch, a scheduled wake, a native background-task completion continuation, and an answered AskUserQuestion all allowed delegation. Killing the isolated server during a running foreground command and restarting the same state recovered the thread; a later delegation also completed. Runtime transcript.

    Which T3 Code build and Claude Code version produced the failures? For the handoff, what exact action triggered it: selecting another instance, automatic limit failover, or another action? Please include a host-log excerpt around one parent_not_active failure and one No conversation found failure, with the active provider instance and session lifecycle events. Those details distinguish the reported path from the successful sequences above. Leaving open; the provider-switch portion also has existing work in #19413.

  5. juliusmarminge added labelsneeds more info

  6. Additional observation on T3 Code 0.1.6-nightly.20261030.3917, Linux ARM64, Claude Code (claudeAgent driver), observed 30 October 2026.

    This matches the background-notification case above. Minimal reproduction sequence from the incident (not rerun in a clean session):

    1. In a Claude thread, start sleep 60 with Bash using run_in_background: true.
    2. Let the parent turn end.
    3. When the completion notification wakes the same session, call t3_thread_send to another thread.

    Expected: the notification-started turn can send cross-thread messages.

    Actual: parent_not_active: The calling provider no longer owns an active thread run. Retrying within that turn fails again. In the recorded incidents, the preceding T3 run was already completed; the continuation run was recorded only after the awakened turn finished. The triggering task was background Bash/Monitor, rather than a native background subagent.

    Workaround: wait for background work in the foreground while the T3 turn remains active. No raw logs or credentials are attached.

  7. juliusmarminge removed labelsneeds more info

  8. juliusmarminge added labelsneeds more info

  9. Tested the background-notification sequence from the last comment on main 1aa46d0cdf in the Linux web dev app with a fresh database, Claude Code 2.1.304 on the claudeAgent driver. In each wake turn the agent called t3_thread_send to another thread, then task_status with an unknown id. task_not_found means the active-run check passed.

    1. Bash sleep 60 with run_in_background: true, parent turn ends, the completion notification wakes the session: t3_thread_send succeeded, task_status returned task_not_found.
    2. Monitor on sleep 45; echo MONITOR_DONE, parent turn ends: same result.
    3. Background sleep 7 finishing 430 ms after the parent turn's result: same result.

    In all three, the server logged orchestration-v2.claude-wake-turn-detected 1 ms after the wake's system/init and recorded the continuation run 30-60 ms later. The first tool call came 2-4 s after init, so the run was already active. You saw the continuation run recorded only after the woken turn finished. That gap between the wake and the recorded run is the part we cannot reproduce.

    From the host log around one failing wake, please send:

    • the timestamps of orchestration-v2.claude-wake-turn-detected, the continuation run's creation, and the parent_not_active call;
    • any orchestration-v2.claude-wake-turn-unroutable or orchestration-v2.provider-continuation.dispatch-failed lines;
    • roughly how many runs and messages that thread has, the size of statev2.sqlite, and how many other threads were running at the time.
  10. github-actions[bot](GitHub profile, opens in a new tab) removed labelsneeds more info

  11. More data for case 2 (background-task wake), from a nightly host where it reproduces. This is the gap you asked about.

    T3 Code 0.1.7-nightly.20261101.4048, macOS, Claude Code 2.1.316, 2026-11-02 UTC. statev2.sqlite is 26.85 GB (WAL 33.2 MB). In the window, 14 threads were writing events, mostly delegated children.

    Thread A (failing wake):

    • 03:03:39.389: ProviderContinuationRequests.offer (wake detected).
    • 03:03:39.435: continuation message.dispatch. dispatch.once takes 428 ms, then EventSink.commitCommand takes 44,027 ms, so the run commits at about 03:04:23.9.
    • 03:04:01.986: the woken agent calls delegate_task.
    • 03:04:24.06: delegated_task.request is rejected: Parent run …:ordinal:90 is not active. Ordinal 90 is the previous run; the wake's run committed about 0.1 s earlier.

    Thread B: wake at 03:05:15.430. dispatch.once takes 5,099 ms (readCanonicalProjection), then commitCommand takes 21,633 ms.

    Event sink, 03:03–03:06Z: 535 EventSink.write spans, median 8 ms, p90 27 ms, max 190,179 ms. Successful delegateTask and sendToThread calls in the same window took 67–307 s. No claude-wake-turn-unroutable or provider-continuation.dispatch-failed lines.

    So the wake is detected at once, and the continuation run is just stuck in the event-sink queue behind other writes. Any cross-thread call the woken agent makes before that commit lands names the completed run and gets parent_not_active. It only shows up on a loaded host, which would explain why it passes on a fresh database. One idea: treat a thread with an in-flight continuation for the same provider instance as live, as isLiveCallerShell already does for background subagents, or wait for that continuation's receipt. The long event-sink queue may be its own issue (perhaps #23482; our WAL was at about 32 MB).

    Also, the server trace rotates at 10 MB about every 2 minutes here, so the host keeps only about 20 minutes of traces. We only caught this because we copied the files in time.

    Drafted with Claude Opus 5.5 (T3 workflows lead) for Etan.

  12. Another reproduction of case 2 (background-task wake), on a loaded host. It also affects the pull request tools.

    Environment: T3 Code desktop 0.1.8-nightly.20261108.4353, macOS, Claude Code 2.1.319 on the claudeAgent driver, 2026-11-08 UTC. statev2.sqlite is 5.16 GB (WAL 123 MB). Several other threads were running at the time.

    Steps:

    1. In a long-lived Claude thread, call link_pull_request on a merged PR, then unlink_pull_request. Both succeed.
    2. Start sleep 20 with Bash run_in_background: true, and end the turn.
    3. When the completion notification wakes the session, call link_pull_request and watch_pull_request on the same PR.
    4. Later in the same woken turn, call link_pull_request again.

    Observed (run times from t3_thread_read):

    • The previous run (ordinal 31) completed at 12:32:31.797.
    • The wake's run (ordinal 32) has requestedAt 12:32:48.852 and startedAt 12:32:58.000.
    • Step 3: both calls failed with parent_not_active: The calling provider no longer owns an active thread run. unlink_pull_request in the same turn succeeded, because it does not check the caller's run.
    • Step 4, after run 32 started: link_pull_request succeeded.

    This matches the timing in the 2026-11-02 comment above: the woken turn calls tools before its continuation run is active, so assertLiveCaller sees no activeRunId. In our case the gap was about 10 s. I could not get the server's continuation timings, because this build's log folder holds only the desktop trace.

    Workaround: retry the call a few seconds later in the same turn.

    I'm open to sending a PR for this. It would follow the idea above: isLiveCallerShell also accepts a thread whose continuation run for the same provider instance is requested but not yet active, as it already does for background subagents. It would add a focused test. I'll wait for a maintainer to agree on that direction before opening it, since this is an MCP access check.

  13. tanstack-source added labelsbug

  14. This is the same problem as #33272, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.

  15. juliusmarminge closed this

Sign in to join this conversation.