Skip to content

fix: restore the full sidebar agent row for structured native chat - #19137

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/acornworm
Sep 6, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/acornworm

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​283 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​280
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​126 $\color{#cf222e}{\Huge{\mathbf{−}}}$​11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​115

What

The worktree sidebar row for a structured Claude/Codex chat showed far less than the equivalent hook-reported row. It read Claude Chat - Claude — the tab title, then the agent-type label the row falls back to when it has nothing else — with no model badge and no sign of what the agent was doing.

Why

projectStructuredAgentSessionStatusSummary fed the sidebar only three things: status, latestPrompt, and (client-side) the agent type. A hook-reported row also carries model, toolName/toolInput, and lastAssistantMessage, which is what getCompactAgentSecondary and DashboardAgentRow render in the secondary slot and the model badge. With none of them present, every structured row degraded to formatAgentTypeLabel(agentType).

How

  • src/shared/structured-agent-session-projection.ts — the shared projection now also derives from the journal:
    • toolName / toolInput from the tool call the live turn is inside, previewed with describeToolInput (the same previewer native chat's "Running …" line uses). The backward scan stops at the turn's own lifecycle row, and the fields are only emitted while status === 'working' — the rule showsAgentToolPreview already enforces on the render side — so an abandoned running call from a crashed turn can never be reported as live work.
    • lastAssistantMessage from the newest assistant item that has prose; tool-only assistant items are skipped rather than blanking the row.
  • src/shared/agent-session-wire.ts — four additive optional fields on AgentSessionStatusSummary.
  • structured-agent-session-status-feed.ts — model comes from the record's acknowledged options (the journal has none), and summariesEqual compares the new fields; without that a tool boundary is deduped away as an unchanged projection.
  • StructuredAgentSessionStatusBridge.tsx — passes all four into the agent-status entry, with the write guard extended to match. The model check reads "only a reported model can differ", because the entry builder carries the last known model forward.

A working structured chat now reads <title> - Read: src/foo.ts with a model badge; a settled one reads <title> - <what the agent said>.

Bound on the assistant line

It is capped at the shared 200-char preview rather than the hook field's 8 KB body. A streamed reply re-projects the summary on every journal checkpoint (geometric gate + 60 ms coalescer, so tens of publications per long turn), and the row only ever renders one line of it — the frame has to stay small. Structured sessions are local-only today, so this is a client-side row preview, not a remote-bandwidth question, but the publication rate is the same either way.

Verification

  • pnpm tc green
  • pnpm run check:code-quality:changed — 0 new findings across 7 files (incl. React Doctor)
  • pnpm run audit:code-quality:native green; oxfmt clean
  • 41 tests green across the 5 affected files, plus a 65-test sweep of WorktreeCardAgents / DashboardAgentRow / local-structured-session-tabs-sync
  • Both non-obvious edits ablation-verified red: removing the summariesEqual comparison, and removing the bridge's guard comparison, each turn a new test red — the tests pin the mechanism, not just the shape

Deliberately out of scope

Two pre-existing gaps on this surface, both separate from the projection:

  1. Background tasks read as Done. Claude's tracker reports monitoring only when no foreground turn is running, which is exactly when the feed projects idle — so during a background task the sidebar contradicts the chat. Fixing it needs a backgroundTaskState dep on the feed plus its own publication edge at publishBackgroundTaskState (background-task changes deliberately don't fire the journal hook, so today they reach no status edge at all).
  2. No subagent child rows. Hook rows render indented children from entry.subagents; structured sessions would need Task tool calls tracked as lifecycle children. That's a feature, not a field.

Known minor wart: switching the model mid-session doesn't publish the status feed (performSetOption doesn't call ctx.publish()), so the badge refreshes on the next journal event rather than instantly.

The host status feed projected only state, prompt, and agent type, so a
structured Claude/Codex row fell back to the tab title and the agent-type
label where a hook-reported row shows the running tool, the agent's last
message, and the model.

Project the tool line and the newest assistant prose from the journal, and
take the model from the session record's acknowledged options. The tool scan
stops at the live turn's lifecycle row and only runs while a turn is running,
so an abandoned call from a crashed turn is never reported as live work. The
assistant line is bounded to the shared preview cap rather than the hook
field's 8 KB body: a streamed reply re-projects on every journal checkpoint,
and the row renders one line of it.
@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 546058aa-3f1e-4946-89b4-67cb9e1e12c8

