Skip to content

feat(native-chat): compact tool runs with a bounded call list - #26285

Merged
brennanb2025 merged 1 commit into
stablyai:mainfrom
AmoabaKelvin:compact-native-chat-tool-runs
Oct 7, 2026
Merged

brennanb2025 merged 1 commit into
stablyai:mainfrom
AmoabaKelvin:compact-native-chat-tool-runs

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​336 $\color{#cf222e}{\Huge{\mathbf{−}}}$​181 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​155
Prod 18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​575 $\color{#cf222e}{\Huge{\mathbf{−}}}$​315 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​260

ELI5

When the agent runs a batch of tool calls, the chat shows one line for it, like "Ran 14 commands". Clicking that line used to dump every call's full input and output into the page, so the page got very long, especially while the agent was still working. Now it opens a short, tidy list you can scroll inside, and you click a single call to see what it produced.

What Changed

Before

  • Opening a batch showed every call with its raw input (JSON) and its output, all expanded at once. A batch of a dozen calls could add thousands of pixels to the page, and it kept growing while the agent worked.
  • Rows inside a turn were far apart and unevenly spaced: 32px under "Worked for", 20px after a batch, 12px before one.
  • Opening and closing anything jumped.

After

  • Opening a batch lists one line per call. The list sits in a box that scrolls on its own, with faded edges when there is more above or below. The box is about eleven rows tall, grows to make room for a detail you open, and stops at half the window height.
  • While the agent is working, an open batch stays on its newest call. Scroll up and it stops following; scroll back to the bottom and it resumes. If you scroll the transcript away and come back, the batch is where you left it. Closing it resets that.
  • Clicking a call opens what it produced, not the arguments it was given. A command that had to be shortened on its line is shown in full above its output. An edit that has not been applied yet opens to the change it proposes.
  • Command rows are plain text and no longer repeat "Ran" under a header that already says so. Each row's chevron sits at the right edge. A failed call's icon is tinted red.
  • Every gap between "Worked for", a batch line and the text around it is 8px.
  • Batches, call details, diffs and thoughts open and close with a short height animation, which is off under the reduced-motion setting.

Mechanism

  • The batch's member list moved into its own component, mounted only while the batch is open, inside a scroll container with a capped height. A resize observer adds the height of opened details to the cap through a CSS variable.
  • The scroll position and "is following" state of each batch are stored next to its open/closed state, so they survive the row being unmounted by list virtualization, and are dropped when the batch is closed.
  • A call's row no longer renders its input. Whether a row can be opened is decided by the same function that produces what the opened row shows.
  • The transcript marks a row whose turn continues with the agent's own next step. That row sits closer to the next one and hides its hover controls, which would otherwise overlap it.
  • The shared collapsible component gained an animation="height" option, which reuses an animation already in the stylesheet.

This builds on #26048, which made thoughts part of a batch. Thoughts appear in the new list as the rows that change provides.

Why

Watching a long turn meant the page kept running away from you, and an opened batch was mostly noise: raw JSON arguments repeated what the line above already said. The goal was the behaviour of other agent chat apps, where a batch is a compact list and detail is one click further in.

Visual Proof

Before:

CleanShot.2026-10-07.at.5.59.36.PM.mp4

After:

CleanShot.2026-10-07.at.5.57.06.PM.mp4

Testing

  • Unit tests added for: the box following new work and stopping when the reader scrolls up; restoring position after the row is unmounted; forgetting it on close; rows handed in by the transcript being drawn in order among the calls; a call opening to output only; an unapplied edit opening to its change; a running command offering nothing to open; a row counting as "continuing its turn" only when the agent's next step follows.

  • Existing tests that assumed every payload opens at once were updated to open a call first.

  • Checked in the running app on macOS: the cap (288px, growing with an opened detail, stopping at half the window), the edge fades at top, middle and end, the open/close animation frame by frame, and the 8px gaps.

  • Not tested on Linux or Windows. The change is renderer-only CSS and React with no platform-specific code. Not tested over SSH; nothing here touches the host or the wire.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

An opened run drew every call's payload at full height, so live work
lengthened the page.
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

Walkthrough

Tool and diff details now use height-animated disclosures that start closed. Tool runs delegate member rendering and support bounded scrolling, remembered scroll positions, and member reveal. Transcript slots identify rows that continue a turn, and the renderer adjusts their spacing and assistant controls. Tests cover tool detail behavior, tool-run member scrolling, and transcript continuation.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to bdec5

During live work, a call list may stop following new output until the reader scrolls down. The issue is localized and can be fixed before merge or accepted as a bounded follow-up.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 56.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 26 files. (1 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 identifies the main change: compact native-chat tool runs with a bounded call list.
Description check ✅ Passed The description is detailed and covers the main template sections, including ELI5, changes, rationale, visual proof, testing, and checklist items. The Linked Issue section is missing, and the validati…
Full details: Docstring Coverage

Explanation

Docstring coverage is 56.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 26 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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: Advanced
  • Run ID: 40efc1ca-8542-49e3-8b11-b3e812abbcf9
📥 Commits

Reviewing files that changed from the base of the PR and between 80d4509 and bdec59e.

📒 Files selected for processing (29)
  • src/renderer/src/components/native-chat/NativeChatDiffCard.tsx
  • src/renderer/src/components/native-chat/NativeChatExpandable.tsx
  • src/renderer/src/components/native-chat/NativeChatMessageList.task-list-frames.test.tsx
  • src/renderer/src/components/native-chat/NativeChatMessageList.tool-stream-cost.test.tsx
  • src/renderer/src/components/native-chat/NativeChatMessageRow.tsx
  • src/renderer/src/components/native-chat/NativeChatReasoningRow.tsx
  • src/renderer/src/components/native-chat/NativeChatSubagentRun.test.tsx
  • src/renderer/src/components/native-chat/NativeChatTaskList.tsx
  • src/renderer/src/components/native-chat/NativeChatToolLine.test.tsx
  • src/renderer/src/components/native-chat/NativeChatToolLine.tsx
  • src/renderer/src/components/native-chat/NativeChatToolRun.appearance.test.tsx
  • src/renderer/src/components/native-chat/NativeChatToolRun.ask-row.test.tsx
  • src/renderer/src/components/native-chat/NativeChatToolRun.identity.test.tsx
  • src/renderer/src/components/native-chat/NativeChatToolRun.members.test.tsx
  • src/renderer/src/components/native-chat/NativeChatToolRun.test.tsx
  • src/renderer/src/components/native-chat/NativeChatToolRun.tsx
  • src/renderer/src/components/native-chat/NativeChatToolRunCallCounts.test.tsx
  • src/renderer/src/components/native-chat/NativeChatToolRunMemberList.tsx
  • src/renderer/src/components/native-chat/NativeChatToolRunMembers.tsx
  • src/renderer/src/components/native-chat/NativeChatTranscriptRow.tsx
  • src/renderer/src/components/native-chat/native-chat-appearance.css
  • src/renderer/src/components/native-chat/native-chat-disclosure-store.ts
  • src/renderer/src/components/native-chat/native-chat-edit-cards.ts
  • src/renderer/src/components/native-chat/native-chat-tool-line-label.ts
  • src/renderer/src/components/native-chat/native-chat-tool-run-members-test-support.ts
  • src/renderer/src/components/native-chat/native-chat-transcript-slots.test.ts
  • src/renderer/src/components/native-chat/native-chat-transcript-slots.ts
  • src/renderer/src/components/ui/collapsible.tsx
  • src/shared/native-chat-tool-pairing.ts
💤 Files with no reviewable changes (2)
  • src/renderer/src/components/native-chat/native-chat-edit-cards.ts
  • src/shared/native-chat-tool-pairing.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Comment on lines +91 to +111
useEffect(() => {
const scroller = scrollerRef.current
const content = contentRef.current
if (!scroller || !content || typeof ResizeObserver === 'undefined') {
return
}
let roomForDetails = 0
const observer = new ResizeObserver(() => {
const opened = openDetailHeight(content)
if (opened !== roomForDetails) {
roomForDetails = opened
// A variable, not state: a detail animating open would re-render every frame.
scroller.style.setProperty('--native-chat-opened-detail', `${opened}px`)
}
readPosition()
})
observer.observe(content)
// The box's cap moves with an opened detail, which changes what lies past its edges.
observer.observe(scroller)
return () => observer.disconnect()
}, [readPosition])

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

🔎 Supported by static analysis

🏁 Script executed:

set -eu
printf '%s\n' '--- NativeChatToolRunMembers.tsx ---'
nl -ba src/renderer/src/components/native-chat/NativeChatToolRunMembers.tsx | sed -n '1,180p'
printf '%s\n' '--- NativeChatToolLine.tsx ---'
nl -ba src/renderer/src/components/native-chat/NativeChatToolLine.tsx | sed -n '1,150p'
printf '%s\n' '--- NativeChatToolRun.tsx relevant references ---'
rg -n -C 8 -F -- 'NativeChatToolRunMembers' src/renderer/src/components/native-chat/NativeChatToolRun.tsx
printf '%s\n' '--- resize/follow/anchor references ---'
rg -n -S -- 'overflow-anchor|scrollTop|scrollHeight|followKey|max-h-64|ResizeObserver' src/renderer/src/components/native-chat src/renderer/src | head -240
printf '%s\n' '--- relevant tests ---'
nl -ba src/renderer/src/components/native-chat/NativeChatToolRun.members.test.tsx | sed -n '1,180p'
printf '%s\n' '--- base-to-head diff for member list ---'
git diff --unified=35 76d1b7bf29932f6e1edfb6b0b34d65c5c88e5f55 bdec59ef21849a4233f990d6272d7035eb224dc6 -- src/renderer/src/components/native-chat/NativeChatToolRunMembers.tsx src/renderer/src/components/native-chat/NativeChatToolLine.tsx src/renderer/src/components/native-chat/NativeChatToolRun.tsx

Repository: stablyai/orca

Length of output: 42614


🏁 Script executed:

set -eu
printf '%s\n' '--- truncateToolDetail ---'
rg -n -C 12 -F -- 'function truncateToolDetail' src/renderer/src/components/native-chat src/renderer/src
printf '%s\n' '--- truncateToolDetail references ---'
rg -n -C 8 -F -- 'truncateToolDetail' src/renderer/src/components/native-chat
printf '%s\n' '--- NativeChatExpandable ---'
rg -n -C 10 -F -- 'export function NativeChatExpandable' src/renderer/src/components/native-chat
printf '%s\n' '--- result pairing and member rendering ---'
nl -ba src/renderer/src/components/native-chat/NativeChatToolRunMemberList.tsx | sed -n '1,180p'
printf '%s\n' '--- focused tests for expandable output and live updates ---'
rg -n -C 12 -S -- 'output|expanded|ResizeObserver|followKey|live' src/renderer/src/components/native-chat/*Tool*test* src/renderer/src/components/native-chat/*Member*test* || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 178


🏁 Script executed:

set -eu
printf '%s\n' '--- native-chat-tool-summary.ts ---'
nl -ba src/renderer/src/components/native-chat/native-chat-tool-summary.ts | sed -n '1,180p'
printf '%s\n' '--- NativeChatExpandable declaration ---'
rg -n -C 12 -F -- 'NativeChatExpandable' src/renderer/src/components/native-chat/NativeChatExpandable.tsx src/renderer/src/components/native-chat/NativeChatExpandable.* || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 3961


🏁 Script executed:

set -eu
nl -ba src/shared/native-chat-tool-summary.ts | sed -n '1,220p'

Repository: stablyai/orca

Length of output: 9820


Keep the outer member list pinned when an existing result grows.

When a live run follows its end, followKey={blocks.length + asideCount} does not change when an existing paired result receives more output. truncateToolDetail allows output to grow up to 4000 characters, and the nested max-h-64 cap only limits the inner <pre>. Before that cap, the outer content can grow.

The resize callback only calls readPosition(). It does not restore the outer scroller to the new bottom. The resulting gap can disable following. Capture the previous follow state before reading the new position so a reader who scrolled away is not overridden.

Suggested fix
     const observer = new ResizeObserver(() => {
+      const wasFollowingEnd = followsEndRef.current
       const opened = openDetailHeight(content)
       if (opened !== roomForDetails) {
         roomForDetails = opened
         // A variable, not state: a detail animating open would re-render every frame.
         scroller.style.setProperty('--native-chat-opened-detail', `${opened}px`)
       }
+      if (wasFollowingEnd) {
+        scroller.scrollTop = scroller.scrollHeight
+      }
       readPosition()
     })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useEffect(() => {
const scroller = scrollerRef.current
const content = contentRef.current
if (!scroller || !content || typeof ResizeObserver === 'undefined') {
return
}
let roomForDetails = 0
const observer = new ResizeObserver(() => {
const opened = openDetailHeight(content)
if (opened !== roomForDetails) {
roomForDetails = opened
// A variable, not state: a detail animating open would re-render every frame.
scroller.style.setProperty('--native-chat-opened-detail', `${opened}px`)
}
readPosition()
})
observer.observe(content)
// The box's cap moves with an opened detail, which changes what lies past its edges.
observer.observe(scroller)
return () => observer.disconnect()
}, [readPosition])
useEffect(() => {
const scroller = scrollerRef.current
const content = contentRef.current
if (!scroller || !content || typeof ResizeObserver === 'undefined') {
return
}
let roomForDetails = 0
const observer = new ResizeObserver(() => {
const wasFollowingEnd = followsEndRef.current
const opened = openDetailHeight(content)
if (opened !== roomForDetails) {
roomForDetails = opened
// A variable, not state: a detail animating open would re-render every frame.
scroller.style.setProperty('--native-chat-opened-detail', `${opened}px`)
}
if (wasFollowingEnd) {
scroller.scrollTop = scroller.scrollHeight
}
readPosition()
})
observer.observe(content)
// The box's cap moves with an opened detail, which changes what lies past its edges.
observer.observe(scroller)
return () => observer.disconnect()
}, [readPosition])

@brennanb2025
brennanb2025 merged commit e08ba9f into stablyai:main Oct 7, 2026
32 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.

2 participants