feat(cli): cap inline shell output with configurable line limit (#3508)#216
Conversation
…LM#3508) Long-running shell tool calls (`npm install`, `find /`, build logs) were rendering the full visible PTY buffer inline (~24 lines on a typical terminal). The output dominated the viewport and pushed prior context off the top. This caps inline shell output to a small window (default 5 lines, matching Claude Code's `ShellProgressMessage`). The hidden line count is surfaced via the `+N lines` ShellStatsBar indicator (ANSI streaming) or the existing MaxSizedBox overflow indicator (completed string). The focused embedded shell bypasses the cap so the user sees the full live transcript while interacting with it. Adapted from QwenLM/qwen-code QwenLM#3508. Adaptations: - Pulled ShellStatsBar into our AnsiOutput.tsx ourselves (the upstream component lived in a QwenLM#3155 prerequisite that we're not porting in full — QwenLM#3155 also brings per-tool elapsed time and OSC 9;4 tab progress bar, which Alacritty doesn't support and we don't want enough to justify the surface). - Slimmed ShellStatsBar to just the `+N lines` count; upstream's `totalBytes` (UTF-8 byte size) display is part of the broader QwenLM#3155 scope. - Compute totalLines from `displayRenderer.data.length` directly rather than via upstream's `effectiveDisplayRenderer.stats` channel (also a QwenLM#3155 thing). - Skipped upstream's `forceShowResult` bypass (no consumer in our fork) — the focused-embedded-shell bypass is enough. New setting: `ui.shellOutputMaxLines` (number, default 5). Set to 0 to disable the cap entirely. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
✨ Finishing Touches🧪 Generate unit tests (beta)
Review rate limit: 0/5 reviews remaining, refill in 4 minutes and 29 seconds. Comment |
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
Summary
Long-running shell tool calls (
npm install,find /, build logs) were rendering the full visible PTY buffer inline (~24 lines on a typical terminal). The output dominated the viewport and pushed prior context off the top.This PR caps inline shell output to a small window (default 5 lines, matching Claude Code's
ShellProgressMessage). The hidden line count is surfaced via the+N linesShellStatsBar (ANSI streaming) or the existing MaxSizedBox overflow indicator (completed string). The focused embedded shell bypasses the cap so the user sees the full live transcript while interacting with it.New setting:
ui.shellOutputMaxLines(number, default 5). Set to 0 to disable the cap entirely.Adapted from upstream QwenLM#3508
#3508's only fork-blocker was aShellStatsBarcomponent that lived in upstream's QwenLM#3155 ("tool execution progress messages"). Rather than port the full QwenLM#3155 (which also brings per-tool elapsed time and an OSC 9;4 tab progress bar — Alacritty doesn't support the latter and QwenLM#3155 is 19 files of churn), I wrote a slimShellStatsBarourselves and wired the cap directly. Total cap-specific change: ~80 LOC acrossAnsiOutput.tsx,ToolMessage.tsx,settingsSchema.ts.Adaptations:
+N lines(upstream also displays UTF-8 byte size — that's part of feat(cli): add tool execution progress messages QwenLM/qwen-code#3155's broader scope).totalLinesfromdisplayRenderer.data.lengthdirectly rather than via upstream'seffectiveDisplayRenderer.statschannel (also a feat(cli): add tool execution progress messages QwenLM/qwen-code#3155 wiring).forceShowResultbypass (no consumer in our fork yet) — the focused-embedded-shell bypass is enough.Disclosure: included partial QwenLM#3155 groundwork
This branch also picked up partial-QwenLM#3155 modifications to 6 core files (
agent-core.ts,agent-events.ts,agent-interactive.ts,coreToolScheduler.ts,shell.ts,tools.ts) from an abandoned earlier probe — runtime hooks for the tool-execution-progress feature. Typecheck clean + tests green. These are useful groundwork for a future QwenLM#3155 port but aren't strictly needed for the cap. Happy to split them off if reviewers prefer a tighter scope; otherwise they sit dormant until QwenLM#3155 lands.Test plan
npm run typecheckclean across all workspacesAnsiOutput.test.tsx+ToolMessage.test.tsx)seq 1 30; verify only the last 5 lines render with+25 linesindicator belowui.shellOutputMaxLines: 0; verify full output renders🤖 Generated with Claude Code