feat(clients): background work says what it is and which subagent finished #13949
t3code/codex-turn-mapping fromrefs/pull/13949/head·merged by juliusmarminge View on GitHubStacked on #13948, which makes the server name background work as a discriminated union. This PR shows it.
The composer strip said "Waiting on N background tasks" whether the work was a subagent, a shell command or a monitor, and it only listed raw descriptions or task ids. Mobile showed nothing at all once the turn settled. Timeline notification rows all used the same bolt icon and could not open the subagent that finished.
What changed#
Every client decision switches on the union's kind, with a satisfies never default, so a new kind fails to compile until each switch handles it. No client or shared code reads provider taskType strings any more.
- Shared title builder (
presentPendingBackgroundWorkinpackages/client-runtime/src/state/threadExecution.ts): groups pending work bykind, subagents first. A subagent member'schildThreadIdbecomes the item's link. A roster from before kinds existed arrives asbackground_task(the contracts fallback from #13948), so it reads "background task". - Web composer strip: the title comes from the builder, and the description lists every item by name. A subagent's name is an
InlineButtonthat opens its child thread, using the handler the timeline already uses. The long list keeps the banner's existing truncate-and-popover behavior. Stop is unchanged. - Mobile: the floating pill above the composer shows the same title once the turn settles (the thread shell's roster already reached mobile, but nothing rendered it). Its accessibility label lists each item. Stop is unchanged; mobile had no Stop for settled background work before this PR either.
- Timeline notification rows (web and mobile): an icon per
source.kindfrom the existing sets (webbot/terminal/eye, mobilehammer/command/eye, matching each surface's subagent and command rows).delegated_taskuses the subagent icon,background_taskkeeps the bolt, and a failed outcome keeps the alert icon. A notification whose source is one subagent or one delegated task opens that thread (notificationChildThreadId): an "Open subagent" link on web next to the timestamp (the same slot as "Open chat" for created threads), and the whole row on mobile (like the rows in the mobile subagent group). The summary text itself comes from #13948.
Before and after#
I did not run a dev server, so there are no screenshots. The strings, from the shared builder and the #13948 replay fixtures:
| Where | Before | After |
|---|---|---|
| Composer strip, one Claude background subagent | Waiting on background task · Background subagent test | Waiting on subagent Background subagent test · Background subagent test (opens the child thread) |
| Composer strip, two subagents and a command | Waiting on 3 background tasks · Review src/math.ts, Write tests, npm test | Waiting on 2 subagents and 1 command · Review src/math.ts, Write tests, npm test |
| Composer strip, one Claude background Bash | Waiting on background task · Background sleep test | Waiting on command Background sleep test |
| Mobile, same cases | (nothing after the turn settled) | the same titles in the floating pill |
| Timeline, Grok subagent finished | [bolt] Background activity updated | [bot] Subagent "Sleep then reply done" finished · Open subagent |
| Timeline, Grok monitor finished | [bolt] Background activity updated | [eye] Monitor "Watch three tick echoes" finished |
| Timeline, Claude TaskStop on an agent and its Bash | [bolt] Background activity updated | [bolt] Subagent "Agent B" and command "Sleep 60 seconds then echo B_DONE" were stopped (mixed kinds are background_task) |
| Timeline, a Codex command wake stored before #13948 | [bolt] Background command finished | [terminal] Background command finished (the stored background_command decodes as command) |
Verification#
packages/client-runtime:vp test run src/state/threadExecution.test.ts src/state/entities.test.ts: 50 passed. The presentation tests build union members only: single, grouped (with a subagent's child thread), and genericbackground_tasktitles.apps/web:vp test run src/session-logic.test.ts src/components/chat/MessagesTimeline.logic.test.ts src/components/Sidebar.logic.test.ts: 320 passed.apps/mobile:vp test run src/lib/threadActivity.test.ts src/features/threads/floating-working-status.test.ts src/features/threads/threadListV2.test.ts: 173 passed.tsc --noEmitfor contracts, shared, server, client-runtime, web and mobile: clean.vp linton touched files: no errors (it caught atoSortedthat Hermes lacks, fixed); remaining warnings are pre-existing.vpr knip:check: clean.- Not run: a dev server, a browser, or a simulator, so no before/after images.
Model: Claude Opus 5.5 (Claude Code)
🤖 Generated with Claude Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- @@ -443,4 +443,5 @@443443 }444444445445 function itemIcon(item: OrchestrationV2TurnItem): ThreadFeedActivity["icon"] {446- if (item.type === "notification") return "zap";446+ if (item.type === "notification") {447+ switch (item.workKind) {
🟡 Medium
lib/threadActivity.ts:447Failed notification items render the work-kind icon instead of
alert, so failed subagent, command, and monitor notifications lose their failure indicator.itemIconswitches onworkKindwithout checkingitem.outcome; returnalertbefore that switch when the outcome isfailed.Suggested change447- switch (item.workKind) {447+ if (item.outcome === "failed") {448+ return "alert";449+ }450+ switch (item.workKind) {🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/mobile/src/lib/threadActivity.ts around line 447: Failed notification items render the work-kind icon instead of `alert`, so failed subagent, command, and monitor notifications lose their failure indicator. `itemIcon` switches on `workKind` without checking `item.outcome`; return `alert` before that switch when the outcome is `failed`. Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
ℹ️ No successful
mainbaseline 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:
3382314· Source CI: successScenario 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.
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — This PR introduces cross-platform user-facing behavior for categorizing background work and navigating to subagent threads, rather than making a purely mechanical or isolated UI change. An unresolved medium-severity finding also indicates that failed mobile notifications can lose their failure icon.
Not approved because:
- 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity
No code changes detected at
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in [Settings](https://app.macroscope.com/pingdotgg/settings#Repos). You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).3382314. Prior analysis still applies.juliusmarminge merged thisb9ffe49
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed