Skip to content

fix(native-chat): let code blocks grow to their full height - #26021

Merged
brennanb2025 merged 1 commit into
stablyai:mainfrom
AmoabaKelvin:native-chat-uncap-code-block-height
Oct 7, 2026
Merged

brennanb2025 merged 1 commit into
stablyai:mainfrom
AmoabaKelvin:native-chat-uncap-code-block-height

Conversation

@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

ELI5

Code blocks in the native chat stopped growing at about 320px tall. Anything longer scrolled inside its own small box, so reading a long snippet meant scrolling a box inside the chat you were already scrolling. Code blocks now show all of their lines.

What Changed

Before, a fenced code block in a chat message was at most 320px tall and scrolled vertically inside itself. After, the block is as tall as its code, and the chat transcript is the only thing that scrolls vertically. Long lines still scroll sideways inside the block.

The change removes the max-h-80 class from the <pre> in NativeChatCodeBlock. Every place that renders chat markdown uses that component, so assistant messages, reasoning, notices and the approval card all pick it up.

Reasoning and the approval card keep the height limit on their own outer container, so a long block there scrolls with that container. Tool output, diff cards and command previews are separate components and keep their limits.

Why

Reading code and getting an overview of it is the point of a code block, and a 320px window works against that. The cap came in with the copy button change (#20357) and nothing else depends on it.

I considered raising the cap and adding an expand toggle. Both still hide code by default and the toggle adds a control to every block, so removing the cap is the smaller change and matches what the user wants to see.

One known tradeoff. On a very tall block the copy button sits at the top and scrolls out of view with it. A sticky header would fix that, but it needs the block's markup rearranged, so I left it out of this PR.

Testing

pnpm test src/renderer/src/components/native-chat/NativeChatCodeBlock.test.tsx passes. pnpm lint and pnpm tc pass on the branch rebased onto current main.

No test added. The change is one removed class, and a test for it could only assert that the class is absent.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Review

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.

Notes

Renderer styling only. It behaves the same on macOS, Linux and Windows, for SSH and folder workspaces, and it changes nothing a client and host exchange. The mobile app does not use this component.

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)

The 320px cap made long code a scroll-within-a-scroll.
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in 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: eee11afe-1d31-4eba-844c-d64850cf4a94
📥 Commits

Reviewing files that changed from the base of the PR and between f052085 and dbd5fe8.

📒 Files selected for processing (1)
  • src/renderer/src/components/native-chat/NativeChatCodeBlock.tsx

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


📝 Walkthrough

Walkthrough

The native chat code block no longer applies a maximum height to its preformatted content. Horizontal overflow handling and the other listed styles remain unchanged.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to dbd5f

Code blocks can now grow to their full height as intended, while the surrounding transcript and constrained cards remain scrollable. No actionable merge risk is evident.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change, its reason, scope, tradeoff, and testing. It does not include the required before-and-after visual proof or the allowed N/A explanation. The Linked Issue section i… Add before-and-after screenshots or video showing the UI change. If there is truly no visual or interaction change, explain why and write exactly N/A. Add the linked issue under Fixes #, unless the maintainer exception applies.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: native chat code blocks can grow to their full height.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
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 explains the change, its reason, scope, tradeoff, and testing. It does not include the required before-and-after visual proof or the allowed N/A explanation. The Linked Issue section is also missing; the template requires an issue link for outside contributors.

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

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

@brennanb2025

Copy link
Copy Markdown
Contributor

Screenshots and review

The problem: a fenced code block in a native chat reply stopped at 320px and scrolled inside its own box, so reading a long snippet meant scrolling a small box inside the chat you were already scrolling.

What changes for you: a code block now shows every line, and only the chat scrolls up and down. Long lines still scroll sideways inside the block.

Before (main): a 60-line block stops at about 310px and scrolls inside itself

Before: code block capped with an inner scrollbar

Before: scrolled inside the capped block

After (this PR, dbd5fe8b3c7): all 60 lines show, line 1 to line 60

After: full-height code block

After: a long line still scrolls sideways

After: horizontal scroll on a long line

Review

No blocking issues. Things worth knowing:

  • Besides assistant replies and the plan notice card, your own message bubbles also use this component, so a code block you send now grows to full height too. Reasoning and the approval card still cap through their own containers. Tool output, diff cards, command previews and queued messages don't use this component.
  • The 320px cap was copied from the PR-comment renderer in Add copy button to code blocks #20357; nothing in chat depended on it. Every line was already in the page before, so rendering cost is unchanged, and the transcript's row height estimate is now closer for blocks under about 70 lines.
  • The red test / tests node 24 2/5 check was a runner shutdown ("The runner has received a shutdown signal"), with no failing test in its log. verify only failed because that shard did. A re-run should clear both.

Verified: the screenshots above, taken in a hidden build of main and of this PR on Windows, from a prepared chat containing a 60-line code block. All callers of the component, checked by reading the code.
Not verified: macOS or Linux rendering, a code block that is still streaming in, and how a block of several thousand lines lays out.

@brennanb2025
brennanb2025 merged commit b062278 into stablyai:main Oct 7, 2026
28 of 30 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