📥 Commits

Reviewing files that changed from the base of the PR and between 25b9ba9 and 346c8e4.

📒 Files selected for processing (4)
  • src/main/native-chat/agent-session-wire/structured-agent-session-option-settlement.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-turns-options.ts
  • src/shared/structured-agent-session-projection.test.ts
  • src/shared/structured-agent-session-projection.ts

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


📝 Walkthrough

Walkthrough

The structured agent session status projection now includes the active tool name, described tool input, and newest assistant prose. The host status feed adds the session model and publishes changes when these fields change. The shared status summary type exposes the new optional fields. The renderer bridge maps the fields into sidebar agent state and clears tool details when the turn settles. Tests cover projection, host feed, option settlement, and renderer updates.

Merge Risk: ⚪ Minimal · up to 346c8

This change adds model, active tool, and assistant-message previews to structured chat sidebar rows. Status updates preserve an already displayed model when later updates omit it, leaving no current merge-blocking risk.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description clearly explains the problem, implementation, verification, and out-of-scope work. However, it omits the required linked issue, visual proof or an explicit N/A explanation, and the req… Add the required issue reference under Linked Issue, attach before-and-after visual proof or write N/A with a reason, complete the Testing and other required checklist sections, and include the required AI Disclosure and Agent skill upstrea…
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: restoring the complete sidebar agent row for structured native chat.
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.
Full details: Description check

Explanation

The description clearly explains the problem, implementation, verification, and out-of-scope work. However, it omits the required linked issue, visual proof or an explicit N/A explanation, and the required checklist and testing confirmations.

Resolution

Add the required issue reference under Linked Issue, attach before-and-after visual proof or write N/A with a reason, complete the Testing and other required checklist sections, and include the required AI Disclosure and Agent skill upstream boundary responses.

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

@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: f8651811-943f-4ccd-994f-d22858be5e99

📥 Commits

Reviewing files that changed from the base of the PR and between aa23747 and 25b9ba9.

📒 Files selected for processing (7)
  • 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/StructuredAgentSessionStatusBridge.test.tsx
  • src/renderer/src/components/native-chat/StructuredAgentSessionStatusBridge.tsx
  • src/shared/agent-session-wire.ts
  • src/shared/structured-agent-session-projection.test.ts
  • src/shared/structured-agent-session-projection.ts

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

agentType: tab.agentSessionAgent,
// The host projects these from the journal so the row reads like a hook-reported one:
// the running tool while a turn is live, the agent's last words once it settles.
...(summary.model ? { model: summary.model } : {}),

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

Preserve the prior model when an update omits model.

If summary.model is absent and lastAssistantMessage changes, Line 92 does not return early. Line 80 then sends a payload without model. The status entry loses its previous model when the store replaces the payload. Derive the desired model from summary.model ?? current?.model, compare against that desired value, and add a regression case with an omitted model.

Proposed fix
+  const current = store.agentStatusByPaneKey?.[paneKey]
+  const model = summary.model ?? current?.model
   const desired = {
     // ...
-    ...(summary.model ? { model: summary.model } : {}),
+    ...(model ? { model } : {}),
     // ...
   } as const
