t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Stopping a parent turn interrupts its async delegate_task children with no notice to the parent, and their ids stop resolving

Open sudosapient opened this issue 2 weeks ago • 3 comments

Before submitting

  • [x] I searched existing issues and did not find a duplicate.
  • [x] I included enough detail to reproduce or investigate the problem.

Related, but each covers a different part: #12694 (closed) is Claude's built-in subagents stopping on session replacement, not delegate_task children. #32235 is task_not_found after the parent's MCP session changes. #30156 is a background task lost with no wake when the provider process exits.

Area

apps/server

Steps to reproduce

Observed once in a real session. Not yet re-run as a minimal repro.

  1. In a Claude thread, call delegate_task twice with mode: "async" (one with isolation: "worktree", one with isolation: "shared"). Let the parent's turn end while both children run.
  2. Send the parent a new message. While that turn is running, press Stop. (In my case the turn had hit "Claude API rate limit" and was retrying.)
  3. Send another message to the parent and let it continue normally.
  4. Wait for the children to report back.

Expected behavior

Either:

  • async children keep running when the parent's turn is stopped, since they were started as independent work, or
  • if Stop is meant to stop them too, the parent is told. Its next turn should get a note naming the delegated tasks that were stopped, like the "T3 Code restarted and stopped background work" note. Either way, task_status should answer interrupted for them, not task_not_found.

Actual behavior

  • Both children stopped at the moment of the Stop. The parent's timeline records the Stop at 09:33:00 UTC ("Interrupt requested, Stopped by user"). Both subagent items then change to status: "interrupted" at 09:33:05 and 09:33:06. One child's e2e test run in its worktree was killed by SIGTERM at the same time, with its last commits left in place and three files uncommitted.
  • No completion, failure or interruption notice reached the parent, then or later.
  • Delegated tasks started after the Stop, from the same parent, reported back normally.
  • Over the next 5h40m the parent agent told the user five times that both children were "still running", and gave an ETA built on them. When asked for status, it reasoned that the instructions say not to poll a running delegate and to wait for the completion notice, and that no notice had arrived. So it did not check.
  • When it finally checked, after a context compaction: t3_thread_read on both child thread ids returned thread_not_found ("is no longer available"), and task_status with both task ids returned task_not_found ("does not belong to thread ").

So the user loses the children's work, the parent is never told, and the ids it holds stop resolving. Together with the "don't poll delegates" instruction, the agent has no signal that the work is gone.

Impact

Major degradation or frequent failure

Version or commit

Server reports 0.1.9-nightly.20261111.4501 (incident on 2026-11-11)

Environment

Self-hosted server on Linux x64 (cloud VM), used from the web app and the Android app. Claude provider (claudeAgent), model claude-opus-5-5, runtime mode full-access.

Logs or stack traces

# Parent thread timeline (t3_thread_read, view=activity), UTC
09:27:16  dynamic_tool  delegate_task  "Review ..."  isolation=shared mode=async
09:31:51  user_message  (new message to the parent)
09:33:00  run_interrupt_request  "Stopped by user"
09:33:01  error  "Provider retry stopped: Claude API rate limit."
09:33:01  run_interrupt_result  interrupted
09:33:05  subagent  "M3 ..."      status=interrupted   (started 08:27:49, isolation=worktree mode=async)
09:33:06  subagent  "Review ..."  status=interrupted

# Later, in a turn after compaction
t3_thread_read  thread:delegated-task:command:mcp:<id>:delegate-task:<task>
  -> thread_not_found: "... is no longer available."
task_status  <task uuid>
  -> task_not_found: "Delegated task <uuid> does not belong to thread <parent>."

Workaround

Before trusting that a delegated task is still running, check its worktree or output on disk. Avoid pressing Stop on a parent while it has async delegates running.

sudosapient avatar Nov 11 '26 15:11 sudosapient

Hit this again today. Adding one more data point.

  • T3 Code 0.1.12-nightly.20261122.5085, Windows 11, Claude provider.
  • Parent thread had one delegate_task child running in the background (isolation: "worktree", claude-opus-5-5). The parent's own turn had already ended.
  • The user sent the parent a message by mistake and pressed Stop on that turn to retype it.
  • The child's run ended at the same moment with status interrupted and summary Stopped by user. It was mid-edit with uncommitted work.
  • The parent got no note on its next turn. It only learned about it because the user noticed and resumed the child by hand.

Difference from the original report: here task_status still resolved the task id. It returned status: "interrupted", and hasPendingChildRuns: true after the manual resume.

From the user's side, Stop was meant for the one message just sent. Stopping work that was started in an earlier turn was a surprise.

chengbuilds avatar Nov 22 '26 09:11 chengbuilds

claude-opus-5-5 responding on behalf of project516

One possible contributor to the task_not_found part of this issue: on 0.1.11 the same error came back after a compaction because the agent passed a task id it had rebuilt from the child thread link (command:mcp:...:delegate-task:...), not the node:delegated-task:... id that delegate_task returned. task_status gives the same "does not belong to thread" message for an unknown id, so this looks like lost ownership even when the task record is intact. Details in #40875.

The thread_not_found on the child thread ids reported here is not explained by this.

Project516 avatar Nov 22 '26 14:11 Project516

#34499, now on main: After Stop interrupts delegated children, the parent's next eligible turn receives a note naming them, and interrupted background child work is classified as interrupted rather than completed.

Not done: The reported task_status task_not_found and child-thread thread_not_found failures remain outside this merge.

Closing; open a new issue if what is left still matters to you.

juliusmarminge avatar Nov 23 '26 22:11 juliusmarminge