Skip to content

feat(native-chat): show live background work and name each row by kind - #19705

Merged
brennanb2025 merged 15 commits into
mainfrom
brennanb2025/strip-live-background-work
Sep 10, 2026
Merged

brennanb2025 merged 15 commits into
mainfrom
brennanb2025/strip-live-background-work

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​454 $\color{#cf222e}{\Huge{\mathbf{−}}}$​39 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​415
Prod 14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​288 $\color{#cf222e}{\Huge{\mathbf{−}}}$​111 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​177

Makes the native-chat background-tasks strip a truthful live view of work in flight, and names each row by what it actually is. Also rescues one commit stranded by the squash-merge of #19346.

Rescued from the squashed #19346 branch

#19346 was squash-merged, so brennanb2025/codex-strip-producer is orphaned — none of its commits are ancestors of main.

Checking what actually survived the squash: main is byte-identical to 9b9d163863 ("keep a child's name on the command row that outlives it") across all four files it touched, so that fix did land. Its follow-up 03d336aea1 did not. That commit is carried here unmodified, with its original message and authorship.

It matters on its own: a child's label was spliced into the command row unbounded and the pair then clipped to the description cap, so a label at or past that cap clipped the command away entirely — leaving a row of kind command that named an agent and showed no command, inverting the qualification's purpose. It could also cut a surrogate pair.

The strip suppressed itself in three places

Between them, work in flight was never shown:

  • claude-background-task-tracker.ts blanked its whole roster for the duration of any turn (foregroundTurnActive ? [] : …), so a task backgrounded in an earlier turn vanished the moment the next prompt was sent.
  • codex-background-task-tracker.ts returned nothing while a primary turn was open (primaryTurnId !== null).
  • structured-session-background-tasks-view.ts gated on turnId === null, blanking the strip mid-turn for both providers regardless of what the producers published.

Claude additionally dropped every foreground subagent (if (!task.backgrounded) continue), so a fan-out reported nothing at all.

All four come out. Work is reported while it is live.

What retires a row

Foreground Claude work is turn-scoped, so result retires it via a liveInTurn flag — that is the provider's own outcome for a task it marked foreground, not a roster sweep. Backgrounded work is never touched there; only its own terminal frame retires it.

Nothing settles a Codex child on turn end. Those keep reporting well past their parent turn, so turn frames only prompt a republish. Turn end reveals; it never settles.

Row labels and glyphs

Superseded by the merge with #19311 — corrected here rather than left stale.
This branch originally introduced per-row Subagent / Shell command / Workflow / Monitor labels in its own native-chat-background-task-kinds module. #19311 landed first with a richer treatment of the same intent, so the merge deleted this branch's module in favour of it. That is a supersession, not a loss — but the wording below described the old version, so it is restated.

What actually ships: rows are grouped under kind headers — Agents / Shell / Monitors / Workflows — and each row shows its own provider description. A row that carries a provider description shows it unchanged, so the rescued commit's long_probe — ping -c 300 … provenance flows through untouched. backgroundTaskKindLabel is now only the fallback for a task with neither a description nor a name, and it reads Background agent / Background command / Background workflow / Background monitor. In live QA every row carried a provider description, so that fallback is rare.

Two cosmetic follow-ups this leaves, neither blocking: the fallback renders Background agent under an Agents header, which is redundant; and glyphs now come from direct lucide-react imports rather than the shared table, so strip/tool-row glyph agreement is by convention rather than by construction.

monitor draws the amber heartbeat (Activity, text-yellow-500) that AgentStateDot and the sidebar's StatusIndicator already use — monitoring is one idea app-wide and a second glyph would split it. That survived the merge intact, in both the header segment and the expanded row, via a single kindIconTone source so the two cannot drift apart. The other kinds stay muted: they mark a category, whereas monitoring is a state the app already colours.

The collapsed header summary now comes from #19311, which merged while this was in review — it reads 3 agents · 2 shells · 1 monitor with per-kind glyphs, replacing the flat "Monitoring background tasks" this branch was originally written against.

Command admission is unchanged in effect

conversationCommandBlocked refuses only conversation commands (/clear, /compact), never message sending. It checks activeStructuredAgentSessionTurnId before the background-task branch, so mid-turn the open-turn refusal fires first — showing more work cannot add or re-label a refusal. Post-turn the blocking set is unchanged, because Claude foreground work is retired at result and never reaches the backgrounded set the gate reads. Pinned by test.

Verification

Driven on a real isolated dev instance (own CDP port, renderer port and profile, ORCA_BACKGROUND_LAUNCH=1), both providers mid-turn with data-native-chat-working="true":

  • Claude: a real subagent fan-out plus backgrounded shells reported live while the turn was open.
  • Codex: spawn_agent child plus a persistent background shell reported live while the turn was open.
  • The original defect reproduced as fixed: a shell backgrounded in one turn stayed visible across the next prompt instead of vanishing.

The monitor-heartbeat tests were ablation-checked — reverting the glyph to eye turns them red, restoring turns them green.

A child's label is raw provider text and was spliced into the command
row unbounded, then the pair clipped to the description cap. A label at
or past that cap clipped the command away entirely, leaving a row of
kind 'command' that named an agent and showed no command - the failure
qualification exists to remove, inverted. The same clip could also cut a
surrogate pair, which boundSubagentField already guards against on the
agent row two lines away.

Give the label a reserved share and clip it the way the agent row does.
@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ac631c44-a7a4-4741-9b75-8dbadf4badf9

📥 Commits

Reviewing files that changed from the base of the PR and between bf292eb and 0f812d0.

📒 Files selected for processing (1)
  • src/renderer/src/web/web-runtime-client.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Claude and Codex trackers now expose live background work while the spawning turn remains open. Foreground tasks settle at turn completion, while background tasks remain monitored. Codex command descriptions use bounded, surrogate-pair-aware clipping. Session monitoring no longer depends on an active turn identifier. Background task rows now use kind-specific icons, shorter labels, and stoppability-aware controls. Runtime capability negotiation filters non-stoppable rows for older readers. Command admission retains current-turn precedence.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to 0f812

Live task disclosures preserve expansion across a temporary task-list gap, but changing the disclosure in another session may collapse a previously expanded session when returning to it. This is a bounded UI-state regression risk.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 27 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description explains the implementation and verification, but it does not follow the required template. It omits the required ELI5, Why, Visual Proof, AI Disclosure, Review, Agent skill upstream b… Complete the required template sections. Add an ELI5 summary, explicit rationale, a Fixes #... linked issue, before-and-after visual proof or N/A with a reason, AI disclosure details, review information, the agent skill boundary checkbo…
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: native-chat now shows live background work and identifies rows by kind.
Full details: Description check

Explanation

The description explains the implementation and verification, but it does not follow the required template. It omits the required ELI5, Why, Visual Proof, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections. It also does not provide the required linked issue in the Fixes # format or visual evidence for the UI changes.

Resolution

Complete the required template sections. Add an ELI5 summary, explicit rationale, a Fixes #... linked issue, before-and-after visual proof or N/A with a reason, AI disclosure details, review information, the agent skill boundary checkbox, notes on compatibility and platform impact, and the required testing and checklist status.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The strip now shows foreground work, but the per-row Stop button it renders on that work is a silent no-op — see the inline comment. Worth resolving before merge; everything else looks solid.

Reviewed changes

  • Live foreground work on the strip — ClaudeBackgroundTaskTracker and CodexBackgroundTaskTracker stop blanking their rosters mid-turn (dropping foregroundTurnActive / primaryTurnId), and structuredSessionBackgroundTasksView drops its turnId === null gate, so a fan-out of subagents reports while it runs.
  • Per-kind row labels and glyphs — a new native-chat-background-task-kinds module names rows (Subagent / Shell command / Workflow / Monitor) and resolves glyphs through the shared tool-icon table; monitor draws the app-wide heartbeat.
  • Rescued label-bound command row — boundLabel reserves a 96-char share of the 512-char description so a long child label can't clip the command away, and never cuts a surrogate pair.
  • Command-admission regression pin — a test pins that a live fan-out doesn't re-label the turn-open refusal.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

The strip suppressed itself in three places: the Claude tracker blanked
its roster for the whole of any turn, the Codex tracker returned nothing
while a primary turn was open, and the renderer view gated on
`turnId === null`. Between them, work in flight was never shown — and a
task backgrounded in an earlier turn vanished from the strip as soon as
the next prompt was sent. Claude additionally dropped every foreground
subagent, so a fan-out reported nothing at all.

Report work while it is live, in all three layers. Foreground Claude
work is turn-scoped, so `result` retires it — that is the provider's own
outcome for a task it marked foreground, not a roster sweep. Nothing
settles a Codex child on turn end: those keep reporting well past their
parent, so turn frames only prompt a republish.

Name each ROW by kind — Subagent, Shell command, Workflow, Monitor —
instead of a generic "Background <kind>", each drawing the glyph the
shared tool-icon table already uses for that category. A row that
carries a provider description still shows it unchanged. The collapsed
header summary is deliberately untouched; it is owned elsewhere.

The conversation-command gate is unchanged in effect: an open turn
already refuses first, and Claude foreground work never reaches the
backgrounded set the gate reads.
@brennanb2025
brennanb2025 force-pushed the brennanb2025/strip-live-background-work branch from 9107c65 to 88204cd Compare September 9, 2026 08:39

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

No new issues in this delta — the monitor-glyph colour change is correct and well-tested. I'm holding approval only because the previously-flagged Stop-button no-op on foreground rows is still unresolved; these commits don't touch that path.

Reviewed changes

  • Amber monitor heartbeat — BackgroundTaskKindIcon now colours the monitor heartbeat text-yellow-500, matching AgentStateDot and the sidebar's StatusIndicator, so monitoring reads as one state app-wide; the other kinds stay muted.
  • Colour-pinning tests — NativeChatBackgroundTasksStatus.test.tsx pins the heartbeat glyph and its amber against AgentStateDot, and asserts agent/command/workflow/unknown rows stay muted.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Merge Sim added 4 commits September 9, 2026 12:57
… honour

The strip now publishes foreground rows, but `stoppableTaskIds` still filters
on `backgrounded`, so `stopClaudeBackgroundTasks` resolved an empty target list
and returned `{ cancelled: false }` that no renderer reads: the user clicked
"Stop Subagent" and nothing ever happened.

Carry stoppability per row instead of widening the stop to a target the SDK has
no way to reach. `AgentSessionBackgroundTask.stoppable` is absent-means-yes, so
hosts that predate it keep their working control, Claude emits `false` only on
foreground rows, and the strip hides that row's button the same way it already
hides the stop-all a provider cannot honour.
`background_tasks_changed` lists BACKGROUNDED tasks, so a foreground subagent
can never appear in it. Treating it as the whole world meant any such frame
cleared every live foreground row mid-flight and then dropped every later
foreground `task_started` for the rest of the session, killing the in-turn
fan-out the strip exists to show in any session that ever backgrounds anything.

Decide `backgrounded` before the staleness guard and apply the guard only to a
backgrounded start, and retain live foreground entries across a roster replace.
Retained rows count against MAX_TRACKED_TASKS, so the map stays bounded, and a
stale backgrounded start the roster no longer lists is still dropped.
… defines it

`MONITOR_GLYPH_COLOR`'s comment claimed a test held it and AgentStateDot's amber
together, but no test imported it — the assertions hardcoded 'text-yellow-500',
so the two could drift with every test still green. Read the colour from the
module, which is what the comment always said was happening. Drop the unused
`BackgroundTaskGlyph` export too: nothing outside the module names it.
The strip is now mounted on live work, so a sequential fan-out unmounts it
between one subagent finishing and the next starting: local `useState` meant
the expanded list collapsed itself on every such gap, on top of the strip
flickering above the composer.

Hand the disclosure to the session, keyed by session id so it does not leak
across a session switch. The strip is now controlled and holds no state of its
own, which is what makes it survive its own mount churn.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: b80afe3e-7ba6-42f0-b21c-c9927a7b1511

📥 Commits

Reviewing files that changed from the base of the PR and between 88204cd and 02da268.

📒 Files selected for processing (10)
  • src/main/claude/claude-background-task-tracker.test.ts
  • src/main/claude/claude-background-task-tracker.ts
  • src/renderer/src/components/native-chat/NativeChatBackgroundTasksStatus.test.tsx
  • src/renderer/src/components/native-chat/NativeChatBackgroundTasksStatus.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsx
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
  • src/renderer/src/components/native-chat/native-chat-background-task-kinds.tsx
  • src/shared/agent-session-wire.ts
  • src/shared/structured-agent-session-reducer.test.ts
  • src/shared/structured-agent-session-reducer.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Comment on lines +324 to +326
onExpandedChange={(expanded) =>
setExpandedBackgroundTasks({ sessionId: props.sessionId, expanded })
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Store disclosure state for each session.

A user can expand session A, change the disclosure in session B, and then return to session A. Line 325 replaces the only stored record with session B. Lines 320-323 then collapse session A.

Store expansion values by sessionId. Add a test for A → B → A after both disclosures change.

Proposed fix
-type ExpandedBackgroundTasks = { sessionId: string; expanded: boolean }
+type ExpandedBackgroundTasks = ReadonlyMap<string, boolean>
 
-  const [expandedBackgroundTasks, setExpandedBackgroundTasks] =
-    useState<ExpandedBackgroundTasks | null>(null)
+  const [expandedBackgroundTasks, setExpandedBackgroundTasks] =
+    useState<ExpandedBackgroundTasks>(() => new Map())
 
-          expanded={
-            expandedBackgroundTasks?.sessionId === props.sessionId &&
-            expandedBackgroundTasks.expanded
-          }
-          onExpandedChange={(expanded) =>
-            setExpandedBackgroundTasks({ sessionId: props.sessionId, expanded })
-          }
+          expanded={expandedBackgroundTasks.get(props.sessionId) ?? false}
+          onExpandedChange={(expanded) => {
+            setExpandedBackgroundTasks((current) => {
+              const next = new Map(current)
+              next.set(props.sessionId, expanded)
+              return next
+            })
+          }}

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Foreground rows withhold their Stop — f1de6e3490 adds an optional stoppable field to the wire task type; Claude publishes stoppable: false on foreground rows and the strip's backgroundTaskStoppable hides the per-row Stop that would have silently no-op'd, resolving the only open hold from the prior review.
  • Aggregate roster scoped to backgrounded work — 70dda28faf stops background_tasks_changed from wiping live foreground rows: those survive the roster replacement (still bounded by MAX_TRACKED_TASKS), and the stale-start guard now convicts only backgrounded starts.
  • Expansion state survives a fan-out gap — 02da268af7 lifts the strip's expanded state to the parent, keyed by session, so a sequential fan-out that momentarily empties the roster no longer collapses the open list.
  • Monitor amber pinned to its constant — 1dd39889fc exports MONITOR_GLYPH_COLOR and re-pins the heartbeat/amber tests to it instead of a hardcoded string, so the strip and the monitoring dot can't silently drift.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron QA — first captures at 88204cdfa5

No screenshots existed on this PR. Hidden isolated dev instance (own profile /tmp/sndr05, CDP 9413, renderer 5313; ownership proved by /@fs 200-mine / 403-peer), own worktree. Real structured Claude sessions, real subagents and real backgrounded shells. No fixtures.

Head note: captured at 88204cdfa5d59d65681cdb1a621ee7f6e40351c8. Four commits landed while I was shooting (through 02da268af7); everything below is at the SHA named, and two of those later commits are directly relevant — see the last section.

1. Foreground fan-out visible mid-turn — what this PR uniquely adds

full-06.png

88204cdfa5, fresh session. The prompt in frame says "all in the FOREGROUND — do NOT set run_in_background". The transcript reads Kicked off 3 subagents · 3 working · 37s, the Working… spinner is directly above the strip and the composer shows Stop — turn visibly in progress. The strip carries five live rows: two subagent rows plus the three shells those subagents are running. On main and on #19311 this work is invisible, because backgroundTaskDetails() filters to backgrounded tasks only.

2. Mixed turn — backgrounded and foreground work together

full-08.png

88204cdfa5. Strip mounted and populated with five rows while the turn runs.

3. Per-kind row icons and the amber heartbeat

strip-08.png

88204cdfa5. The amber heartbeat glyph leads the header, and the row glyphs are muted and distinct by kind — a bot for the subagent row, terminals for the four shell rows.

One honest qualification on "name each row by kind": every row here shows the provider's own description, so the kind names (Subagent, Shell command) never rendered — that fallback only fires when the provider sends no description, which I could not make Claude do. The per-kind icons are what these captures demonstrate.

4. A defect I hit at this SHA — since fixed on the branch

In my first session the strip showed a Kicked off 2 subagents · 2 working line in the transcript while no foreground subagent rows appeared. In a fresh session with foreground-only work (section 1) the same rows appeared normally. The difference: the first session had already run backgrounded work.

That matches 70dda28faf ("scope aggregate-roster authority to the work it enumerates") exactly — background_tasks_changed lists only backgrounded tasks, so once one arrived, later foreground task_started frames were dropped for the rest of the session. I want to be precise about provenance: the observation is mine and reproduced twice, but my attempt to isolate the mechanism read the wrong pane and was inconclusive, so I am not claiming I proved the cause — I am reporting that the symptom I saw and the commit message describe the same thing. Worth a confirming capture at the current head.

Also observed and apparently addressed by f1de6e3490: foreground subagent rows carried a Stop control at 88204cdfa5.

Not reproduced

Merge Sim added 6 commits September 9, 2026 13:42
`boundLabel` avoided splitting a pair, then `qualifiedDescription` re-cut the
COMPOSED string with a raw slice: label (<=96) plus separator plus description
(<=512) is up to 611 chars, so that second cut landed at an arbitrary index
inside the description and could publish a lone high surrogate — lossy through
any non-JSON UTF-8 hop. `parse` had the identical hazard on an unqualified
primary-thread command.

One `boundText` helper now owns all three cuts, so no path in the file can emit
a lone surrogate from well-formed input.
… lists

Narrowing the admission guard to backgrounded starts left a finished FOREGROUND
id with no defence: `replaceAggregateRoster` wiped `terminalTaskIds` wholesale,
so after any `background_tasks_changed` a replayed `task_started` revived a task
whose completion had already been seen — and only a later `result` could settle
it again.

Scope the wipe the same way the guard was scoped: delete only the ids the
incoming roster actually enumerates. A roster still overrules terminal evidence
for the work it lists, which is what that behaviour was added for.
…he newest

Re-adding retained foreground entries after the roster made a live row the user
is reading jump below the backgrounded rows on every `background_tasks_changed`,
and the cap `break` kept the STALEST retained rows while dropping the newest.

Merge in the tracked map's own order so a surviving row holds its position, and
count the overflow up front so eviction takes the oldest retained rows. Roster
entries are never starved and the map stays bounded either way.
A foreground `task_started` arriving with no turn open has no `result` coming
to retire it, so it sat in the strip indefinitely — with no per-row stop, since
foreground rows are not stoppable — and refused conversation commands behind an
instruction nobody could follow.

Settle on turn start as well as on `result`. This is cleanup only: visibility
never consults `startsTurn`, so a missed one degrades to today's behaviour and
can never switch the feature off. It shortens the row's life to the next turn;
the case where no further turn is ever sent is filed separately.
…te them

Rule 3 of remote-wire-compatibility: changing what the host publishes reaches
old clients with no wire change. The Claude host published no foreground rows
before this feature; it does now, and a client that cannot read `stoppable`
draws a per-row Stop on every one of them — Claude always sets
`supportsTaskStop` — which filters to the backgrounded ids, stops nothing, and
returns a result no renderer inspects. That is the dead button `stoppable` was
added to remove, reappearing across a version skew.

Negotiate it. A client can advertise the existing background-task-stop
capability and still predate `stoppable`, so this needs its own constant.
Readers that do not advertise it get unstoppable rows dropped, and a state whose
every row is dropped becomes no strip — exactly their pre-feature view.

RUNTIME_PROTOCOL_VERSION is not bumped: this adds an optional field and a new
negotiated capability, and changes no existing field's meaning, which is the
explicit do-not-bump case in protocol-version.ts.
An indexed lookup into the fixture's task list is possibly-undefined under
`pnpm tc`; the rows are more readable named anyway.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron QA — re-run at 02da268af7

Fresh isolated dev instance on a new worktree at 02da268af7aa40ef80022babe3668afb88823996 (own profile /tmp/sndr5b, CDP 9414, renderer 5314; ownership proved by /@fs 200-mine / 403-peer). Real structured Claude session, real subagents and real backgrounded shells. Supersedes my earlier captures at 88204cdfa5 — those predate the four fixes on top.

Every row claim below is also machine-checked: I read each li for the presence of a Stop button rather than judging it by eye.

(a) + (b) in one frame — foreground rows have no Stop, backgrounded rows keep theirs

full-06.png

strip-06.png

02da268af7. Transcript reads Kicked off 3 subagents · 3 working · 24s with a live Working on: spinner, so the turn is visibly in progress. Per-row probe at that instant:

row kind glyph Stop
Ping loopback 400 times in background terminal yes
Ping loopback 500 times in background terminal yes
Ping loopback and count lines ×3 (foreground subagents) bot no

That is f1de6e3490 working: stoppable: false on foreground rows, absent-means-yes on the backgrounded ones.

This frame also re-tests 70dda28faf. The prompt starts the two backgrounded shells first, then launches the foreground fan-out — the exact ordering that killed foreground rows at 88204cdfa5. All three subagent rows now appear and persist.

(c) The expanded list survives a gap in live work

I clicked the header once, during the first subagent, and never touched it again. Polling across the whole turn:

[19] strip:true  exp:true  working:true  rows:["Ping loopback 70 times"]
[20] strip:false           working:true          <- roster empty, strip UNMOUNTED
[21] strip:false           working:true
[22] strip:false           working:true
[23] strip:true  exp:true  working:true  rows:["Ping loopback 220 times"]   <- remounted, still open

Before the gap:

strip-19.png

After the gap:

strip-25.png

The strip genuinely unmounted for three consecutive polls between the two sequential subagents, and came back expanded. That is 02da268af7 lifting expanded into NativeChatStructuredSession keyed by sessionId.

(d) Monitor row — not reproduced, and I believe it is not reachable this way

I did not get one, and I am not going to imply otherwise. A monitor row needs kind: 'monitor', which comes only from classifyClaudeBackgroundTaskKind(task_type === 'monitor'). task_type is read exclusively from provider frames — grepping src/main/ shows Orca never synthesizes one — and a composer-driven Claude session emits only local_agent and local_bash. So this needs a seeded journal row or a wire-level fixture, not a driven turn.

The amber glyph visible in the header of every capture above is the strip's monitoring indicator, a different element from BackgroundTaskKindIcon with MONITOR_GLYPH_COLOR. Given 1dd39889fc already pins that constant in a test, a live monitor-row capture may not be worth the fixture.

Still not covered

Packaged build, Windows/WSL/Linux/SSH, mobile, mixed-version client, and the Codex lane — none exercised here.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Since the prior review at 02da268, six commits landed:

  • Phantom foreground cleanup at turn start — ClaudeBackgroundTaskTracker.observe now settles foreground tasks on startsTurn, so a foreground task_started that never receives a result frame no longer lingers in the strip and can no longer block conversation commands nobody could follow.
  • Roster replacement keeps live foreground rows in place — replaceTracked merges the aggregate roster with retained foreground rows, evicting the stalest retained row first (never the newest) while roster entries are never starved.
  • Terminal evidence scoped to roster ids — replaceAggregateRoster clears terminalTaskIds only for ids the roster actually lists, so a finished foreground id stays defended against a replayed task_started.
  • Surrogate-safe command-row clipping everywhere — boundText(value, max) generalizes boundLabel, and qualifiedDescription clips the composed row a second time surrogate-safely instead of a raw slice.
  • Row-stop capability gates unstoppable rows from legacy readers — a new AGENT_SESSION_BACKGROUND_TASK_ROW_STOP_CAPABILITY distinguishes readers that honour stoppable, and withoutUnstoppableRows withholds stoppable: false rows from readers that predate the field, restoring their pre-feature view.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron UI evidence at bf292ebd94.

Captured on an isolated macOS dev instance built from this branch (its own CDP port, its own renderer port, its own user-data profile), driving a real structured Claude chat session in a folder workspace. Full-window CDP screenshots, no cropping.

1 + 2 — live turn: foreground Subagent rows carry no Stop, the backgrounded shell row does — REAL PROVIDER TURN

01-live-turn-subagents-no-stop.png

One turn, still in flight ("Working for 1m 17s", "Kicked off 4 subagents · 4 working · 1m 8s"), strip expanded above the composer. Sleep 300 seconds in background is a backgrounded shell row and shows its Stop; the four foreground Subagent rows show none. Shots 1 and 2 land in the same frame, so the contrast is visible in one UI. Before this branch the strip was blanked for the whole turn, so none of these rows were on screen while they ran.

3 — the expanded list stays open across a gap in live work — REAL PROVIDER TURN (three frames)

3a — expanded, work live. The roster is already draining as subagents finish (the red one has retired; four rows left).

03a-expanded-before-gap.png

3b — the gap. Turn finished, roster empty, the strip is unmounted entirely.

03b-gap-strip-absent.png

3c — after the gap. A second prompt starts a fresh fan-out and the strip comes back already expanded — I never clicked the header again. DOM read at the moment it remounted: aria-expanded="true" with rows Research the city Kyoto / Lisbon / Reykjavik.

03c-expanded-after-gap.png

4 — all four row kinds together, with the Monitor heartbeat — RENDERER-DRIVEN STATE

04-kinds-and-monitor-heartbeat.png

This is not a live session's roster. No turn I drove ever produced a monitor or workflow task, so I mounted the real NativeChatBackgroundTasksStatus component — imported from the running dev renderer, real tokens, real app window — into the strip's own position above the composer, with one row per kind, while a real turn ran behind it. Subagent (bot), Shell command (square-terminal), Workflow (list-checks), Monitor (Activity). Computed colour on the Monitor glyph is oklch(0.795 0.184 86.047), i.e. text-yellow-500 — the same amber as the monitoring dot in the header; the other three resolve to text-muted-foreground.

5 — collapsed strip — REAL PROVIDER TURN

05-collapsed-strip.png

Same live turn as shot 1, header collapsed: amber monitoring dot, "Monitoring background tasks", chevron pointing down.

What I confirmed, and what I did not

Confirmed against real provider turns: live work renders while the turn is open, not only after it settles; per-kind naming and glyphs for Subagent and Shell command; the row Stop withheld on Claude foreground subagent rows and present on the backgrounded shell row; the row Stop actually acting when clicked (the model's own reply in 3b reports the sleep 300 as "stopped by the user" rather than completing); the expanded list surviving a full unmount/remount gap; and the collapsed header.

Not confirmed from a live provider: Workflow and Monitor rows, including the amber heartbeat — those appear only in the renderer-driven shot 4, because no turn I drove emitted a local_workflow or monitor task. Also out of scope for this pass: the Codex producer, remote/SSH hosts, and the untargeted stop-all fallback.

Merge Sim added 2 commits September 9, 2026 14:44
…tion

The web e2ee handshake started sending
AGENT_SESSION_BACKGROUND_TASK_ROW_STOP_CAPABILITY, and this test asserts the
advertised list by deep equality, so it went red on CI while every targeted
test run stayed green. Add the capability in the position the router sends it.
…-out

The strip unmounting between two sequential subagents is truthful, not a swept
row: A leaves on the provider's own terminal frame, B does not exist yet, and
backgrounded work spanning the same gap holds the roster open — so an empty
roster is never work the strip is hiding.

Also pins the previous-turn rule against the one the subagent roster already
applies on the same frame: a still-working FOREGROUND child becomes
`unverifiable` there and a backgrounded one is left alone, so the strip drops
the first and keeps the second rather than asserting `live` for either.
@brennanb2025

brennanb2025 commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Review status: three loops run, eleven defects found and fixed, CI green

Reviewed across three independent loops against the merge base 65631e449a. The original head was 88204cdfa5; twelve commits were added on top. The two original commits — including the rescued ea3d4ee82a — are untouched: no rebase, no reword, no force-push.

The core change is right, and the design holds up: turn end reveals work, it never settles it. What the loops found is that the three suppressions were load-bearing in ways the PR didn't account for — removing them exposed a dead control and a guard that silently killed the feature.

Blockers found and fixed

1. Claude foreground rows drew a Stop button that silently did nothing. backgroundTaskDetails() started publishing backgrounded || liveInTurn, but stoppableTaskIds still filtered on backgrounded only, and the Claude adapter sets supportsTaskStop: true unconditionally — so every in-turn subagent row got a per-row Stop that resolved to an empty target list and returned {cancelled: false}, which no renderer inspects. Spinner, then nothing, forever.

Fixed with a per-row optional stoppable?: boolean (absent-means-stoppable, so hosts that predate it keep their working control) rather than by widening stoppableTaskIds — nothing in claude-stream-json-connection gives an in-turn foreground subagent a stop target, so widening would have shipped a control that stops the wrong thing. The component already documented this exact principle for supportsStopAll; the per-row control now obeys it too.

2. Any background_tasks_changed frame permanently killed the headline feature. replaceAggregateRoster set aggregateRosterObserved = true and cleared the whole map; the task_started guard then dropped every id not already tracked. The aggregate roster enumerates background tasks, so a foreground subagent can never be in it — meaning one backgrounded task anywhere in the session wiped live foreground rows mid-flight and suppressed every later one until session end. Aggregate-roster authority is now scoped to the class of work it actually enumerates.

Also fixed

  • qualifiedDescription re-cut the composed string with a raw .slice(0, 512), defeating boundLabel's surrogate safety two lines above it. Reproduced: a 96-char label plus a 512-char command with an emoji at UTF-16 412/413 published a description ending in a lone U+D83D. Every cut in that file now routes through one surrogate-safe clip, including the parse cut that predated the PR.
  • Scoping the guard in (2) left finished foreground ids undefended, because replaceAggregateRoster still wiped terminalTaskIds wholesale — a replayed task_started could resurrect a completed row permanently. Terminal evidence is now dropped only for ids the incoming roster actually lists.
  • Retained rows were re-appended after roster entries, so a foreground row jumped below the backgrounded rows on every roster frame; and overflow eviction kept the stalest rows and dropped the newest. Both corrected.
  • A foreground task_started arriving with no turn open became a row nothing retired. settleForegroundTasks() now also runs on turn start. This is cleanup only — visibility never depends on that signal, so a missed one degrades rather than hiding live work.
  • The expanded list collapsed itself mid-turn: the strip unmounts when the roster momentarily empties between sequential subagents and remounted collapsed. expanded is lifted into NativeChatStructuredSession, keyed by session.
  • Mixed-version skew. Per docs/reference/remote-wire-compatibility.md, the optional stoppable field is Rule-1 safe, but the host also began publishing a class of row it never published before on an existing path — Rule 3. An old client can't read stoppable and would draw the dead Stop again. Now gated behind AGENT_SESSION_BACKGROUND_TASK_ROW_STOP_CAPABILITY, advertised on all five client paths (local IPC — both lists, the remote-transport funnel, web e2ee, mobile). A roster whose every row is dropped collapses to no strip, which is exactly the old client's pre-feature view. RUNTIME_PROTOCOL_VERSION is deliberately not bumped — new optional field plus a new negotiated capability is the documented do-not-bump case.

Verification

  • pnpm tc → exit 0. oxlint, audit:code-quality:native, the --type-aware config, react-doctor on changed files, check:max-lines-ratchet (7 grandfathered suppression(s), no new bypasses) and the localization catalog verify → all exit 0. No max-lines disable or ratchet bump was added; no new translate() key.
  • Capability-sensitive sweep: Test Files 424 passed | 2 skipped (426), Tests 4106 passed | 14 skipped (4120).
  • Neither pnpm-lock.yaml nor mobile/pnpm-lock.yaml appears in the diff.
  • A CI failure that every targeted test run missed: adding the capability to the web e2ee handshake reddened web-runtime-client.test.ts, which asserts the advertised list by deep equality. Three review loops, a readiness pass and a perf pass all ran targeted tests and reported green — only CI caught it. Fixed in 0f812d0ca4.
  • Performance, measured rather than estimated. For the realistic case (8 subagents + 2 background shells, 356 frames) the whole regression is +17 publishes, +8.7 KB and +1.9 ms of main-process CPU per turn. The two highest-cadence frame types — Claude task_progress and Codex item/updated — never reach a refresh at all, which is what keeps it small.
  • Electron evidence on a real isolated dev instance is posted above: live mid-turn rendering, Stop withheld on foreground rows and present on the backgrounded shell row, the row Stop actually acting, and the expanded list surviving a full unmount/remount gap. Three capture comments accumulated as the branch moved — the bf292ebd94 set is the current one; the 88204cdfa5 and 02da268af7 sets predate fixes and are superseded.

Not changed, deliberately

The collapsed header still reads "Monitoring background tasks" while showing foreground work. #19311 owns that region and is rewriting it — reconciling here would only make both harder to merge.

On the overlap with #19311 — a correction worth recording

It is not the case that this PR owns the producer filters while #19311 owns the renderer gate. I checked both branches: each one independently stops the strip being suppressed mid-turn. #19311 keeps the turnId parameter and splits the gate (show: monitoring mounts mid-turn; isMonitoring: turnId === null && monitoring gates only the animated indicator and conversation commands); this PR drops turnId entirely and adds liveInTurn. Mid-turn population reproduces on either branch alone — what differs is which work populates it. #19311 still filters to backgrounded work; this one surfaces foreground fan-outs.

Two practical consequences:

  • structured-session-background-tasks-view.ts will produce a loud conflict, not a silent one — the two versions have different field names and different arity (show/isMonitoring/tasks/settledTasks vs isMonitoringBackgroundTasks/backgroundTasks). That is the good outcome; whichever lands second must resolve it deliberately rather than accept an auto-merge. This area has already produced three silent bad merges that raised no conflict marker.
  • Both PRs extend the same wire type additively and independently — feat(native-chat): the background-tasks strip says what is running #19311 adds settledTasks to AgentSessionBackgroundTaskState, this one adds stoppable to AgentSessionBackgroundTask. They compose, but the second to merge has to carry both.

Also note NativeChatBackgroundTasksStatus is now controlled (expanded / onExpandedChange), so any new render site must pass both props.

Follow-ups worth filing, none blocking

  1. The web e2ee handshake advertises the new row-stop capability but still omits its sibling AGENT_SESSION_BACKGROUND_TASK_STOP_CAPABILITY — pre-existing, but it means a web client never sees the Codex strip at all, and this PR makes that state far more reachable. One line, but it turns a feature on for a surface nobody has QA'd here, so it belongs in its own change.

  2. tests/e2e/cross-version-wire/ has no background-task coverage, so the Rule-3 gate has no two-build enforcement.

  3. JSON.stringify fingerprinting could reuse the reducer's existing field equality (~5× cheaper, drops a per-frame allocation up to 272 KB at the cap).

  4. The Codex live-command map is byte-capped but has no count cap.

  5. In a sequential fan-out the strip goes blank for several seconds mid-turn — truthful, but worth a deliberate ruling. Measured live with a timestamped ~1s poll (mean interval 1019 ms over 95 samples): the strip is absent for 4.91s at minimum and 6.97s at maximum, with the turn reporting working: true on every sample inside the gap. This is not a flicker and it is not layout churn — it is a blank strip while the turn is visibly working.

    It is nonetheless truthful, and that is now pinned by test rather than argued. The roster empties because the provider's own terminal frame for subagent A (task_notification(A, completed)) retires it, and B does not exist until its own task_started. Every path into finish() is provider-driven; there is no timer and no turn-based sweep, so nothing is retired early or dropped and re-admitted late. Backgrounded work spanning the same gap holds the roster open, which is why the reproduction recipe requires no backgrounded shell.

    The duration is not a property of this code — it is however long the parent model takes to process A's result and issue the next spawn, so it is unbounded rather than fixed; 4.9–7.0s is one real observation, not a constant.

    It also pre-dates every review-loop commit: finish() and the const next = details.length > 0 gate are byte-identical to this PR's own original head 88204cdfa5, and the renderer mount path is unchanged since 02da268af7.

    Flagging it as a product question rather than a bug. Against the bar of showing what is happening while it is happening, an empty roster genuinely means nothing is running, and the turn keeps its own working indicator throughout. But a five-to-seven second hole is worth ruling on deliberately rather than discovering later. I would not close it with a debounce (that shows finished work for hundreds of ms) or by keeping the strip mounted with an empty list (that renders "Task details are unavailable for this session" — worse than absence). If it should not go blank, the fix is to reserve the strip's slot, which is a presentation decision that sits with feat(native-chat): the background-tasks strip says what is running #19311.

  6. A foreground task_started with no turn ever following still leaves a phantom row. The turn-ordinal redesign was assessed and rejected: that signal is dispatch-correlation bookkeeping and is false by design for undispatched turns, so gating on it would either switch the feature off or make the phantom permanent.

Readiness checklist: PASS, no P0/P1, nothing required before merge. Not merging — leaving that to you.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Pin the empty-roster mid-turn gap — the new empties only between one task retiring and the next starting test documents that the strip blanks only in the truthful gap between a task's own terminal frame and the next task_started, and that backgrounded work spanning the same gap keeps the roster open.
  • Pin foreground settlement on turn start — the new settles a previous turn the way the subagent roster settles it test documents that a foreground child with no result frame is settled by the next turn's startsTurn, while a backgrounded sibling survives untouched.

Both additions assert exact states (toBeNull / toEqual) and fail on the regressions they document; the tracker suite passes 23/23.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

#19311 landed the background-tasks strip rewrite this branch overlapped with.
Both sides had independently removed the mid-turn suppression, so the shared
view file conflicted loudly rather than auto-merging wrong.

Resolved toward main wherever main was richer, keeping only what this branch
adds that main does not have:

- structured-session-background-tasks-view.ts takes main's shape whole
  (`show` mounts mid-turn, `isMonitoring` stays idle-only for the animated
  indicator and conversation commands). This branch's mid-turn contribution
  lives in the producers, not here.
- claude-background-task-tracker.ts rebuilt from main's version — main moved
  its frame helpers out — with this branch's semantics re-applied: `liveInTurn`
  and its settle on `result`/turn start, aggregate-roster authority scoped to
  the backgrounded class it enumerates, terminal evidence kept for ids a roster
  never lists, and retained rows merged in place with the stalest evicted.
- `stoppable` folded into main's shared backgroundTaskFieldsEqual. Taking
  main's reducer helper without that would have dropped the comparison
  silently, and a row losing its stop would be judged equal and never
  republished.
- The strip component takes main's rewrite; only the per-row stop gate is
  re-applied, as an extra condition on main's settled check.
- native-chat-background-task-kinds.tsx is deleted: main's roster module
  already owns kind labels and glyphs, and keeping both would leave a dead
  second vocabulary. NativeChatToolIcon's slot export is reverted with it.

agent-session-wire.ts reached 301 of its 300-line budget, so the background-task
wire block moved VERBATIM into agent-session-background-task-wire.ts, re-exported
so every existing import path still resolves. No max-lines disable, no ratchet bump.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The merge with #19311 reverted this branch's per-kind row naming — see below.

Reviewed changes

Since the prior review at 00a9a138, the branch merged origin/main (bringing in #19311's settled-task roster) and reconciled its live-foreground / row-stop machinery against it:

  • Merged #19311's settled-task roster — settledTasks and the name / state / startedAt / totalTokens row fields arrive through the new agent-session-background-task-wire.ts and the ClaudeSettledBackgroundTasks retention split.
  • Kept stoppable across the wire split — agentSessionBackgroundTasksEqual (and the client reducer's backgroundTaskStatesEqual) now compare stoppable, and claudeBackgroundTaskDetail still emits stoppable: false for foreground rows so the strip still withholds their Stop.
  • Wove liveInTurn / settleForegroundTasks into the settle lifecycle — foreground rows stay turn-scoped, settled rows stay backgrounded-only (so the capability projection never sees an unstoppable settled row), and the row-stop capability stays registered across RUNTIME_CAPABILITIES, remoteRuntimeClientCapabilities, both ipc/runtime.ts paths, and the web router.

⚠️ Merge reverted the "name each row by kind" naming

The merge replaced this branch's native-chat-background-task-kinds module with #19311's background-task-roster.ts, and with it the old labels and glyphs. backgroundTaskKindLabel now falls back to Background agent / Background command / Background workflow / Background monitor instead of the Subagent / Shell command / Workflow / Monitor this branch introduced, and glyphs draw from direct lucide-react imports rather than the shared NativeChatToolIconName table — so the PR's title ("name each row by kind") and its body's Subagent / Shell command claims no longer describe the shipped UI.

Technical details
# Reconcile the kind-label naming lost in the #19311 merge

## Affected sites
- `src/renderer/src/i18n/locales/en.json` — `components.native-chat.backgroundTasks.agent`/`command`/`workflow`/`monitor` reverted from `Subagent`/`Shell command`/`Workflow`/`Monitor` (this branch, `00a9a138`) to `Background agent`/`Background command`/`Background workflow`/`Background monitor` (#19311).
- `src/renderer/src/components/native-chat/background-task-roster.ts:38` — `backgroundTaskKindLabel` is the description-less row fallback; it now returns the generic `Background <kind>` labels.
- `src/renderer/src/components/native-chat/NativeChatBackgroundTasksStatus.tsx:48` — `KIND_ICONS` uses direct lucide imports (agent `Bot`, workflow `Workflow`, unknown `CircleHelp`); this branch resolved those through the shared `NativeChatToolIconName` table (`list-checks`, `wrench`).
- `src/renderer/src/components/native-chat/native-chat-background-task-kinds.tsx` — deleted by the merge (no stale references remain).

## Required outcome
- Either re-apply the `Subagent` / `Shell command` / `Workflow` / `Monitor` kind labels to `backgroundTaskKindLabel`, or accept #19311's naming and update the PR title/body so they no longer claim "name each row by kind".

## Open questions for the human
- Which naming is canonical? #19311's group headers (`Agents` / `Shell` / `Monitors` / `Workflows`) already read by kind; the singular kind-label fallback (`Subagent` vs `Background agent`) is the only point of divergence.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Ruling on follow-up 5 — the mid-turn blank strip is accepted as-is

Decision: this is fine, and no fix is wanted. The strip going blank between sequential subagents is correct, because that is what the model actually does — after a child returns, the parent is thinking about what to spawn next, and during that window nothing is running. An empty strip is the honest rendering of an empty roster.

This closes the item rather than deferring it. Specifically:

  • Not a defect, and already proven so rather than argued: the roster empties on the provider's own task_notification(A, completed), and B does not exist until its own task_started. Every path into finish() is provider-driven — no timer, no turn-based sweep — so nothing is retired early or dropped and re-admitted late.
  • The duration is model latency, not a code property. The measured 4.91–6.97s is one real observation of how long the parent took to decide, not a constant. There is no number in the code to tune.
  • It pre-dates this PR — finish() and the details.length > 0 gate are byte-identical to the branch's original head, and the renderer mount path is unchanged.
  • It only occurs on pure sequential chains. A parallel fan-out never empties the roster, and any backgrounded shell spanning the gap holds the strip open.

The two obvious "fixes" were correctly rejected as worse: a debounce would display finished work as though it were live, and keeping the strip mounted on an empty roster renders "Task details are unavailable for this session."

Reserving the strip's slot to stop the transcript resizing remains a possible presentation change, but it is cosmetic and explicitly not required here. Please do not re-open this in a later review loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant