t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Remote delegate_task drops the child's background-wake run; the parent keeps run 1's interim result

Open phoduke opened this issue 3 weeks ago • 2 comments

Before submitting

  • [x] I searched existing issues and did not find a duplicate. #24297, #16603 and #21837 cover local children. #23542 fixed result delivery for a local child's background-wake run. #26740 covers t3_thread_send follow-ups to a remote child. This report is about a remote (linked-environment) delegate_task child whose own background command wakes it after its first run. The parent never receives that run's result.
  • [x] I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Link environment B to environment A. Both run T3 Code 0.1.7.
  2. From a thread on A, call delegate_task with mode: "async" and target.environmentId set to B, on a Claude child (claudeAgent, claude-haiku-5-5), with this task:
    1. Run this in one Bash call with run_in_background set to true:
       sleep 75 && date -u +%H:%M:%S > /tmp/t3-remote-repro.txt
    2. Do not wait for it. Reply with exactly "REPRO WAITING" and end your turn.
    3. When you are woken because that command finished, read the file and reply exactly "REPRO DONE <its contents>".
    
  3. Do not poll. Wait for the parent's notices, then read task_status and the remote thread with t3_thread_read (environmentId B).
  4. Control: send the same task as a local delegate_task on A (claudeAgent through a different provider instance, same model).

Expected behavior

The parent receives the child's final result, "REPRO DONE …", as it does for a local child. That can be either a held task or a follow-up delivery (#23542).

Actual behavior

The parent receives only "REPRO WAITING". On B, the child's background command wakes it, and run 2 replies "REPRO DONE 17:50:47". Nothing reaches A: there is no follow-up task and no second notice, and task_status still reports run 1's text.

Remote run, 2026-11-07 UTC:

Time Where Event
17:49:31.633 B Background Bash starts (bpmpt7qap)
17:49:33.500 B Run 1 completes: "REPRO WAITING"
17:49:34.328 A Task completes with "REPRO WAITING"; remoteChild.runId = run 1, stoppedThere: true
17:50:47 B Background command exits
17:50:49.449 B orchestration-v2.claude-wake-turn-detected
17:50:50.214 B Run 2 requested (a notification item: the command finished)
17:50:55.383 B Run 2 replies "REPRO DONE 17:50:47"
17:52+ A task_status: completed, result_available, latestTerminalSummary: "REPRO WAITING". No further task or notice arrives

Local control on A, same prompt and model:

Time Event
17:53:22.535 Run 1 completes: "CONTROL WAITING"
17:53:22.988 Original task completes with "CONTROL WAITING"
17:54:36.543 Run 2 requested (background exit)
17:54:40.055 Follow-up task (provider-continuation:…) completes with "CONTROL DONE 17:54:36" and the parent receives it

So locally the interim result is followed by the final one. Remotely, the final result is lost.

A second remote run with claude-sonnet-5-5 showed the same result (B on 0.1.6 at the time, A on 0.1.7).

Source reading (not verified by a debugger)

At main @ 25bf84ab07, RemoteDelegation.followOnce waits on the task's recorded run (runId: remote.runId, L602) with untilDelegatedWorkSettled: true (L607). It completes the task with that run's last reply as "ran-out" (L637), and settled then ends the follower (L648). Nothing on A follows later runs of the remote thread. The local follow-up path from #23542 has no remote counterpart. RemoteDelegation.ts has no commits after v0.1.7. I have not tested main itself.

Impact

Major degradation or frequent failure. Agents commonly end a turn while CI or a test command runs in the background. In our use, 2 of 5 real remote tasks hit this. In one, the parent took the interim text as the final result. The child's run 2 then failed on a provider 429 that A never saw, and the work sat for about 3.5 hours until someone checked the remote thread by hand.

Version or commit

T3 Code 0.1.7 (stable) on both environments. A is the Linux desktop AppImage, B is t3 serve --lan from npm [email protected].

Environment

A: Arch Linux (Omarchy), desktop 0.1.7. B: Debian cloud VM (instabox), t3 serve 0.1.7, linked over Tailscale with full access. Child provider: Claude Agent through a Claude-compatible proxy, claude-haiku-5-5 and claude-sonnet-5-5.

Workaround

  • Remote children never end a turn while a background command or subagent they started is still running. They wait inside the turn.
  • Before trusting a remote task's result, the parent reads the remote thread with t3_thread_read (environmentId) and checks that its latest run is the one that produced the result.

Filed by

Claude Opus 5.5 (Pi agent), on behalf of @phoduke. Every timestamp above comes from statev2.sqlite on A, B's thread record read through the link, and B's server journal.

phoduke avatar Nov 07 '26 17:11 phoduke

Sent by Claude Opus 5.5 (Claude Code in T3 Code) on behalf of the reporter.

Still happening on today's nightly 0.1.8-nightly.20261109.4399 (357fb754fa) on both machines. #31744 isn't in that build. What the user sees is in the sidebar: the parent thread leaves Working and sits with the finished threads while its remote child keeps working. They read it as done.

Setup: A is a Linux x64 desktop (Omarchy); B is a macOS arm64 laptop. They're linked with full access. Parent and child are both Claude Agent, claude-opus-5-5. The parent on A calls delegate_task with target.environmentId = B. The child starts a long install with run_in_background, ends run 1 with an interim reply, and wakes itself twice afterwards.

Timeline (UTC, from t3_thread_read on both threads; A and B clocks aren't synced to the millisecond):

Time Where Event
09:53:16 A → B delegate_task (async); child thread created on B
~09:55 B Child starts the install with run_in_background
09:57:30 B Run 1 completes: "The download is at about 2.4 of 3.1 GB … I'll pick up when that background task exits."
10:01:31.940 B Background command exits; run 2 requested
10:01:32.658 A "Delegated task … finished"; the task card carries run 1's interim text
10:01:36 A Parent run (4 s) relays "still downloading, will report back" and ends. Parent status completed, out of Working
10:02:24 B Run 2 completes ("runtime downloading in the background, I'll continue when it finishes"). Nothing reaches A
10:09:05 B Run 3 starts (second background wake) and is still running. The parent's last item is still 10:01:37

So the parent is told "finished" right as the child starts its wake run. It then drops out of Working, even though the child has two more runs ahead. Neither of those runs wakes the parent, so the "will report back" it promised the user can't happen.

Unlike the local race in #24297, A's notice here came about 0.7 s after B requested run 2 (allowing for clock skew). That fits the source reading above. The follower waits on run 1 specifically and completes once run 1's background work settles, so later runs on the thread aren't seen.

Expected: as long as the remote child has a pending background wake or a later run, the parent stays in Working (or a waiting state), and the child's last run is what gets delivered.

Related: #28114, #31707, #24297, #28659 (the same "parent leaves Working" symptom, but from a side chat).

yu2001-s avatar Nov 09 '26 10:11 yu2001-s

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

juliusmarminge avatar Nov 12 '26 06:11 juliusmarminge