GeezerVison is showing github.com — fix(clients): a thread left running a dev server alerts as completed by juliusmarminge · Pull Request #14213 · pingdotgg/t3code
Conversation
Closes #13965.
If a Claude turn ends with the agent leaving a dev server running, the desktop and web completion alert (sound, toast, notification) never fires, because the thread reads as Waiting for as long as the shell lives. The mobile push says "Agent finished" right away, even when the pending work is a subagent or monitor that will wake the agent. That second behavior is #13625.
What changed
One rule decides it, based on the typed OrchestrationV2PendingBackgroundTask.kind. It never matches labels or task-type strings. The rule is backgroundWorkHoldsCompletion in packages/shared/src/orchestrationV2PendingBackgroundWork.ts. It lives in shared rather than client-runtime because the server builds the push and does not depend on client-runtime:
command (dev servers, long-lived shells): does not hold. The turn counts as finished.
subagent, monitor: hold, because they wake the agent and it continues.
background_task (opaque work, and what an unknown or missing kind decodes to): holds. This is the conservative choice.
Both surfaces call it:
- Desktop/web:
ThreadNotificationCoordinator records a completion when the thread is ready, or when it is waiting and the pending work does not hold completion.
- Mobile push:
projectThreadAwarenessV2, which the server relay publishes and the relay turns into the push, reports a completed run as running while held work is pending. AgentAwarenessRelay now also republishes on subagent.updated and provider-thread.updated, so a held completion goes out when that work ends. Before this, neither event triggered a publish, so nothing could release the hold.
The sidebar and the mobile list still show Waiting while a dev server runs. This PR only changes when the alert fires.
Also: the relay republishes on turn-item.updated when a background item type (command, dynamic tool, subagent) is no longer active (turnItemUpdateCanEndBackgroundWork, next to BACKGROUND_TURN_ITEM_TYPES); streaming output does not trigger a shell read.
Verification
packages/shared: vp test run src/orchestrationV2PendingBackgroundWork.test.ts src/agentAwareness.test.ts: 35 passed. The rule table covers none, command-only, two commands, subagent, monitor, command+monitor, command+subagent, and background_task/unknown.
apps/web: vp test run src/components/ThreadNotificationCoordinator.test.tsx src/components/ThreadNotificationCoordinator.badge.test.tsx: 33 passed. The new case: no alert while a monitor is pending, then one "Thread completed" alert once only a command remains.
apps/server: vp test run src/relay/AgentAwarenessRelay.test.ts: 21 passed.
apps/server: vp test run src/orchestration-v2/ProjectionStore.test.ts: the new case "dates a completion released by held background work at the release" runs the real SQL shell read. The run completes, a monitor stays pending (push phase running), and the monitor ends 5 minutes later through provider-thread.updated. The push is then completed with updatedAt equal to the release time, so the relay's 2-minute freshness check (infra/relay/src/agentActivity/agentActivityAlerts.ts) keeps it. This already holds, because the store bumps the thread's updatedAt on every run, turn-item, subagent and provider-thread event. The test pins it: dropping that bump makes the test fail with the run's time.
apps/server: vp test run src/relay/AgentAwarenessRelay.test.ts: 22 passed. The new case "publishes a held completion when its background item ends, not on tool output" drives the relay's real event stream over the in-memory projection store. The run completes with a background dynamic_tool still running, and the push is running. Streaming assistant output and a running tool tick do not read the shell. The tool's terminal turn-item.updated publishes completed. It fails with the old filter (['running'], no completion) and with an unfiltered one (extra shell reads, 6 instead of 4). packages/shared adds a table for the turn-item predicate.
- Before/after: with the source changes reverted, the new awareness cases (monitor, command+subagent), the new coordinator case, and the relay event-filter case all fail. With the fix they pass.
tsc --noEmit for shared, web, server, and mobile: clean. vp lint on the 8 touched files: clean. vp run knip:check: clean.
- Not run: replay fixtures or a live provider run. The change is pure client and relay logic over the shell's
pendingBackgroundTasks, which already carries kinds.
Model: Claude Opus 5.5 (Claude Code)
🤖 Generated with Claude Code

Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The completion alert and the mobile push now follow one rule, decided by
the typed kind of the background work a completed root run leaves behind.
Commands, such as dev servers and long-lived shells, do not hold the
alert. Subagents and monitors do, because they wake the agent (#13625).
Work the adapter cannot name, including unknown kinds, holds.
The rule is backgroundWorkHoldsCompletion in the shared pending-work
module. The web/desktop notification coordinator and the relay awareness
projection that feeds the mobile push both call it. The relay also
republishes on subagent and provider-thread updates, so a held
completion is sent when that work ends.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Approved at 50d531b
Macroscope's review found this PR approvable — This focused fix adjusts completion alerts based on the existing background-work kind, distinguishing long-running commands from work that can wake the agent. Web, relay, awareness, and projection behavior are covered by targeted tests, with no schema or production-infrastructure changes.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Thread transfer impact
✅ Thread transfer remains within every enforced ceiling.
ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.
| Provider |
Metric |
Main baseline |
This PR |
Impact |
PR ceiling |
|
| Codex |
Total thread wire |
— |
4.9 KiB |
— |
6.8 KiB |
✅ |
| Codex |
Thread snapshot wire |
— |
3.7 KiB |
— |
4.9 KiB |
✅ |
| Codex |
Live turn WebSocket wire |
— |
1.1 KiB |
— |
2.0 KiB |
✅ |
| Codex |
Live turn WebSocket decoded |
— |
20.4 KiB |
— |
29.3 KiB |
✅ |
| Codex |
Live turn messages |
— |
1 |
— |
8 |
✅ |
| Claude |
Total thread wire |
— |
4.9 KiB |
— |
6.8 KiB |
✅ |
| Claude |
Thread snapshot wire |
— |
3.7 KiB |
— |
4.9 KiB |
✅ |
| Claude |
Live turn WebSocket wire |
— |
1.2 KiB |
— |
2.0 KiB |
✅ |
| Claude |
Live turn WebSocket decoded |
— |
20.8 KiB |
— |
29.3 KiB |
✅ |
| Claude |
Live turn messages |
— |
2 |
— |
8 |
✅ |
Baseline: unavailable · PR result: 50d531b · Source CI: success
Scenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 106.1 KiB
- Claude decoded thread snapshot: 106.4 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…sh for the push
The relay drops a completed push whose updatedAt is over two minutes old.
Pin that a monitor ending five minutes after the root run releases the
completion with the release time: the shell's updatedAt follows the
provider-thread.updated that clears the roster.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Pending background work also counts active command, dynamic tool, and
subagent turn items. When one ends after the root run completed, only
turn-item.updated fires, which the relay ignored, so the push stayed
"running". The relay now republishes on turn-item updates that can end
background work: a background item type that is no longer active, per a
shared predicate next to BACKGROUND_TURN_ITEM_TYPES. Streaming output on
running items and every other item type still skip the shell read.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Sep 30, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:M
30-99 changed lines (additions + deletions).
vouch:trusted
Author is trusted by repo permissions or the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|