Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(clients): background work says what it is and which subagent finished #13949

Mergedjuliusmarmingemerged 2 commits intot3code/codex-turn-mapping fromrefs/pull/13949/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Stacked 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 (presentPendingBackgroundWork in packages/client-runtime/src/state/threadExecution.ts): groups pending work by kind, subagents first. A subagent member's childThreadId becomes the item's link. A roster from before kinds existed arrives as background_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 InlineButton that 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.kind from the existing sets (web bot/terminal/eye, mobile hammer/command/eye, matching each surface's subagent and command rows). delegated_task uses the subagent icon, background_task keeps 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:

WhereBeforeAfter
Composer strip, one Claude background subagentWaiting on background task · Background subagent testWaiting on subagent Background subagent test · Background subagent test (opens the child thread)
Composer strip, two subagents and a commandWaiting on 3 background tasks · Review src/math.ts, Write tests, npm testWaiting on 2 subagents and 1 command · Review src/math.ts, Write tests, npm test
Composer strip, one Claude background BashWaiting on background task · Background sleep testWaiting 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 generic background_task titles.
  • 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 --noEmit for contracts, shared, server, client-runtime, web and mobile: clean. vp lint on touched files: no errors (it caught a toSorted that 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

    2. @@ -443,4 +443,5 @@
      443443 }
      444444
      445445 function itemIcon(item: OrchestrationV2TurnItem): ThreadFeedActivity["icon"] {
      446- if (item.type === "notification") return "zap";
      446+ if (item.type === "notification") {
      447+ switch (item.workKind) {
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium lib/threadActivity.ts: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.

      Suggested change
      447- 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`.
    3. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire—4.9 KiB—6.8 KiB✅
      CodexThread snapshot wire—3.7 KiB—4.9 KiB✅
      CodexLive turn WebSocket wire—1.1 KiB—2.0 KiB✅
      CodexLive turn WebSocket decoded—20.4 KiB—29.3 KiB✅
      CodexLive turn messages—1—8✅
      ClaudeTotal thread wire—4.9 KiB—6.8 KiB✅
      ClaudeThread snapshot wire—3.7 KiB—4.9 KiB✅
      ClaudeLive turn WebSocket wire—1.2 KiB—2.0 KiB✅
      ClaudeLive turn WebSocket decoded—20.8 KiB—29.3 KiB✅
      ClaudeLive turn messages—2—8✅

      Baseline: unavailable · PR result: 3382314 · 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.

    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      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 3382314. Prior analysis still applies.

      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).
    5. juliusmarminge merged thisb9ffe49

    6. juliusmarminge closed this

Sign in to join this conversation.