Skip to content
Source
Sign inSign up
pingdotgg/t3code

Completion alert fires when a delegated task finishes, though the parent is about to continue #31087

OpenVDrozd-Cyclis(GitHub profile, opens in a new tab) opened this issue 9 comments

What happened

A parent thread sends a "Thread completed" sound and notification when its last running delegated task finishes, then goes straight back to work. It never appears in Done at that moment, and this repeats through a long orchestration.

Diagnosis

Finishing the delegate and starting the parent's next run are separate steps, about 80 ms apart. In between, the thread has no active run or pending work and its latest run is completed, so createThreadNotificationGate notifies at once. #29146 removed the 2-second wait added by #24760 and accepted this trade-off. The sidebar keeps WORKING_EXIT_GRACE_MS, so the alert and the sidebar disagree.

Steps to reproduce

  1. Set notifications to "Notifications with sound".
  2. In a thread, start one async delegate_task and let the parent end its turn.
  3. When the delegate finishes, an alert fires while the thread goes back to Working.

Version

0.1.7, on both the desktop client and the remote server. main has the same logic.

Environment

Desktop on macOS arm64, connected to a local server and a linked Linux server. Claude parent thread, Codex delegates.

Evidence

Times in UTC. Delegate marked finished 19:19:50.402, thread update published .410, next run dispatched .487, run requested .492. The thread really finished at 19:22:15. The same pattern came before 4 earlier wake-ups in that thread (18:26:35, 18:37:05, 18:52:11, 19:08:59). The alert itself isn't logged by the client.

#29146, #24760, #24477, #25585 (same symptom, from background jobs)

Fix applied or workaround

None that keeps alerts accurate. "Notifications only" removes the sound only.

Filed by

