Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Parent gets a "Thread completed" notification when its async delegate finishes, then resumes Working #32113

Closedruizbrian(GitHub profile, opens in a new tab) opened this issue 1 comment

Filed by Claude Opus 5.5 (claude-opus-5-5, an AI coding agent running in T3 Code through the Claude Code harness) on behalf of the user who observed the behavior. The model id was confirmed from the API request log for the session, not only self-reported. Evidence comes from T3 Code 0.1.7's shipped client and server JS, its statev2.sqlite projections and provider event logs on the user's server, and notifications the user saw and confirmed.

Before submitting

  • I searched existing issues and did not find a duplicate. (Related, not the same: #16610, #26083, #27700.)
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server (the parent's hold is released before its wake-up run exists); apps/web shows the result.

Steps to reproduce

  1. In a Claude thread, have the agent call delegate_task with mode: "async" on a child that takes about 90 seconds (for example a Bash poll loop: end=$(( $(date +%s) + 90 )); until [ "$(date +%s)" -ge "$end" ]; do sleep 1; done), then end its turn.
  2. The sidebar shows the parent as Waiting on its child (correct).
  3. When the child finishes, T3 wakes the parent to deliver the result.

Expected behavior

No "Thread completed" for the parent when the child finishes; the parent goes from Waiting to Working. One "Thread completed" when the parent's wake-up run really ends.

Actual behavior

A desktop "Thread completed" notification for the parent arrives the moment the child finishes. When the user looks, the parent is Working (processing the child's result). A second "Thread completed" follows when that run ends. A thread that delegates several times in a row produces one false notification per async child.

Impact

Minor bug or occasional failure (frequent for agent threads that delegate asynchronously).

Version or commit

0.1.7 (server t3 serve --mode web). The client filter and notification gate are the same in 0.1.6.

Environment

Server on Linux (Debian 13), desktop client on Windows, Windows notifications enabled. Provider: Claude (Claude Code CLI) parent threads; async delegate children on Claude.

Logs or stack traces

Observed incident, 2026-11-06 (times are UTC). The user received "Thread completed" stamped 17:26 for the parent thread. From orchestration_v2_projection_runs and orchestration_v2_projection_subagents:

EventTime
Async child started (origin: app_owned, completionWake: "always")17:25:39.549
Parent run 9 completed (parent ends its turn on the child; Waiting)17:25:55.706
Child completed17:26:17.734
Parent wake-up run 10 requested (trigger: message with delegatedCompletion)17:26:17.909 (175 ms later)
Parent still running at 17:27

The notification's minute matches the child finishing, not the parent's turn end.

The same gap in other parent threads (child completed, then wake-up run requested): 62 ms (2026-11-05 18:25:06.449 to .511 UTC), 115 ms (2026-11-06 16:19:44.533 to .648 UTC).

Server: nothing holds the parent between those two writes. derivePendingBackgroundWork holds a settled parent only through roster tasks and active background turn items:

for (const item of pendingBackgroundTurnItems(input)) { ... }   // isOrchestrationV2WorkActive(item.status)

When the child finishes, its subagent turn item is terminal, so the hold is gone. The wake-up run is created in a later write. A completion still waiting for delivery (completionDelivery.state pending / claimed) does not hold the parent here, though delegatedTaskProgress already treats that state as unfinished:

const children = projection.subagents.some((task) => isOrchestrationV2WorkActive(task.status)
  || task.status !== "idle" && (task.completionDelivery?.state === "pending" || task.completionDelivery?.state === "claimed")) || ...

Client: the gate fires on the first snapshot that shows the parent settled. In main-sk5g_Jie.js (0.1.7), settled = status === "ready" && latestRun.status === "completed", and the gate fires once per new completedAt:

let s=a.completedAt;!a.settled||s===null||s<=(t.get(r)??-1/0)||(t.set(r,s),e(r,`completion`))

When the parent ended its turn it was Waiting, so settled was false and its completedAt was never recorded. In the gap the parent is ready with a completed latest run, so the gate fires new Notification("Thread completed", { body: thread.title, ... }). Nothing retracts it when the wake-up run starts.

The child is not the source. The observer skips child threads first (lineage.relationshipToParent === "subagent" or delegated under a live parent), and every child involved has relationshipToParent: "subagent".

Screenshots, recordings, or supporting files

None attached. The notification was a standard Windows toast "Thread completed" with the parent thread's title, stamped 17:26 UTC.

Workaround

Use delegate_task with mode: "wait": the parent's run stays active while the child runs, so there is no gap.

Notes

  • T3 does not log what the client receives, so the in-between snapshot is inferred from the timing and the notification, not seen in a log.
  • A Claude background subagent (Agent tool with run_in_background: true) shows the same server-side gap: in a controlled repro the parent had nothing holding it for 814 ms between background_tasks_changed (empty) and the wake-up run. No early notification was seen in that repro, so this report does not claim that case.

Suggested fix (either is enough)

  1. Server: keep the child in the parent's pending work while its completion is pending or claimed for delivery, or release the hold and create the wake-up run in one write.
  2. Client: don't fire "completion" for a thread with a delegated completion pending delivery, or debounce "completion" briefly and cancel it if the thread leaves ready.

Reported on behalf of the user by Claude Opus 5.5 (claude-opus-5-5).

  1. tanstack-source added labelsbug

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

  3. juliusmarminge closed this

Sign in to join this conversation.