Skip to content

feat(native-chat): the background-tasks strip says what is running - #19311

Merged
brennanb2025 merged 26 commits into
mainfrom
brennanb2025/native-chat-subagent-hud
Sep 10, 2026
Merged

brennanb2025 merged 26 commits into
mainfrom
brennanb2025/native-chat-subagent-hud

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1165 $\color{#cf222e}{\Huge{\mathbf{−}}}$​117 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1048
Prod 16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1166 $\color{#cf222e}{\Huge{\mathbf{−}}}$​233 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​933

ELI5

The little strip above the native-chat composer used to say "Monitoring background tasks" no matter what was running, and every row looked identical. Now it says what is actually running ("2 agents · 1 shell · 1 monitor"), each row has a real name, its own state dot, and elapsed time — and the left sidebar shows a session's subagents as indented children, the same way it already does for terminal agents.

What Changed

Strip (commit 1)

  • Additive optional wire fields on AgentSessionBackgroundTask: name, state, startedAt, plus settledTasks on AgentSessionBackgroundTaskState. All optional; an old client renders exactly today's output (settled tasks deliberately live in a separate field so the live tasks list old clients render is byte-identical).
  • backgroundTaskStatesEqual in the shared reducer now compares the new fields (via a shared agentSessionBackgroundTasksEqual), so a publish whose only change is a task's state is applied instead of dropped.
  • Header counts by kind, lists states within a kind, and every variant in the signed-off mock is pinned by a unit test. Past 3 kind segments — or when the strip's own border-box (ResizeObserver, live root font size, viewport only as pre-measurement stand-in) is under 24rem — it falls back to an honest total (7 background tasks), never a partial enumeration, and any lossy header leaves the strip expandable.
  • Rows group by kind (Agents / Shell / Monitors / Workflows / Tasks), stable-sorted first-seen-then-id, with kind icon, per-row AgentStateDot, resolved name (description → name → kind label, rejecting empty/placeholder), elapsed meta (ticking only while visible, via the shared visibility-gated useNow clock), and the existing Stop / stop-all behavior. unknown keeps a row and counts toward the total.
  • Claude producer (claude-background-task-tracker.ts): carries name (agent_type/subagent_type), maps patch.status to a run state (pending|running|paused→working, completed→done, failed→blocked, killed|stopped→idle), stamps first-seen startedAt (preserved across updates and aggregate roster replacement), and re-derives classification per transition. An unreadable patch leaves the task open — never settled as finished.
  • Turn gating: the tracker no longer zeroes its roster during a foreground turn (host gate removed); the client renders the strip whenever it has contents, and the idle-only flag now gates only the animated monitoring indicator + conversation-command blocking (client gate kept, scope narrowed).
  • Terminal lifecycle exit condition: settled tasks render only beside still-live work and are flushed the moment the live set empties — the strip disappears at exactly the same instant it does today, so old and new clients agree on when the strip exists.

Sidebar (commit 2)

  • Additive optional backgroundTasks on AgentSessionStatusSummary, projected by the host status feed from the provider's backgroundTaskState hook and republished on task edges (channel onPublished → feed; feed equality suppresses no-ops).
  • StructuredAgentSessionStatusBridge maps agent-kind tasks onto the sidebar's own AgentSubagentState (never widened; a backgrounded shell never lands in a subagent count) and extends its pre-write equality with the existing agentSubagentsEqual. buildSubagentChildRows() picks them up with no sidebar change.
  • parentIsFresh for a bridge entry: every feed publish restamps evidenceObservedAt, so freshness means "the host feed reported a change within the sidebar's ordinary 30-minute evidence window"; a dead feed stops restamping and children decay to idle rather than pinning working on lost contact.

Why

The strip carried five genuinely different things in one bucket, so a subagent and a backgrounded sleep 20 rendered identically, and two gates hid the strip during a turn — making a fan-out invisible exactly when it is most active. The sidebar already knew how to render subagent children; native chat just never fed it.

Linked Issue

Fixes #

Visual Proof

Follows in a comment (real-agent capture per the plan's verification section; unit tests pin every header variant from the signed-off mock in the meantime).

Testing

  • pnpm test src/main/claude src/main/native-chat/agent-session-wire src/shared/structured-agent-session-reducer.test.ts src/shared/structured-agent-session-coalescer.test.ts src/shared/agent-status-types.test.ts src/renderer/src/components/native-chat src/renderer/src/components/sidebar src/renderer/src/i18n — 562 files passed, 4925 tests passed / 5 skipped (one unrelated load-induced timeout flake in WorktreeCard.compact-hover.test.tsx, untouched by this PR and green in isolation, 27/27).
  • pnpm tc:node and pnpm tc:web — clean.
  • pnpm run check:code-quality:changed — 0 findings across 20 changed files (lint, type-aware, React Doctor).
  • New/updated suites: tracker (20), roster header/grouping/naming (18), reducer state-only-change, status feed background-tasks projection, bridge subagent publication, structured-session view strip tests.
  • Automated tests added/updated
  • Manual visual proof (to follow)

AI Disclosure

Review

Wire-compatibility notes for reviewers: both new surfaces are additive-optional per docs/reference/remote-wire-compatibility.md; settled-task retention was deliberately kept out of the tasks array so an old client's render is unchanged; host-side conversation-command admission is order-protected (the active-turn refusal precedes the monitoring refusal, so removing the tracker's turn gate changes no admission outcome mid-turn).

Agent skill upstream boundary

N/A

Merge Sim added 2 commits September 7, 2026 10:34
The strip above the composer described five different kinds of background
work as "Monitoring background tasks", with identical flat-dot rows. Now:

- Wire: additive optional `name`, `state`, `startedAt` on
  AgentSessionBackgroundTask, plus `settledTasks` on the state object so
  terminal siblings of a live fan-out stay visible without changing what
  old clients render (they keep exactly the live `tasks` list).
- Reducer equality learns the new fields, so a publish whose only change
  is a task's state is no longer judged equal and dropped.
- Header counts by kind and lists states within a kind; past three kind
  segments (or on a narrow strip, measured by its own border-box against
  the live root font size) it falls back to an honest total, never a
  partial enumeration, and the strip stays expandable whenever the header
  is lossy.
- Rows group by kind (Agents / Shell / Monitors / Workflows / Tasks),
  stable-sorted first-seen-then-id, each with a kind icon, its own state
  dot, a resolved name (description -> name -> kind label), and elapsed.
- Claude producer: task frames now carry name (agent_type/subagent_type),
  a run state mapped from patch status, and first-seen startedAt. Terminal
  statuses settle a task (completed->done, failed->blocked,
  killed/stopped->idle) instead of deleting it; settled tasks render only
  beside still-live work and flush when the last live task ends, so the
  strip exits exactly when it does today. An unreadable patch leaves a
  task open, never settled.
- Turn gating moves off the strip: the tracker no longer zeroes its
  roster during a foreground turn, and the client renders the strip
  whenever it has contents while the idle-only flag now gates just the
  animated monitoring indicator and conversation commands.
buildSubagentChildRows() has always rendered indented children from
parentEntry.subagents, and the structured-session status bridge has
always published an AgentStatusEntry for native chat — it just never
populated subagents. Connect them:

- Wire: additive optional `backgroundTasks` on AgentSessionStatusSummary
  (live tasks only), projected by the host status feed from the
  provider's backgroundTaskState hook and republished on task edges via
  the background-task channel, with the shared task equality suppressing
  no-op re-projections.
- Bridge: maps agent-kind tasks onto the sidebar's own
  AgentSubagentState (working/waiting/blocked, terminal -> idle) — kinds
  stay distinct, so a backgrounded shell never lands in a subagent
  count — and extends its pre-write equality with the existing
  agentSubagentsEqual.
- parentIsFresh for a bridge entry means "the host feed reported a
  change inside the sidebar's ordinary evidence window": every publish
  restamps evidenceObservedAt, and a dead feed stops restamping, so
  children decay to idle on lost contact instead of pinning 'working'.
@coderabbitai

coderabbitai Bot commented Sep 7, 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
📝 Walkthrough

Walkthrough

The change adds bounded Claude background-task frame readers and extends task wire data with names, states, timestamps, settled tasks, and token usage. The tracker publishes live and terminal task state without foreground-turn gating. Status feeds include provider task changes and republish task-only updates. Renderer state projects agent tasks into sidebar subagents and displays grouped, localized task rosters with elapsed time and stop controls.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to f30fc

Background-task usage near one million tokens is displayed inconsistently as 1000k instead of 1m. This is a localized presentation defect and is safe to address before merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 34.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 50 functions across 29 files. (2 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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 and concisely describes the main change: the native-chat background-task strip now identifies what is running.
Description check ✅ Passed The description is detailed, relevant, and covers the change, rationale, testing, compatibility, and review notes. The required linked issue remains incomplete as Fixes #, and visual proof is refere…
Full details: Docstring Coverage

Explanation

Docstring coverage is 34.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 50 functions across 29 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • 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.

ℹ️ No critical issues — one minor suggestion inline, plus a nitpick.

Reviewed changes

Reviewed the full 21-file diff. This is a careful change: additive-optional wire fields (name, state, startedAt, settledTasks), a turn-gate split that keeps admission semantics intact, and a sidebar bridge that reuses the existing AgentSubagentState vocabulary rather than widening it.

  • claude-background-task-frames.ts (new) — bounded field readers plus the kind/state classification split out of the tracker.
  • claude-background-task-tracker.ts — carries name/state/startedAt, retains terminal siblings on a separate settled map, and drops the foreground-turn roster gate.
  • background-task-roster.ts (new) — grouping (stable first-seen sort), name resolution, and header derivation, each variant pinned by unit tests against the signed-off mock.
  • NativeChatBackgroundTasksStatus.tsx — kind-grouped rows with per-row state dots, visibility-gated elapsed ticking, and a ResizeObserver-driven narrow fallback.
  • Status feed + StructuredAgentSessionStatusBridge.tsx — projects live backgroundTasks onto the sidebar's subagents, deduplicated by agentSessionBackgroundTasksEqual / agentSubagentsEqual.
  • Shared wire/reducer — optional fields plus agentSessionBackgroundTasksEqual so a state-only publish is applied instead of dropped.

The turn-gate removal is correct on the admission path: conversationCommandBlocked checks activeStructuredAgentSessionTurnId before the monitoring refusal (structured-conversation-command-admission.ts:26 precedes :38), so mid-turn admission outcome is unchanged. New tests assert exact header/state values (toEqual) rather than loose truthiness, so they do pin the behavior they claim.

ℹ️ Nitpicks

  • subagentStateFromTask's waiting/blocked/done/idle/unverifiable branches are unreachable for the current provider: summaryFor projects only .tasks (live), the Claude tracker routes every terminal state into settledTasks, and live states are only working/monitoring. So sidebar subagents render working for the whole fan-out and vanish on completion — a failed (blocked) or waiting child never surfaces. If showing those attention states is intended, settledTasks needs projecting too; if not, the extra branches are forward-only and could carry a note.

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Visual proof — live Claude agent, real backgrounded work (no fixtures)

Captured at head fd7f1fa8c6 on an isolated dev instance (fresh profile, CDP-driven, hidden renderer). All background tasks are real: two run_in_background Task-tool subagents plus backgrounded sleep Bash commands, driven through the actual composer of a structured Claude session in a folder workspace. Nothing was mocked or seeded.

The strip: before → after

Before (renderer files at origin/main) After (this PR)
before collapsed after collapsed
Header: "Monitoring background tasks" Header counts by kind: 2 agents · 1 shell
before expanded after expanded
One undifferentiated bullet row, no state, no elapsed AGENTS / SHELL groups, kind icon + state dot + real name + elapsed + per-row Stop

The behavior change: strip visible during an active turn

Before — turn running (Working for 6s, Running ping -c 20), backgrounded sleep 420 still live, and the strip is gone:

before hidden during turn

After — turn running (Working for 14s, Running ping -c 25, Stop button), and the strip stays up (2 shells — 2 working) with a static indicator dot (animationName: none probed) — the turn owns the voice:

after visible during turn

The A/B was done live on one session: reverting the renderer files mid-run hid the strip during a turn; restoring them brought it back inside the same running turn.

Idle monitoring, header variants, disappearance

Idle after the turn (animated indicator, probed agent-spinner-rotate), state summary in the header:

idle monitoring

Single live shell command gets the elapsed-in-header variant (1 shell command — 4m 56s):

single shell header

Strip gone ~2s after the last live task exits:

strip gone

Sidebar: native-chat subagents as child rows

Visible in the expanded "after" shot above (left sidebar): Summarize alpha notes and Summarize beta notes indented under the Claude Chat session row while live, with their own state dots, exactly like hook-reported subagents. They leave the sidebar when they settle.

Observed deviations worth knowing

  1. Settled rows never rendered. At 1s polling, a finished subagent's row was live at 2s elapsed and entirely gone on the next probe — no done/settled row from settledTasks was ever observable in the live app across four attempts. The strip also disappears ~2s after the last live task exits. If lingering settled rows are intended, the producer isn't holding them long enough to see.
  2. The instructed two-file revert doesn't produce the "before" UI — the controller shape changed, so the working revert set was three files (NativeChatStructuredSession.tsx, NativeChatBackgroundTasksStatus.tsx, use-structured-agent-session.ts). Before shots ran the old renderer against this PR's main process, so old rows still show the PR producer's task descriptions; layout/gating differences are what the contrast demonstrates.
  3. Environmental: a harness hook on this machine blocks foreground sleep, so foreground waits were staged with ping -c N 127.0.0.1 instead; backgrounded sleeps ran unaffected.

…rry usage

Real-agent QA showed settledTasks never rendered. A frame capture from the
SDK (probe against claude 2.1.261) explains it: when a backgrounded child
finishes, the producer emits `background_tasks_changed` FIRST — with the
task already absent — and only then `task_updated`/`task_notification`
with the outcome, in the same tick. The tracker's settle path looked the
task up in the live roster the aggregate had just evicted, so retention
lost the race 100% of the time.

Fix: aggregate eviction of a live backgrounded task now parks its details
in a bounded recently-removed map (new claude-settled-background-tasks.ts,
which also owns the settled roster), and the trailing terminal edge
consumes it. A removal whose outcome frame never arrives still vanishes —
nothing is guessed into a finished state. A second terminal edge for the
same task re-derives the settled state and can add final usage. The
captured sequence is replayed verbatim as a tracker test, including the
kill-at-exit tail proving the strip still exits with the last live task.

The same capture disproved the PR's earlier claim that Claude task frames
carry no usage: task_progress and task_notification both carry
usage.total_tokens. Additive optional `totalTokens` on the wire task,
covered by the shared equality; the tracker takes usage (never the
transient "Running <tool>" description) from task_progress, and rows
render the mock's "18.1k · 2m" meta — settled rows keep final usage with
no still-growing clock.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

QA finding resolved: it was (1) — retention was genuinely broken for this producer — now fixed in adef3a9, with a bonus correction.

A direct frame capture from the SDK (probe script driving claude 2.1.261 via @anthropic-ai/claude-agent-sdk 0.3.251 with two backgrounded shells + one backgrounded subagent, staggered completions) shows the real settling sequence, all three frames in the same millisecond:

background_tasks_changed  {"tasks":[<survivors only>]}                 <- aggregate FIRST, finished task already absent
task_updated              {"task_id":"bh4zn8der","patch":{"status":"completed","end_time":...}}
task_notification         {"task_id":"bh4zn8der","status":"completed","usage":{"total_tokens":18130,...}}

The tracker settled by looking the task up in the live roster — which the aggregate had evicted one frame earlier — so settledTasks lost that race every time. QA could not have observed a settled row at any polling rate; this was not a polling miss and not a too-short window.

Fix: aggregate eviction of a live backgrounded task parks its details in a bounded recently-removed map (claude-settled-background-tasks.ts); the trailing terminal edge consumes it into settledTasks. A removal with no outcome frame still vanishes — nothing is guessed into a finished state. The captured sequence is replayed verbatim as a tracker unit test, including the kill-at-exit tail proving the strip still exits with the last live task.

Correction to this PR's earlier claim: the same capture disproved "Claude task frames carry no usage" — task_progress and task_notification both carry usage.total_tokens. Added additive-optional totalTokens to the wire task (covered by the shared equality), fed from those frames (never the transient Running <tool> progress description), rendered as the mock's 18.1k · 2m row meta; settled rows keep final usage with no still-growing clock.

Gates after the fix: tracker 22/22 (incl. the replay), main/claude + agent-session-wire + reducer suites 79 files / 725 passed, tc:node/tc:web clean, changed-code quality gate 0 findings across 21 files.

@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: Team

Run ID: 941638aa-4d48-460d-a505-dbd41832f795

📥 Commits

Reviewing files that changed from the base of the PR and between fd7f1fa and adef3a9.

📒 Files selected for processing (9)
  • src/main/claude/claude-background-task-frames.ts
  • src/main/claude/claude-background-task-tracker.test.ts
  • src/main/claude/claude-background-task-tracker.ts
  • src/main/claude/claude-settled-background-tasks.ts
  • src/renderer/src/components/native-chat/NativeChatBackgroundTasksStatus.tsx
  • src/renderer/src/components/native-chat/background-task-roster.test.ts
  • src/renderer/src/components/native-chat/background-task-roster.ts
  • src/shared/agent-session-wire.ts
  • src/shared/structured-agent-session-reducer.test.ts

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Re-capture at adef3a938d — settled retention + usage meta verified live

Follow-up to my proof above (kept intact as evidence of the pre-fix behavior). Same rig: isolated dev instance, real Claude structured session, real run_in_background work, no fixtures. Staggered fan-out: backgrounded sleep 60/sleep 50, sleep 8, and one backgrounded subagent.

1. Settled rows now render mid-fan-out. "Skim alpha notes" settled (check dot, final 14k usage, no clock, no Stop) beside two still-live shells — previously this row vanished within one 1s poll:

settled row mid fanout

2. Token meta on rows, live vs settled. Live agent row ticks both figures — probed 10.6k · 10s → 10.6k · 25s over 15s — while the settled shell beside it holds no clock:

live agent token meta

On settle the same row froze at final usage and dropped the clock (10.6k · 25s → 15.1k, no elapsed, Stop gone), beside a still-ticking live sibling:

settled mix

3. The strip still exits with the last live task. Both rounds: settled rows persisted the whole window (probed every 1–5s for ~55s, header steady at 1 agent · 2 shells), and the strip was gone on the next probe ≤2s after the long sleep exited — retention does not pin it open.

Row-text timeline from the probes (round 2):

11:19:40  SETTLED:Sleep 8 seconds | live:Ping survey 10.6k · 10s Stop | live:Sleep 50 seconds 12s Stop
11:19:56  SETTLED:Ping survey 15.1k | live:Sleep 50 seconds 29s Stop | SETTLED:Sleep 8 seconds
11:20:19  strip gone (sleep 50 exited)

@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 critical issues — the evict-then-settle fix and token-usage carry are correct; one minor suggestion inline.

Reviewed changes

Reviewed the third commit (adef3a9) since the prior pullfrog review of fd7f1fa.

  • Extracted settled-task retention into a dedicated ClaudeSettledBackgroundTasks class with a recentlyRemoved buffer, so a terminal edge can settle a task the aggregate roster evicted before the outcome frame arrived (the real producer order, captured 2026-09-07).
  • Carried token usage onto the optional AgentSessionBackgroundTask.totalTokens from task_progress/task_notification frames, rendered as compact counts (18.1k) beside live rows and final usage on settled rows.
  • Extended task equality (agentSessionBackgroundTasksEqual) to compare totalTokens, so a usage-only publish is applied instead of dropped.

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

@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 critical issues — one minor cleanup suggestion inline.

Reviewed changes

Reviewed the fourth commit (f980891) since the prior pullfrog review of adef3a9.

  • Synced the runtime-required catalog to re-ship backgroundTasks.runningList, which the strip rewrite's removal of its only call site left orphaned in en.json.

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review completed at ae16d67. Two fix rounds were followed by a clean re-review and an independent ending readiness pass with no proven remaining findings.

  • Functional correctness: fixed unnecessary journal reconstruction on task progress, hidden-pane elapsed renders, false idle sidebar children after quiet periods/reconnect, and duplicate live/settled rows after authoritative task reintroduction.
  • Architectural fit: task membership stays host-owned; the existing stream owns per-session connection confirmation. Lost contact is unverifiable, quiet confirmed tasks stay live, and roster reintroduction retracts stale settlement. No polling or periodic freshness restamping was added.
  • Mechanism comparison: session-owned identity and event-driven delivery fit the design. The specific mechanisms retained here are authoritative roster replacement, bounded outcome retention, and renderer-local connection confirmation; this is not a claim that every lifecycle mechanism is equivalent.
  • Validation: 569 suites passed (4,922 tests, five skipped), node/web typechecks and changed-code quality checks passed; the independent ending review passed another 121 focused tests. Deterministic tests reduce 101 journal snapshots to one across 100 task-only updates and verify zero hidden-pane timer commits. Hidden Electron validation at this exact commit used a non-git workspace, real Claude chat Send, expansion, and individual Stop controls. Inspected full-window captures show the named child, task counts/usage/elapsed, settled rows beside live work, and final removal of strip and child.

Limits: requested Grok QA could not run because its weekly quota was exhausted; the same-model reviewer performed the Electron fallback. Historical severity counsel had three available seats and partial blind ratings due orchestration errors. Real transport-loss/31-minute behavior was unit-tested, not live-soaked; Windows/Linux/WSL/SSH, mobile/paired-web, old-version peers, approval states, light theme and narrow splits were not manually exercised. The child’s requested TaskOutput wait was unavailable in its provider context, so the capture proves lifecycle display/stop rather than successful completion of that wait workflow. The reported GitHub check was still in progress; this is not an unconditional all-platform merge approval.

Live tasks:

Final commit: live background agent and shell tasks

After Stop:

Final commit: background strip and child removed

@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: Team

Run ID: 46595f02-d033-48d0-ba50-9b889ac41d6a

📥 Commits

Reviewing files that changed from the base of the PR and between f980891 and ae16d67.

📒 Files selected for processing (16)
  • src/main/claude/claude-background-task-tracker.test.ts
  • src/main/claude/claude-background-task-tracker.ts
  • src/main/claude/claude-settled-background-tasks.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.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.tsx
  • src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.test.tsx
  • src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx
  • src/renderer/src/components/sidebar/worktree-subagent-child-rows.ts
  • src/renderer/src/runtime/structured-agent-session-status-feed.test.ts
  • src/renderer/src/runtime/structured-agent-session-status-feed.ts
  • src/renderer/src/store/slices/agent-status-contract.ts
  • src/renderer/src/store/slices/agent-status-live-entry-builder.ts
  • src/shared/agent-status-types.ts

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

...(summary.toolName ? { toolName: summary.toolName } : {}),
...(summary.toolInput ? { toolInput: summary.toolInput } : {}),
...(summary.lastAssistantMessage ? { lastAssistantMessage: summary.lastAssistantMessage } : {}),
...(subagents ? { subagents, subagentObservation: observation } : {}),

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

Exclude settled agent tasks from sidebar subagents.

A retained task with state: 'done' reaches this spread. subagentStateFromTask converts it to idle, so the sidebar keeps an idle child after the task settles. Filter terminal tasks before deriving subagents, and add a regression test for task removal on done.

@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 in this delta — the lifecycle reconciliation, journal-projection caching, and live/unverifiable subagent observation are all sound and well covered.

Reviewed changes

Reviewed the fifth commit (ae16d67) since the prior pullfrog review of f980891.

  • Reconciled the settle↔aggregate ordering — replaceAggregateRoster now forgets a re-listed id out of both retention maps, so a task an authoritative roster reports live can no longer also appear under settledTasks; pinned by a retract test.
  • Bounded host projection work — the status feed caches the journal projection by (epoch, sequence, readOnly), so task-progress publishes no longer re-sort/scan an unchanged conversation, with tests covering single-projection reuse and invalidation on journal changes and unreadability.
  • Gated the elapsed clock — the strip's useNow ticking is disabled while the pane is hidden (threading isVisible through NativeChatBackgroundTasksStatus) and catches up on reveal.
  • Made subagent freshness honest — the renderer feed tracks per-connection confirmation and the bridge writes subagentObservation, so a structured session's children decay to unverifiable (never working) on lost contact and reconfirm per connection.

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

@brennanb2025

brennanb2025 commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Electron QA at f980891 found a reproducible resumed-task defect; this is not a clean QA result.

Ran a fresh hidden Electron dev build from the QA worktree with ORCA_BACKGROUND_LAUNCH=1, isolated profile, CDP 9444 and renderer 5444. Verified listener PID 34283 belonged to this worktree's built Electron binary, its runner/profile lineage, renderer URL and app identity. Used Playwright CDP only. No fixtures or synthetic task records.

A real Claude structured session launched two Agent calls with run_in_background: true (the installed provider's Task-equivalent tool), plus real 100s and 220s background shells. The agents additionally created 45s and 150s background sleeps after the provider rejected foreground sleep, producing the observed 2 agents · 4 shells header. Both agents ultimately wrote real Markdown files.

Observed:

  • Settled Long proof writer showed its green check and final 19k count beside Short proof writer at 19.4k / 48s with Stop and live shells. Its own elapsed and Stop were absent.
  • Short proof writer advanced to 20.2k / 1m 8s, then froze at 21.2k with no elapsed or Stop. Its sidebar child cleared after its real completion notification at 23:50:23 UTC.
  • The parent finished its initial turn at about 23:49:17. At 23:50:01 its sidebar DOM explicitly showed aria-label="Done" while the indented Short proof writer child still showed Working. This directly passes the parent-turn sweep check.
  • Sidebar children showed a state dot, description, general-purpose type (truncated visually, complete in DOM title), and age, including 1m on the resumed long child.
  • The final task notification arrived at 23:53:17.156; the strip and sidebar children were absent at 23:53:19.744 and remained absent through 23:53:55. Settled retention did not pin the strip open.

Defect: same resumed task rendered twice. Long proof writer (a962f88aa82feb1c1) ended its first turn at 23:49:27 while its own background sleep continued. It resumed automatically when that sleep finished at 23:51:50. The strip displayed both its old settled 19k row and a new live row, and incorrectly counted 3 agents · 4 shells although only two agent calls were dispatched. React emitted repeated duplicate-key errors for that exact task ID. buildBackgroundTaskGroups in background-task-roster.ts concatenates live and retained settled entries without reconciling the same ID. The retained and live representations need one lifecycle owner; simply changing the React key would leave the duplicate count and contradictory states.

Terminal-edge caveat: Long proof writer disappeared from the sidebar around 23:49:30 and reappeared around 23:51:51, with the same task ID, while its own background sleep bridged those turns. Therefore this run does not establish continuous sidebar visibility until the task's ultimate completion across this pause/resume case. This is separate from the passing parent-Done retention check. The provider emitted an intermediate completion notification; its final completion was at 23:53:17. The assistant's prose inside the screenshots initially misdiagnoses this as termination and later corrects itself; those prose claims are not QA evidence.

No code changes, push, or merge. Local source and timing evidence is preserved in /tmp/orca-19311-evidence (DOM capture logs, provider lifecycle extract, journal, console log, screenshots, and real output files). This leg covers local Claude native chat in a folder project; it does not cover SSH, other providers, Stop interactions, or other platforms.

Settled agent beside live agent and shells; parent Done with live indented child. Head f980891.

settled-long-live-short.png

Live token/clock progression: Short proof writer now 20.2k / 1m 8s. Head f980891.

2026-09-07T23-50-19.999Z.png
Short proof writer has settled at 21.2k with clock/Stop removed, and its sidebar child has cleared while shells remain live. Head f980891.

2026-09-07T23-50-25.109Z.png

Same resumed Long proof writer duplicated, header incorrectly 3 agents. Head f980891.

duplicate-resumed-agent.png

Resumed sidebar child shows 1m age, while duplicate strip rows remain. Head f980891.

2026-09-07T23-53-14.626Z.png

After final real task completion: no background strip or sidebar child rows. Head f980891.

all-complete.png

Cleanup completed: isolated dev runner stopped, CDP 9444 and renderer 5444 freed, scratch profile removed. Evidence remains outside the profile.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@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: 7c84fd37-04d5-40c8-83e6-ffda5dc52872

📥 Commits

Reviewing files that changed from the base of the PR and between bba68b1 and f30fca2.

📒 Files selected for processing (31)
  • src/main/claude/claude-background-task-frames.ts
  • src/main/claude/claude-background-task-resume.test.ts
  • src/main/claude/claude-background-task-tracker.test.ts
  • src/main/claude/claude-background-task-tracker.ts
  • src/main/claude/claude-settled-background-tasks.ts
  • src/main/claude/claude-structured-session-close.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-background-task-channel.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.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/StructuredAgentSessionStatusBridge.test.tsx
  • src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx
  • src/renderer/src/components/native-chat/background-task-roster.test.ts
  • src/renderer/src/components/native-chat/background-task-roster.ts
  • src/renderer/src/components/native-chat/structured-session-background-tasks-view.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session.ts
  • src/renderer/src/components/sidebar/worktree-subagent-child-rows.ts
  • src/renderer/src/i18n/en-runtime-required.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/runtime/structured-agent-session-status-feed.test.ts
  • src/renderer/src/runtime/structured-agent-session-status-feed.ts
  • src/renderer/src/store/slices/agent-status-contract.ts
  • src/renderer/src/store/slices/agent-status-live-entry-builder.ts
  • src/shared/agent-session-wire.ts
  • src/shared/agent-status-types.ts
  • src/shared/structured-agent-session-reducer.test.ts
  • src/shared/structured-agent-session-reducer.ts
🚧 Files skipped from review as they are similar to previous changes (26)
  • src/shared/structured-agent-session-reducer.ts
  • src/renderer/src/components/native-chat/structured-session-background-tasks-view.ts
  • src/renderer/src/runtime/structured-agent-session-status-feed.test.ts
  • src/renderer/src/components/native-chat/NativeChatBackgroundTasksStatus.tsx
  • src/renderer/src/store/slices/agent-status-contract.ts
  • src/renderer/src/components/native-chat/NativeChatBackgroundTasksStatus.test.tsx
  • src/renderer/src/components/sidebar/worktree-subagent-child-rows.ts
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx
  • src/renderer/src/i18n/en-runtime-required.json
  • src/shared/agent-status-types.ts
  • src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.test.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/main/native-chat/agent-session-wire/structured-agent-session-background-task-channel.ts
  • src/renderer/src/runtime/structured-agent-session-status-feed.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-host.ts
  • src/main/claude/claude-structured-session-close.test.ts
  • src/renderer/src/store/slices/agent-status-live-entry-builder.ts
  • src/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsx
  • src/shared/structured-agent-session-reducer.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.ts
  • src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx
  • src/main/claude/claude-background-task-tracker.ts
  • src/renderer/src/components/native-chat/use-structured-agent-session.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.test.ts
  • src/main/claude/claude-background-task-tracker.test.ts
  • src/main/claude/claude-background-task-frames.ts

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

@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 in this delta.

Reviewed changes

Reviewed the commits since the prior pullfrog review of ae16d67, plus the origin/main merge that landed alongside them.

  • Added ClaudeSettledBackgroundTasks.resume(id) — transfers a settled or recently-removed task's identity (startedAt, totalTokens) back to the tracker as backgrounded: true with state: undefined, so an authoritative roster that re-lists a settled id restores the live owner instead of leaving the stale settled copy beside it.
  • Routed roster re-listing through resume — replaceAggregateRoster now calls retention.resume(id) per re-listed id (rather than forget), and upsert uses it as a fallback source, so a current-version host never publishes an id in both tasks and settledTasks.
  • Deduplicated the renderer roster by id — buildBackgroundTaskGroups folds live and settled lists through a Map (settled inserted first, live wins), so a mixed-version host that retains a previous turn beside its resumed live task renders exactly one live owner.
  • Pinned the resume path with tests — new claude-background-task-resume.test.ts covers the evict → settle → auto-resume cycle and the edge-only upsert resume, and a mixed-version roster test asserts one live owner plus kind-accurate header counts with exact startedAt/totalTokens values.
  • Reconciled the origin/main merge in use-structured-agent-session.ts, adapting the background-task view to main's message-hook extraction.

The resume semantics are sound: resume keeps the original startedAt (elapsed time survives a resume) and totalTokens (final usage isn't lost), while exposing a fresh live state so a re-listed task never renders its stale done. The tests are exact (toEqual with concrete startedAt/totalTokens), so they genuinely fail on regression rather than absorbing whatever they're handed.

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

Merge Sim added 5 commits September 8, 2026 14:07
…hat-subagent-hud

# Conflicts:
#	src/main/claude/claude-background-task-tracker.ts
#	src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.ts
#	src/renderer/src/components/native-chat/NativeChatBackgroundTasksStatus.tsx
#	src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx
#	src/renderer/src/runtime/structured-agent-session-status-feed.ts
…eardown

The status feed's projection cache calls journal.cursor(); the rename test's
stubs are cast through unknown, so the missing method only surfaced at runtime.

Teardown runs only once nothing is activated, so there is no mounted reader to
notify - clearing confirmed sessions is what prevents a stale live on reactivation.
…hat-subagent-hud

# Conflicts:
#	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/structured-session-background-tasks-view.ts
#	src/renderer/src/components/native-chat/use-structured-agent-session.ts
The header carried one aggregate state dot, so a fan-out of agents and a
monitor looked alike. Each count segment now leads with its own kind glyph;
a collapsed total spans kinds and takes none.

Monitor is the heartbeat AgentStateDot already draws for monitoring, so the
strip and the agent sidebar speak one vocabulary.

@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 in this delta — the two origin/main merges reconcile cleanly against main's Codex-background-tasks and worktree-ps work, and the teardown fix is correct.

Reviewed changes

Reviewed the three commits since the prior pullfrog review of 8a3d9e1.

  • Merged origin/main twice — reconciled conflicts in the tracker, both status feeds, the strip, and the sidebar bridge against main's claude-subagent-* readers, structuredAgentSessionStatusState, and supportsStopAll work. The net state is consistent: the tracker re-exports claudeTaskId / claudeTaskDescription for the shared readers while keeping its own taskId / taskDescription names, and the bridge adopts the shared state mapping so the sidebar row can no longer disagree with worktree ps.
  • Removed the redundant emit() from the renderer feed's stop() — teardown only runs once nothing is activated, so there is no mounted reader to notify; confirmedSessions.clear() still runs, which is what prevents a stale live on reactivation.
  • Completed the journal stubs — the rename test's fixtures now provide cursor(), which the status feed's projection cache calls unconditionally.

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

@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 — the kind-icon header is a clean visual iteration, with one minor cleanup suggestion.

Reviewed changes

Reviewed the single commit since the prior pullfrog review of d50c851.

  • Extracted the header into background-task-header-content.ts — moved the counting/phrasing (kindCountLabel, the segment cap, the state order) out of background-task-roster.ts, leaving grouping and row state behind; no import cycle.
  • Led each header segment with its kind icon — BackgroundTasksHeaderSegment is now { text, kind } so the renderer can prepend the Bot / Activity / SquareTerminal / Workflow glyph; the monitor glyph changed from Eye to Activity to match the sidebar's monitoring heartbeat. The collapsed total (spanning kinds) carries no icon, and the aggregate state dot was removed in favor of the icons plus the existing state text.
  • Updated the roster/status tests to the new segment shape, plus a new strip-header test asserting exact aria-label and icon presence.

ℹ️ Nitpicks

  • backgroundTasksDotState in background-task-roster.ts:165 lost its only production call site when the header switched to kind icons — it and its describe block in background-task-roster.test.ts are now dead. Consider deleting them, or note they are intentionally kept for a follow-up.

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

@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 in this delta — the header separator now renders in text-muted-foreground instead of the near-invisible --border divider token, and a test pins the tone plus the exact rendered text.

Reviewed changes

Reviewed the single commit since the prior pullfrog review of a970393.

  • Reseparated the collapsed header counts in a visible tone — the · between kind segments switched from text-border (the 7%-white divider color, effectively invisible at text-xs) to text-muted-foreground, with an inline comment recording why the divider token was wrong for inline text.
  • Pinned the tone with a test — a new strip-header test renders two segments (1 agent · 1 shell), finds the single separator, and asserts text-muted-foreground is present / text-border absent plus the exact header.textContent, so the fix can't silently regress.

The one open runningList thread (from f980891) predates this delta and is untouched by it, so it stays open and this remains a non-approving review.

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

The status feed's projection cache calls journal.cursor(); this stub is cast
through unknown, so the missing method only surfaced at runtime. Its journal
never changes, so a real one would hold the cursor steady.

@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 in this delta — the journal-stub fix is correct and the open runningList thread predates it.

Reviewed changes

Reviewed the single commit since the prior pullfrog review of 22077a5.

  • Gave the worktree-ps journal stub a cursor — journalWith now returns a steady cursor() ({ epoch: 1, sequence: 1 }), matching the status feed's projection cache, which calls journal.cursor() unconditionally. The stub is cast through unknown, so the missing method only surfaced at runtime in this spec; the fixed cursor is value-stable, so the (epoch, sequence, readOnly) projection-cache key compares equal on every call and the cache behaves as the commit message describes.

The one open runningList thread (from f980891) predates this delta and is untouched by it, so it stays open and this remains a non-approving review.

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron QA — fresh captures at a9703936c9

Hidden isolated dev instance (own profile /tmp/sndr11, CDP 9412, renderer 5312; ownership proved by /@fs 200-mine / 403-peer). Real structured Claude session in a folder workspace, real Task run_in_background:true subagents and real backgrounded shells of staggered durations. No fixtures, no seeded journal.

Head note: captured at a9703936c97e83ff8fd6ca083243481447c7b708. The branch moved twice while I was shooting (22077a5b93, 1e5a2af8df); everything below is at the SHA named, and the last section covers the separator commit that landed after.

1. The strip populated mid-turn — the headline

full-07.png

a9703936c9. The Working… spinner sits directly above the strip and the composer shows the Stop square, so the turn is visibly in progress in the same frame — this is the state that was previously suppressed. Header reads 3 agents · 3 shells; probe recorded working: true on every frame the strip was mounted.

2. Settled row beside live ones

strip-07.png

a9703936c9, same instant as above. Ping loopback 45 times carries a green check, no clock and no Stop, while its two shell siblings and both agent rows still tick elapsed and keep their Stop. Agent rows show 11.5k · 1m 15s style usage·elapsed. The row-level · (between tokens and elapsed) is legible; the header-level one is not — see section 4.

3. Sidebar subagent rows

C-sidebar-subagents.png

a9703936c9, cropped from the frame in section 1. Two subagent rows indented under the Claude Chat session row, itself under the workspace row. Confirmed in the DOM as well — document.querySelectorAll('.worktree-agent-lineage-children') returned 1 on those frames. (An aria snapshot shows these as absent; they are generic divs, not treeitems, so a snapshot is not evidence here.)

4. The · separator — it was not visible at this SHA, and the fix landed after

You asked specifically whether the dot is visible. At a9703936c9 it is not. Measured, not eyeballed:

class computed colour contrast vs strip bg
a9703936c9 text-border rgba(255, 255, 255, 0.07) ~1.2:1
22077a5b93 text-muted-foreground rgb(161, 161, 161) legible

Same live session, same roster, renderer file swapped through Vite HMR so only that one token changed:

D1-separator-BEFORE-a9703936c9.png

a9703936c9 — 2 agents 2 shells, no dot between them.

D2-separator-AFTER-22077a5b93.png

22077a5b93 — 2 agents · 2 shells, dot clearly present.

So the answer is: invisible at the SHA I captured, fixed by 22077a5b93, which is now on the PR head. Per-kind header icons (bot, terminal) render at both SHAs and are deliberately dimmed while the turn is running.

Not reproduced

  • Amber monitor heartbeat as a task row. A monitor row needs the provider to send task_type: 'monitor'; a Claude session driven from the composer only produces local_agent and local_bash, so I could not make one. I did not fake it. (The amber heartbeat visible on feat(native-chat): show live background work and name each row by kind #19705's header is that PR's monitoring indicator, a different element.)
  • Packaged build, Windows/WSL/Linux/SSH, mobile, mixed-version client — all untested.
  • Codex lane — this branch does not touch the Codex producer, so its strip is still blanked during the primary turn; mid-turn population here is the Claude lane only.

The strip stands alone: the sidebar mapping, its observation plumbing and the
AgentStatusEntry.subagents wiring move to a stacked follow-up. No wire field
here is sidebar-only - the strip's rows read name, state, elapsed and tokens.
@brennanb2025 brennanb2025 changed the title feat(native-chat): background-tasks strip says what is running; sidebar shows structured-session subagents feat(native-chat): the background-tasks strip says what is running Sep 9, 2026
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Split per Brennan: this PR is now strip-only. The sidebar subagent rows moved to #19807, which is stacked on this branch and should merge after it.

Removed from here (reverted to main, restored in #19807): the StructuredAgentSessionStatusBridge subagent mapping and its two tests, the renderer status feed's per-connection getSessionObservation and its test, sidebar/worktree-subagent-child-rows.ts, and the subagentObservation plumbing in agent-status-contract.ts, agent-status-live-entry-builder.ts and shared/agent-status-types.ts.

No wire field here is sidebar-only — the strip's own rows read name, state, startedAt and totalTokens, so agent-session-wire.ts stays. Verified that strip + #19807 reconstructs the pre-split tree byte-for-byte.

Affected surface on the reduced PR: 2663 files passed / 2674, 26263 tests passed / 152 skipped.

@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 critical issues — one scope observation about a wire field the split left behind.

Reviewed changes

Reviewed the single commit (df0413e) since the prior pullfrog review of 1e5a2af.

  • Split the sidebar subagent rows out of the PR — removed subagentSnapshotsFromTasks/subagentStateFromTask from the bridge, subagentObservation from AgentStatusEntry/AgentStatusPayload/buildAgentStatusLiveEntry, getSessionObservation/confirmedSessions from the renderer status feed, and reverted buildSubagentChildRows to its pre-observation form. The five renderer-side files are now byte-identical to main, and no subagentObservation/getSessionObservation/confirmedSessions reference remains anywhere.
  • Simplified the renderer feed's reconnect path — loseConnection collapsed back into fenceCandidateAndReconnect (no more confirmedSessions.clear()/unconditional emit()), and the .catch arms now distinguish active-reconnect from schedule-only, matching the pre-split owner.

ℹ️ Host still projects AgentSessionStatusSummary.backgroundTasks with no reader

The commit message asserts "No wire field here is sidebar-only", but AgentSessionStatusSummary.backgroundTasks is exactly that: the split removed its only consumer (subagentSnapshotsFromTasks(summary.backgroundTasks) in the bridge) while leaving its host-side producer intact. The status feed still declares the readBackgroundTasks dep, projects .tasks into every summary, and compares backgroundTasks in summariesEqual — so a task-state-only change now triggers a full re-broadcast and onStatusChanged for a field no client in this PR reads. (The strip reads the separate AgentSessionBackgroundTaskState from the subscribe channel, not this summary field; the task-level name/state/startedAt/totalTokens are shared and still live.)

This is not a correctness bug — it is dead wire plus wasted republish work, and it contradicts the commit's stated rationale. Either the producer (readBackgroundTasks dep, the summary projection, and the summariesEqual comparison) should have been split out too, or it is intentionally retained for the stacked follow-up to re-consume, in which case the message is misleading.

Technical details
# Dead `AgentSessionStatusSummary.backgroundTasks` producer

## Affected sites
- src/shared/agent-session-wire.ts:271 — `backgroundTasks?: AgentSessionBackgroundTask[]` on the status summary; now producer-only.
- src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.ts:47 — `readBackgroundTasks` dep.
- src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.ts:220,231 — projects `.tasks` onto the summary.
- src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.ts:64 — `agentSessionBackgroundTasksEqual(a.backgroundTasks, b.backgroundTasks)` in `summariesEqual`.

## Required outcome
- Confirm intent: either remove the summary `backgroundTasks` field + `readBackgroundTasks` dep + the `summariesEqual` comparison now, or document that they are retained for the stacked follow-up PR.

## Open questions for the human (optional)
- Will the stacked follow-up consume `AgentSessionStatusSummary.backgroundTasks`, or read the same subscribe-channel state the strip already reads?

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

Merge Sim added 4 commits September 9, 2026 18:21
A `task_progress` frame ticks a background task's `totalTokens`, which
failed the status feed's equality check and re-broadcast a full summary to
every `agentSession.subscribeStatus` subscriber — paired-web and SSH/relay
clients included — for a number no session list renders. The projection now
drops usage; tokens keep flowing on the background-task channel the strip
reads.
… state

`formatBackgroundTaskTokens` rounded before choosing the unit, so 999_950
rendered as "1000k" instead of "1m"; pick the unit from the rounded value.

`backgroundTasksDotState` has no caller on this branch or the stacked
sidebar PR, and its multi-kind branch would report 'monitoring' over an
attention state. Delete it rather than leave it to be wired up.
The strip rewrite removed its only call site, and an unreferenced key gets
promoted into the eagerly parsed boot catalog. Delete it from en.json and
regenerate en-runtime-required.json.
The row guarded the reason line on 'waiting', so an 'unverifiable' child
("no contact") and a 'blocked' one ("failed") rendered bare while the
collapsed header named exactly those reasons. `backgroundTaskStateReason`
already returns null for the non-attention states, so the guard was only
lossy — the SSH boundary requires the unverifiable verdict stay legible.

Also keys the header segments off their kind discriminant instead of the
translated display text.

@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

Reviewed the four commits since the prior pullfrog review of df0413e.

  • Stripped task usage from the summary projection — summaryFor now maps out totalTokens before projecting AgentSessionStatusSummary.backgroundTasks, so a task_progress tick no longer fails the summary equality check and re-broadcasts a full status to every remote subscriber for a number no session list renders; state changes still propagate, pinned by a test that asserts suppression on token-only change and re-broadcast on a state change.
  • Corrected token rounding — formatBackgroundTaskTokens now picks the unit before rounding (999_950 → "1m" rather than "1000k"), with boundary tests.
  • Deleted the dead dot-state helper — backgroundTasksDotState and its tests are gone, closing the prior nitpick.
  • Dropped the orphaned runningList key — removed from both en.json and en-runtime-required.json, resolving the one open thread.
  • Named the reason on every attention row — BackgroundTaskRow now renders backgroundTaskStateReason(entry.state) for waiting/unverifiable/blocked, so an SSH child that lost contact reads "no contact" instead of a silent working dot.

The unverifiable/blocked reason strings are the same ones the collapsed header already used, so the row and header now agree. The new tests use exact toEqual/toContain assertions, so they genuinely pin the behavior rather than absorbing whatever they're handed.

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

Merge Sim added 4 commits September 9, 2026 18:48
The headline counts live AND settled rows, but the state breakdown omitted
'done', so one working agent beside four settled ones read "5 agents — 1
working": the count said five, the breakdown accounted for one. Done now
appears in the muted detail (never as an emphasised segment) so the two
agree.

The single-command header also drew an elapsed clock on a settled task,
which the row already refuses as a lie about finished work.
The 1 Hz elapsed tick re-rendered the strip, and the render body regrouped,
re-sorted and re-translated every task each time only `now` had changed.
The header still derives from `now` on purpose.
Neither headline behaviour had component coverage: every strip render passed
`settledTasks={[]}`, and the `showBackgroundTasks` seam was never set true,
so the strip staying mounted through a running turn was exercised nowhere.

Adds a settled-beside-live row test (final usage kept, no clock, no stop) and
a mid-turn mount test (strip present, turn owns the voice). The background-task
tests share one session-element helper so the file stays under its line cap.
Nothing outside claude-background-task-frames.ts references it; the export
was residue from this PR's split.

@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

Reviewed the four commits since the prior pullfrog review of 817593c.

  • Fixed the header count/breakdown mismatch — HEADER_STATE_ORDER now ends in done, so a single-kind fan-out's detail (1 working, 4 done) sums to its headline (5 agents), and a settled shell command drops its still-growing elapsed clock in favor of done.
  • Memoized roster grouping — buildBackgroundTaskGroups is now wrapped in useMemo keyed on [tasks, settledTasks], so the 1 Hz elapsed tick re-renders without re-grouping, re-sorting, or re-translating the roster.
  • Covered the settled-row and mid-turn cases — new tests pin a settled sibling's final usage with no clock and no stop control, the strip staying mounted through a running turn (dimmed amber, turn owns the voice), and the header breakdown summing exactly to the count.
  • Made MAX_TASK_ID_LENGTH module-private — a no-op export tightening; the symbol has no external importers.

The header fix is the substantive piece and it is correct: settled ids are deduplicated through the owners map in buildBackgroundTaskGroups before counting, and the new test's self-consistency assertion (headline equals the summed breakdown) catches exactly the class of bug it claims to. The useMemo dependency arrays are sound because the reducer publishes stable task-array references across elapsed ticks, so the memo is effective rather than cosmetic. The new tests use exact toEqual/toContain assertions rather than loose truthiness.

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status: ready to merge

Reviewed at df0413ea8c; eleven fixes landed since, now at 3ced921c1c (27 files, +2315/-346).

What was wrong, and is now fixed

A token tick was re-broadcasting a full session summary to every remote client. totalTokens sat inside the status-summary equality check, so every task_progress frame flipped summariesEqual and pushed a complete AgentSessionStatusSummary to every agentSession.subscribeStatus subscriber — paired-web and SSH/relay included — for a number no session list renders. The summary projection now drops usage; tokens stay live on the background-task channel, which is where the strip actually reads them.

The header contradicted itself once settled rows existed. HEADER_STATE_ORDER omitted done while the headline count included settled tasks, so one working agent beside four finished ones rendered 5 agents — 1 working. The count said five and the breakdown accounted for one, on the line whose entire job is saying what is running. done is now in the order, so the breakdown sums to its own count.

Rows hid the loss-of-contact verdict. The reason line was gated on state === 'waiting', but backgroundTaskStateReason already returns null for every non-attention state — so the guard was redundant and suppressed "no contact" (unverifiable) and "failed" (blocked) on rows, while the collapsed header rendered exactly those. Every attention row now shows its reason.

Both headline behaviours were untested at the component level. All five strip renders passed settledTasks={[]}, and the showBackgroundTasks seam was never set to true — so neither settled-row retention nor "the strip stays mounted through a running turn" was exercised through the component at all. Both now have tests, each proven to fail against the unfixed code before being landed.

Also fixed: deleted the exported backgroundTasksDotState, which had no caller anywhere and which silently collapsed every mixed-kind roster to monitoring, dropping attention states — a bug waiting for whoever wired it up; deleted an orphaned i18n key the rewrite had stranded and which the diff was promoting into the eager boot catalog; stopped using translated display text as a React key; 999_950 tokens rendered 1000k instead of 1m; the header drew a growing clock on a settled shell command while the row deliberately suppressed one; and the roster is memoised, so the 1 Hz clock no longer regroups, re-sorts and re-translates every task for a tick that only moved now.

Verified rather than assumed

  • Lifecycle: nothing settles or sweeps on turn end — observe() handles a result frame by refreshing only. The captured producer ordering (aggregate eviction first, outcome frame after) is covered directly, and the retention path was traced through every interleaving I could construct without losing a settled row.
  • The split is clean: the eight files reverted by df0413ea8c are byte-identical to base — no partial revert. Every symbol the tracker now re-exports resolves to a real definition, and all three importers use those exact names.
  • Wire: no new capability, no new opcode; every field is additive-optional. Old host to new client renders no bogus elapsed or state (startedAt === undefined keeps the clock from ever starting). New host to old client is unchanged, since settled tasks were simply deleted before and nothing moved out of tasks.
  • Codex was not updated and degrades honestly: correct per-kind counts and glyphs, no elapsed, no token meta, no stop controls.
  • Stop targets: stoppableTaskIds and the rendered rows apply the identical filter over the identical map, so every row offering Stop has a resolvable target; settled rows correctly offer none.
  • No lockfile or package.json anywhere in the diff.

Gates on the final tree: typecheck 0, audit:code-quality:native 0, --type-aware 0, react-doctor on changed files 0 (26 scanned, 0 issues), all four localization verifiers 0, max-lines ratchet unchanged at 7 grandfathered with no new bypasses. Targeted suites 10/10 files, 158 tests passed; the four files carrying this PR's behaviour 4/4, 72 passed. The one failure in a 378-file sweep is claude-tui-resume-real-binary.integration.test.ts failing on ps -axo under host load — not in the diff, imports nothing changed, reproduces alone.

Two calls for you, neither a defect

  1. Settled rows never age out behind a permanently-live task. flushSettled() only fires when the live count reaches zero, and settled shares MAX_RETAINED_TASKS = 256 with recentlyRemoved. With a backgrounded dev server or a monitor holding the strip open, every subagent that finishes accumulates for the rest of the session — eventually 1 shell · 40 agents, 39 of them done. It is honest now that the breakdown sums, but it is a graveyard. The faithful fix is to split the two constants and give settled a small display-oriented cap, leaving recentlyRemoved at 256 where a large fan-out needs the headroom. I did not pick that number without the signed-off mock.

  2. AgentSessionStatusSummary.backgroundTasks has no reader on this branch — its only consumer is feat(sidebar): show native-chat subagents as sidebar child rows, like CLI agents already do #19807, which stacks here. I left it: it is a deliberate stack base and pulling it would force a rebase and re-review of an already-reviewed PR. Worth knowing that the split moved the consumer out but left the producer, so this PR's own commit message claim that no wire field here is sidebar-only is not accurate for that one field.

Separately, structured-agent-session-host.ts now sits at exactly 300/300 counted lines and agent-session-wire.ts at 299/300. The next counted line added to either reddens CI with no disable available. A duplicate import pair in the host was left in place for precisely this reason; it should ride with whatever change next splits that file.

Merge Sim added 2 commits September 9, 2026 22:03
…hat-subagent-hud

# Conflicts:
#	src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.ts
main now gates the composer's stop button on a provider-minted turnId rather
than the send-time working signal, so a test claiming a running turn has to
supply one. The controller mock hardcoded turnId null.

@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

Reviewed the two commits since the prior pullfrog review of 3ced921.

  • Merged origin/main and reconciled the status feed's projection cache — summaryFor now threads submissions and session.fence into projectStructuredAgentSessionStatusSummary, and the journal-projection cache keys on fence alongside (epoch, sequence, readOnly). This matches main's #19822 "working from the send" semantics, where a lease-fence advance can flip an unknown dispatch to answered without any journal sequence bump. The fence-driven invalidation is exercised by the merged test stops projecting an old-host unknown submission after the owner fence advances, which advances session.fence and asserts the status re-projects from working to idle.
  • Gave the mid-turn strip test a real turn — NativeChatStructuredSession.test.tsx now sources turnId / isWorking from mocks (reset to null / false in beforeEach) and the "keeps the strip mounted through a running turn" case sets them explicitly, so it genuinely exercises the turn-owns-the-voice path (dimmed monitor amber) rather than a hardcoded idle state.

The fence reconciliation is the substantive piece and it is correct: the projection result depends on the fence via hasUnansweredStructuredAgentSessionDispatch, so it must participate in the cache key, and the inline comment documents exactly why a journal lastSequence bump is not sufficient. The readBackgroundTasks projection, totalTokens stripping, and agentSessionBackgroundTasksEqual equality check all survive the merge intact.

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

@brennanb2025
brennanb2025 merged commit 2bf298d into main Sep 10, 2026
28 checks passed
brennanb2025 pushed a commit that referenced this pull request Sep 10, 2026
Stacked on #19311, which adds the background-task channel this reads. The
bridge maps agent-kind background tasks into AgentStatusEntry.subagents, and
the renderer status feed confirms per connection so a reconnect cannot leave a
child asserting live from a stream that ended.
brennanb2025 pushed a commit that referenced this pull request Sep 10, 2026
#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.
brennanb2025 pushed a commit that referenced this pull request Sep 10, 2026
Stacked on #19311, which adds the background-task channel this reads. The
bridge maps agent-kind background tasks into AgentStatusEntry.subagents, and
the renderer status feed confirms per connection so a reconnect cannot leave a
child asserting live from a stream that ended.
brennanb2025 added a commit that referenced this pull request Sep 10, 2026
… CLI agents already do (#19807)

* feat(sidebar): indent native-chat subagents under their session row

Stacked on #19311, which adds the background-task channel this reads. The
bridge maps agent-kind background tasks into AgentStatusEntry.subagents, and
the renderer status feed confirms per connection so a reconnect cannot leave a
child asserting live from a stream that ended.

* fix(sidebar): avoid completed age for unverifiable subagents

* fix(sidebar): preserve unverifiable child verdicts

---------

Co-authored-by: Merge Sim <sim@local>
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