Claude Opus 5.5, Claude Code running in T3 Code.

  1. VDrozd-Cyclis(GitHub profile, opens in a new tab) added labelsvia-triage

  2. The same gap happens without delegation: a background shell command the agent awaits with t3_background_wait. #31130 and #31357 only hold app-owned tasks, so they won't fix this case.

    What happens

    A Claude agent starts a command with run_in_background, calls t3_background_wait on it, and ends its turn. The sidebar correctly shows Waiting. When the command exits, the completion sound plays, and the wake run starts less than a second later. Every awaited command in a multi-step job produces one false alert.

    Why

    On v0.1.7 (322f6544df):

    • When Claude sends task_notification, clearPendingBackgroundTask deletes the finished task from the roster, along with its awaited flag. The wake run is requested only after that (apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts:8321-8326, removal at :5508).
    • In between, the shell has no work that holds completion and its latest run (the earlier one) is completed. That gives settled = status === "ready" && latestRun.status === "completed" (apps/web/src/components/ThreadNotificationCoordinator.tsx:264), and since #29146 createThreadNotificationGate notifies at once.

    Before #29146, the 2-second continuation grace covered this sub-second gap, so this is the same 0.1.7 regression described here. The difference is the fix: the hold has to be applied to awaited, provider-owned command/monitor entries in the Claude adapter roster, keeping the finished entry until its wake run exists. The delegated-task path in ProjectionStore doesn't cover it.

    Evidence

    Server trace, times in UTC:

    11:20:20.981  t3_background_wait {taskIds: [<task 1>]}  → run ends 11:20:21.9, sidebar Waiting
    ~11:21:23     command exits → completion sound plays
    11:21:23.104  wake run starts ("Command … finished" notice)
    11:22:04.692  t3_background_wait {taskIds: [<task 2>]}  → run ends 11:22:07.1, Waiting
    ~11:24:00     command exits → completion sound plays again; next run 11:24:00.5

    Environment

    T3 Code 0.1.7 stable: Linux desktop (AppImage) against a local server, Claude provider (claude-opus-5-5), Settings → Thread notifications set to sound on.

    Repro

    1. Turn on sound for thread notifications.
    2. In a Claude thread, have the agent run sleep 60; echo done with run_in_background, call t3_background_wait with that task ID, and end its turn.
    3. Check the sidebar shows Waiting, then wait for the command to exit.

    Related: #31346, #25585, #13625 (closed with "open a new issue" for native background work), and #15099 (the turn-end case, fixed by #24610).


    Written by Claude Opus 5.5 (claude-opus-5-5) through Claude Code, via t3 triage.

  3. tanstack-source added labelsbug

  4. Confirming the same symptom: completion notifications arrive even though the thread is still in the Working state and continues working. The alerts appear to be tied to individual turns rather than completion of the overall task.

    Expected: a completion notification only when the thread's work is actually finished.

  5. Still reproduces on 0.1.10-nightly.20261114.4682 (desktop app on macOS arm64, local server, commit 820f620e3d). This adds a third surface to the report: the in-app toast ("Thread completed" with "Open thread") fires too, not only the sound and the desktop notification. All three go through the same createThreadNotificationGate → present() path in ThreadNotificationCoordinator.

    Setup: a Claude parent thread running a review loop. It delegates async delegate_task children (Claude and Codex), ends its turn, then continues when each child reports back. The user sees a toast each time a child finishes, while the parent goes straight back to Working.

    Timings from one parent thread (UTC, from orchestration_v2_projection_runs / _subagents):

    Child finishedParent's next run requestedGap
    13:42:50.16213:42:50.18624 ms
    14:28:47.84414:28:47.85612 ms
    14:35:33.19314:35:33.22128 ms

    Server trace for the 14:35:33 wake:

    .150  Orchestrator.finalizeDelegatedCompletionDelivery
    .151  AgentAwarenessRelay.publishThread
    .188  EventSink.write (parent) / planDelegatedCompletionDelivery
    .198  AgentAwarenessRelay.publishThread
    .212  dispatch message.dispatch (parent)  ← wake run begins

    So the parent's shell is published at least once with a completed latest run and an empty background roster before the wake run exists. That matches the diagnosis above. #31130 and #31357 are both still open, so no current build has a fix.

    Filed via T3 Code triage by Claude Opus 5.5 (claude-opus-5-5), Claude Code running in T3 Code.

  6. Confirming this on a Pi thread with delegate_task children, where the gap is much wider than the Claude reports (0.5 to 0.7 s instead of 12 to 28 ms), so the false alert is reliably visible rather than a race you rarely catch.

    Environment: 0.1.10-nightly.20261113.4643. Linux x64, server on 127.0.0.1:3773, Linux desktop client showing OS desktop notifications (the new Notification path in ThreadNotificationCoordinator.present, not the in-app toast). Parent provider pi, model opencode-go/deepseek-v4.1-flash. All children are app-owned delegate_task subagents (116 in the local database, provider: pi, origin: app_owned), notification mode "notifications with sound".

    Timings from orchestration_v2_projection_subagents.completed_at against the next orchestration_v2_projection_runs.requested_at for the same parent thread. Each parent has a completed run and an empty roster in between:

    Parent threadChild finishedWake run requestedGap
    Stagger Theme Switch Animations18:48:01.88518:48:02.423538 ms
    Modern Site Scrollbar Styling18:48:31.21318:48:31.793580 ms
    Keep Close Button on Header Line18:51:54.87518:51:55.426551 ms
    Widen Suche Button19:03:06.70919:03:07.383674 ms
    Search Bar Clear Button Alignment18:39:04.17318:39:04.670497 ms

    In the same database a child that is still running has a subagent turn item with status running, which is what holds the roster and makes the sidebar show Waiting during the wait. Its transition to completed is what empties the roster (derivePendingBackgroundWork in packages/shared/src/orchestrationV2PendingBackgroundWork.ts), and only then does ThreadNotificationCoordinator.tsx:284 compute settled = completed && !monitorHoldsWakeCompletion(rawThread) as true. Since #29146 removed the 2 second continuation grace, createThreadNotificationGate notifies on that first observation.

    Note that settled consults monitorHoldsWakeCompletion only, so a subagent-held settle is not filtered the way a monitor-held one is. Fixing the roster in ProjectionStore (as #31130 and #31357 do) should cover this case, but the wider Pi gap suggests the window is not purely a sub-millisecond dispatch race: for about half a second the parent genuinely reads as settled over the wire, so any client that samples state in that window alerts.

    Both fix PRs on this path, #31130 and #31357, are still open and unmerged, so no current build covers it.

    Filed via T3 Code triage by deepseek-v4.1-flash (opencode-go/deepseek-v4.1-flash), Pi running in T3 Code.

  7. Note

    🤖 Claude Opus 5.5 (claude-opus-5-5, Claude Code running in T3 Code triage), posting on behalf of this account.

    Still reproduces on 0.1.9 stable. This is the Linux desktop app connected to its local server, on linux x64. Each time a subagent finishes while its parent sits idle, a "Thread completed" alert fires. The parent then goes back to Working, so a task with several subagents gives one alert per child instead of one at the end.

    This build hits both paths: app-owned delegate_task children (fixed by #31130 / #31357) and Claude provider-native background Agent subagents (fixed by #36812). That makes it worth landing both fixes.

    Gaps since 2026-11-14 between a child finishing and the parent's next run being requested, in cases where the parent had no active run at that moment. Data is from read-only queries on orchestration_v2_projection_subagents and orchestration_v2_projection_runs; times are UTC:

    Child provider / originChild completedParent next run requestedGap
    cursor / app_owned2026-11-16 01:55:24.96601:55:25.529563 ms
    claudeAgent / provider_native2026-11-16 00:41:10.40500:41:11.7481343 ms
    claudeAgent / provider_native2026-11-15 23:02:07.50623:02:09.4881982 ms
    claudeAgent / provider_native2026-11-15 20:47:13.74420:47:15.0041260 ms
    cursor / app_owned2026-11-15 17:55:30.31417:55:31.292978 ms
    cursor / app_owned2026-11-15 17:48:09.99817:48:10.577579 ms
    cursor / app_owned2026-11-15 17:39:02.94717:39:03.667720 ms
    opencode / app_owned2026-11-15 15:04:35.09215:04:35.12836 ms
    claudeAgent / app_owned2026-11-15 02:59:57.72202:59:57.81290 ms
    claudeAgent / provider_native2026-11-14 18:47:47.54318:47:47.61673 ms

    Gaps run from 36 ms to 2 s. Native Claude background agents show the widest ones (1.2–2 s), so those alerts reliably reach the screen. Delegates that a parent waits on inside a running run don't alert, as expected. No client setting works around this: notification mode and in-app toasts are the only controls, and neither tells a child's completion apart from the parent's.

  8. The same gap happens with OpenCode background subagents: the OpenCode 2 adapter drops a finished child from pendingBackgroundTasks when its report arrives, and the wake run exists only after the continuation is dispatched. On our host (OpenCode, Opus 5.5 subagents, nightly 4941/5024) that took 0.2–3.3 s, mostly the continuation's projection read. From 2026-11-20 10:40 to 2026-11-21 14:27 (UTC+2), 165 of the 493 completions the push relay deferred were followed by a new run within 5 s: the iPhone skipped them, the Mac app showed each as "Thread completed". One case: subagent done 12:21:28.225 UTC, Mac banner 12:21:28.670, wake run requested 12:21:31.621.

    #40396 keeps the finished subagent listed until its wake run is dispatched.

  9. Still reproduces on v0.1.12 stable (ca81b7b97a), released today.

    Environment: T3 Code Desktop 0.1.12 on macOS, connected to a remote 0.1.12 server (t3 serve as a background service) on Linux x64. The parent thread is Claude Opus 5.5 and the delegate_task children are Codex. The alert is the in-app "Thread completed" toast. Expanding the Working shelf shows the thread there, which is correct, because each wake started new delegates before it ended.

    Evidence (server trace and projection rows, UTC). This sequence came before every wake that followed the last running delegate finishing:

    Last delegate marked finished (5-event write)publishThreadUnsafedelegated-completion message.dispatchWake run requestedWake run started
    09:01:03.697.710.758.772.818
    09:11:13.668.681.723.749.847
    09:22:40.121.132.179.200.297

    Each time, the wake run was requested 50 to 80 ms after the delegate was marked finished. In between, the parent's shell had a completed latest run and no pending work. Delegates that finished while a sibling was still running left no gap, because the sibling still held the thread.

    #31130 would fix this. GitHub currently shows it as conflicting with main.

    Triaged by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, running in T3 Code triage, and posted on behalf of this account.

  10. still happens on 0.1.12-nightly.20261124.5178 (macOS 15, notifications with sound)

    timeline - one of many times it happened:

    • 21:53:07.84 child finished
    • 21:53:08.12 "thread completed" sound from the parent
    • 21:53:08.16 server started the parent again with the child result

    so the sound came 0.28 s after the child finished, 0.04s before the parent woke up

    the child thread itself does not notify, the client skips it correctly only the parent chimes, in the gap between the two steps

    i patched #31130 locally and will report on the pr if the false chime is gone :)

  11. I’m still seeing this on T3 Code Desktop Nightly 0.1.13-nightly.20261125.5245 on macOS arm64, with the local server on the same build. My Claude Opus 5.5 parent thread delegates reviews to Codex. When the last async delegate finishes, I get a macOS “Thread completed” banner with the parent’s title and a completion sound, even though the parent resumes and keeps working.

    For the incident I captured on Nov 25, the delegate finished at 20:32:47.405 UTC. T3 requested the parent’s next run at 20:32:47.474 UTC (69 ms later), and the run started at 20:32:47.553 UTC. I captured the banner while the parent was back in Working. The two preceding delegate handoffs in the same thread had 85 ms and 157 ms gaps between delegate completion and the next run request.

    Triage replayed the reconstructed thread states through the notification code from this build. It emitted a premature completion when the parent briefly appeared ready with zero pending tasks. With that intermediate state removed, the replay emitted only the final completion.

    Triaged by GPT-6.2 Sol in Codex, running in T3 Code, and posted on my behalf.

Sign in to join this conversation.