Skip to content

fix(cli): stabilize large tool output rendering#3586

Closed
chiga0 wants to merge 2 commits into
fix/main-screen-flickerfrom
codex/pr2-large-output-detail-stability
Closed

fix(cli): stabilize large tool output rendering#3586
chiga0 wants to merge 2 commits into
fix/main-screen-flickerfrom
codex/pr2-large-output-detail-stability

Conversation

@chiga0

@chiga0 chiga0 commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

This is PR2 in the TUI flicker/stability series and is intentionally stacked on #3584 (fix/main-screen-flicker). After #3584 lands, this PR can be retargeted to main.

It addresses large string tool result output that currently enters Ink layout in full and is only clipped later by MaxSizedBox. The fix now covers both explicit multi-line output and single-line output that visually wraps heavily, such as minified JSON, base64, or long logs.

Changes

  • Pre-slice string tool result output before rendering it through Ink Text.
  • Slice by terminal visual height using the available content width, not only by explicit \n line count.
  • Preserve the existing hidden-lines affordance by passing the pre-sliced hidden visual line count into MaxSizedBox.
  • Keep exact-fit output unchanged so short or height-fitting tool results do not gain a hidden-lines banner.
  • Keep ANSI live shell output, diffs, todo display, plans, and structured renderers on their existing paths.

Why This Is Separate From PR1

PR1 reduces main-screen redraw pressure and stream-token redraw frequency. This PR handles a separate class of flicker: large completed tool outputs that are too expensive before clipping. Keeping it separate makes the behavior easy to reproduce and verify with focused ToolMessage tests.

Verification

  • git diff --check
  • cd packages/cli && npx vitest run src/ui/components/messages/ToolMessage.test.tsx
  • npm run typecheck --workspace=packages/cli
  • npm run lint --workspace=packages/cli

Effect Comparison

Before screenshot/video:

TODO: attach large tool output rendering before this PR.

After screenshot/video:

TODO: attach the same scenario after this PR.

@chiga0 chiga0 force-pushed the codex/pr2-large-output-detail-stability branch from 45f516f to 39708ce Compare April 24, 2026 07:36
@chiga0

chiga0 commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #3591, which consolidates the effective PR1-PR4 TUI flicker foundation changes onto the latest main as one reviewable PR. The new PR also documents what is fixed now and what remains for follow-up Closure-A/B/C work.

@chiga0 chiga0 closed this Apr 24, 2026
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