Skip to content

feat(sidebar): show native-chat subagents as sidebar child rows, like CLI agents already do - #19807

Merged
brennanb2025 merged 3 commits into
mainfrom
brennanb2025/native-chat-sidebar-subagents
Sep 10, 2026
Merged

brennanb2025 merged 3 commits into
mainfrom
brennanb2025/native-chat-sidebar-subagents

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​207 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​207
Prod 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​131 $\color{#cf222e}{\Huge{\mathbf{−}}}$​35 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​96

What this does, in one line

Native-chat subagents now appear in the left worktree sidebar exactly the way CLI agent subagents already do — as indented child rows under their session row.

Why it needs a PR at all

The sidebar has always drawn indented subagent rows. Spawn a subagent from a CLI agent session and you get one today: the agent reports its children through agent hooks into AgentStatusEntry.subagents, and buildSubagentChildRows() renders them.

Native-chat sessions produced nothing there. A Claude chat that fans out to three subagents showed a single flat session row with no children, because nothing was writing that field for structured sessions.

The approach: feed the existing architecture, don't build a second one

This adds no new sidebar concept, no parallel row type, and no second rendering path. It writes into the same field the hook path already uses:

const subagents = subagentSnapshotsFromTasks(summary.backgroundTasks)
...(subagents ? { subagents, subagentObservation: observation } : {})

AgentStatusEntry.subagents is documented in shared/agent-status-types.ts as "Live in-process subagents/teammates of this pane's session … the sidebar derives indented child rows from it." Structured sessions simply become a second producer for it.

So the rows a native-chat fan-out draws are the same rows, from the same builder, styled identically to the ones a CLI agent's subagents draw. Nothing downstream can tell the two producers apart, which is the point.

Kinds stay distinct on the way in — a backgrounded shell is not a subagent, so only agent-kind tasks map across.

Scope

Sidebar only. The chat strip is #19311 and #19705, both merged. Three surfaces now, one shared carrier each: in-chat transcript rows, the strip above the composer, and the sidebar.

Children carry an observation: the renderer status feed confirms sessions per connection, so after a stream ends and reconnects a child cannot keep asserting live from a stream that is gone. It reads unverifiable until the new connection reconfirms it. Loss of contact is never exit — no synonyms, per docs/reference/ssh-execution-boundary.md.

Files

  • StructuredAgentSessionStatusBridge.tsx / .test.tsx — the mapping and its two tests
  • runtime/structured-agent-session-status-feed.ts / .test.ts — per-connection confirmation (getSessionObservation)
  • sidebar/worktree-subagent-child-rows.ts — the existing shared row builder; the only change is that row state honours the observation, so it stays one builder for both producers rather than branching on where a subagent came from
  • store/slices/agent-status-contract.ts, store/slices/agent-status-live-entry-builder.ts, shared/agent-status-types.ts — subagentObservation plumbing

Verification

Renderer + shared surface: 1638 files passed / 1644, 16220 tests passed / 117 skipped. Typecheck, audit:code-quality:native, audit:code-quality:type-aware, check:max-lines-ratchet, check-react-doctor-changed.mjs and check-changed-code-quality.mjs all clean (0 new findings across 34 changed files).

@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

One correctness regression on the new unverifiable child path: a subagent child that goes unverifiable still reports a "done" completion timestamp, which asserts the exit this PR's observation exists to withhold. See the inline comment.

Reviewed changes

  • Status-feed observation — the feed now tracks confirmedSessions per connection and exposes getSessionObservation, clearing confirmation on stream end/error/close/reject and teardown; fenceCandidateAndReconnect is folded into loseConnection.
  • Background-task → subagent mapping — StructuredAgentSessionStatusBridge maps agent-kind backgroundTasks into AgentStatusEntry.subagents, with the live/unverifiable observation attached only when children exist.
  • Child-row rendering — buildSubagentChildRows honours subagentObservation, decaying unverifiable children to unverifiable rather than idle, while hook rows keep parentIsFresh.
  • Plumbing — subagentObservation threaded through agent-status-contract.ts, agent-status-live-entry-builder.ts, and agent-status-types.ts (renderer-local, absent on hook rows).

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

@brennanb2025
brennanb2025 force-pushed the brennanb2025/native-chat-sidebar-subagents branch 2 times, most recently from 7d04881 to 548e9b3 Compare September 10, 2026 06:54
@brennanb2025
brennanb2025 changed the base branch from brennanb2025/native-chat-subagent-hud to main September 10, 2026 06:55
@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

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: 33bbb80b-f046-4dad-b6fa-4801ab09798b

📥 Commits

Reviewing files that changed from the base of the PR and between 548e9b3 and c5bdacc.

📒 Files selected for processing (9)
  • src/renderer/src/components/dashboard-popout/dashboard-agent-status-patch.test.ts
  • src/renderer/src/components/dashboard-popout/dashboard-agent-status-patch.ts
  • src/renderer/src/components/dashboard/agent-finished-timestamp.test.ts
  • src/renderer/src/components/dashboard/agent-finished-timestamp.ts
  • 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/shared/agent-status-types.test.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.


📝 Walkthrough

Walkthrough

The status feed now tracks whether each session is confirmed by the current stream. The bridge projects valid agent background tasks into bounded subagent snapshots and propagates observation metadata through the store. Sidebar child rows use live, unverifiable, or legacy freshness state. Tests cover task projection, roster changes, disconnection, reconnection, ignored late events, and subscription failures.

Merge Risk: ⚪ Minimal · up to c5bda

The change adds native-chat subagent rows and safely marks them unverifiable across connection loss. The supplied test and quality checks pass, so the change is ready to merge.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 13 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description clearly explains the change, motivation, implementation approach, scope, and verification results. However, it omits the required Linked Issue section and link, and it does not provide… Add the required Linked Issue section with an issue reference. Add before-and-after screenshots or a video, or write N/A with a reason if visual proof is not applicable. Complete the Testing, AI Disclosure, Review, Agent skill upstream boun…
✅ 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 and concisely describes the main change: showing native-chat subagents as sidebar child rows.
Full details: Description check

Explanation

The description clearly explains the change, motivation, implementation approach, scope, and verification results. However, it omits the required Linked Issue section and link, and it does not provide the required visual proof or an explicit N/A explanation for this UI behavior change. Several template sections and checklist confirmations are also missing.

Resolution

Add the required Linked Issue section with an issue reference. Add before-and-after screenshots or a video, or write N/A with a reason if visual proof is not applicable. Complete the Testing, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections as applicable.

  • 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.

Merge Sim added 3 commits September 10, 2026 11:09
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
brennanb2025 force-pushed the brennanb2025/native-chat-sidebar-subagents branch from 548e9b3 to c5bdacc Compare September 10, 2026 18:35

@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

  • Widened the done-timestamp exemption — lastEnteredDoneAt now returns null for every non-done subagent row, so an unverifiable child falls through to started-at instead of reporting a synthetic completion (addresses the prior review).
  • Preserved per-task unverifiable verdicts — subagentStateFromTask maps unverifiable background tasks to an unverifiable subagent state (previously collapsed to idle), and buildSubagentChildRows renders it independently of connection observation.
  • Kept the pop-out wire vocabulary safe — patchDashboardSnapshotFromAgentStatus now projects subagent dotState through dashboardCardDotState, mapping unverifiable → idle exactly as groupSubagentsByParentPaneKey does.
  • Widened the subagent-state vocabulary — AgentSubagentState and normalizeSubagentSnapshot admit unverifiable, with a regression test at each touched site.

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

CLEAN after adversarial review and fix/re-review loops. The underlying omission was the renderer projection: the host already owned and published native-chat backgroundTasks, but the sidebar bridge did not map agent-kind tasks into the existing AgentStatusEntry.subagents carrier. The final implementation reuses that carrier and the existing buildSubagentChildRows() renderer; follow-up fixes also prevent a synthetic done timestamp on unverifiable children and preserve task-level unverifiable instead of collapsing it to idle.

Validation passed: 199 targeted tests in the final review pass, tc:web, the Node TypeScript check, changed-code quality with zero findings across all 13 changed files, runtime English-catalog verification, and the required GitHub checks (including package, Windows package, static analysis, typecheck, and all 8 test shards). Hidden Electron/CDP validation at exact HEAD c5bdacce1e exercised a real native-chat flow: after the parent stopped, the child remained working; backing state reported parent done, structuredHostOwned: true, live subagent observation, and child working. Direct DOM proof found one level-2 child 17px right and 28px below its level-1 parent, with the expected 12px margin, 4px padding, and 1px lineage border.

Native-chat subagent rendered beneath its parent in the left worktree sidebar

Remaining scope note: I did not expand the pre-existing delivery gap for an already-open dashboard pop-out; this PR’s left-sidebar path works end to end, while pop-out delivery belongs in a separate change. Electron evidence covered macOS/dark theme and the working-child state; normal child completion plus waiting, blocked, and unverifiable UI states remain unit-tested rather than manually exercised here.

@brennanb2025 brennanb2025 changed the title feat(sidebar): indent native-chat subagents under their session row feat(sidebar): show native-chat subagents as sidebar child rows, like CLI agents already do Sep 10, 2026
@brennanb2025
brennanb2025 merged commit 4408fe8 into main Sep 10, 2026
28 checks passed
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