-  const current = store.agentStatusByPaneKey?.[paneKey]
   if (
     // ...
-    (summary.model === undefined || current.model === summary.model) &&
+    current.model === desired.model &&

@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

  • Shared projection enrichment — projectStructuredAgentSessionStatusSummary now derives toolName/toolInput (from the live turn's running tool call, via describeToolInput) and lastAssistantMessage (newest assistant prose, tool-only items skipped), all bounded to the same preview caps other agent-status fields use.
  • Status feed model + dedup — the host reads model from the record's acknowledged options and summariesEqual now compares the four new fields so a tool boundary is not deduped away as an unchanged projection.
  • Wire contract — four additive optional fields on AgentSessionStatusSummary, consistent with the file's remote-wire-compatibility note (every field optional to old readers).
  • Bridge handoff — the renderer passes the new fields into the agent-status entry, with the write guard matching the entry builder's carry-forward semantics (model carried, the other three cleared when absent).
  • Tests — 41 tests across the touched surfaces, with exact toEqual/toHaveLength assertions pinning the mechanism rather than the shape.

The projection, the backward scan's lifecycle-row stop, the summariesEqual/guard comparisons, and the model carry-forward in the entry builder all line up correctly; the PR is careful about frame size and documents its out-of-scope gaps and the mid-session model-switch wart.

Pullfrog  | 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 found.

Reviewed changes

  • setOption now publishes the status feed — performSetOption calls ctx.publish() after persistOptions, so a mid-session model switch reaches the sidebar row without waiting for the next journal event. Persist-then-publish ordering means the feed's record.options.model read sees the acknowledged value; the replay path returns a cached answer and never re-publishes.
  • lastAssistantMessage bounded to the latest user turn — latestStructuredAgentSessionAssistantMessage now returns '' at a user-message boundary, clearing the prior turn's prose the moment the next prompt is persisted rather than leaking it into the new turn's thinking phase.

Both changes pin their mechanism with tests that would fail if reverted (publishes an acknowledged model without waiting for journal traffic, clears the previous answer as soon as the next prompt is persisted); the touched test files (projection, status-feed, option-settlement, bridge) pass locally.

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Visual evidence for the structured native Claude sidebar row on 346c8e40300d718b9e5aed1a46b2ada2503c6711 (hidden Electron, window.api.app.getIdentity() = Orca: brennanb2025/acornworm / devRepoRoot acornworm). No before screenshot: capturing the pre-fix row would require checking out base.

Working turn — real composer send (sleep 20). Sidebar: Claude Chat - Bash: sleep 20 with haiku badge. Store: state=working, model=haiku, toolName=Bash, toolInput=sleep 20.

Working structured sidebar row with model badge and live Bash tool

Settled turn — first composer send (Read package.json…). Sidebar: Claude Chat - orca with haiku badge. Store: state=done, model=haiku, lastAssistantMessage=orca.

Settled structured sidebar row with model badge and newest assistant prose

Idle model switch (Haiku → Sonnet) updated the sidebar badge immediately (haiku → sonnet); that republish dropped lastAssistantMessage so the secondary line briefly fell back to Claude. No relevant console/app errors. Screenshots inspected: no secrets.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Final review status: ✅ land

  • Review-until-clean found and fixed two meaningful gaps in 346c8e40300d718b9e5aed1a46b2ada2503c6711: model-option changes now republish structured session status after persistence, and assistant preview projection stops at the latest user-turn boundary.
  • Verification passed: 156 affected/downstream tests, 17 focused regression tests, 13 cross-version wire tests, pnpm tc, and changed-file quality checks. GitHub CI is green across static analysis, typecheck, all test shards, cross-version compatibility, macOS/Windows packaging, and verification.
  • Hidden/background Electron validation at the exact head proved the rendered working/tool and settled/assistant sidebar states. Screenshots and scenario.
  • Performance/readiness review found no new polling, timers, subprocesses, unbounded state, platform-specific behavior, or mobile/SSH execution changes. The wire additions remain optional and backward-compatible.
  • Follow-up on the idle model-switch observation in the visual-evidence comment: a deterministic reproduction using the real store, deferred journal sink, and status feed preserved lastAssistantMessage before and after the model update. No speculative downstream retention patch was added because it could preserve stale cross-turn prose; raw status/journal capture would be needed if the UI symptom recurs.

No remaining merge blocker.

@brennanb2025
brennanb2025 merged commit c7bcfa7 into main Sep 6, 2026
28 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#19137)

* fix: restore the full sidebar agent row for structured native chat

The host status feed projected only state, prompt, and agent type, so a
structured Claude/Codex row fell back to the tab title and the agent-type
label where a hook-reported row shows the running tool, the agent's last
message, and the model.

Project the tool line and the newest assistant prose from the journal, and
take the model from the session record's acknowledged options. The tool scan
stops at the live turn's lifecycle row and only runs while a turn is running,
so an abandoned call from a crashed turn is never reported as live work. The
assistant line is bounded to the shared preview cap rather than the hook
field's 8 KB body: a streamed reply re-projects on every journal checkpoint,
and the row renders one line of it.

* fix: keep structured session status current

---------

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