Repository navigation
Remove repeated row copying from terminal redraw ingestion - #26118
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe terminal-tail redraw buffer now writes contiguous text spans and flushes pending text around control characters. It retains completed rows as owned strings and conditionally owns trimmed text during finalization. New tests cover redraw controls, Unicode code units, cursor behavior, slice-call counts, and heap retention. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to No merge-blocking issue is established for the terminal redraw change. Proceed with normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
ELI5
Long terminal redraws no longer make Orca rebuild an entire row for every character before delivering output.
What Changed
The retained terminal preview previously overwrote rows one code unit at a time, repeatedly copying the remaining row. It now writes each contiguous text span together and flushes it before existing newline, carriage-return, backspace and ANSI handling. Completed rows and the final partial own their retained storage so short text cannot keep a discarded large chunk alive.
Why
The synchronous ingestion path blocked on long overwritten rows: the production helper measured 10.11 ms for 16 KiB and 121.79 ms for 64 KiB. Span writes reduced those to 0.0375 and 0.163 ms. A 30-row, 160-column redraw improved 0.0996 to 0.0168 ms. The deterministic suffix-copy count falls from 32,769 to four for a 16 KiB row. This removes repeated work without changing terminal output caps, scheduling or adding a redraw classifier.
Linked Issue
Internal performance audit of delayed terminal input; related existing invariant: #14770. These measurements establish a long-row bottleneck, not the cause of every ordinary Codex typing stall.
Visual Proof
N/A — retained text and cursor results are unchanged; renderer painting, PTY input and output transport are untouched.
Testing
terminal-performance.padded-fullscreen-redrawgate, exact ANSI/UTF-16 outputs, trailing-space rewrites, copy counts and retained-memory checks.tc:node, targeted lint/format and changed-code quality passed.Review
Invariant: preview text, cursor state, transcript counts, truncation and pagination remain identical (
terminal-performance.padded-fullscreen-redraw). Failure source: synchronous per-character row copying in terminal ingestion. Oracle: exact results against the old implementation, operation counts and retained heap. Diagnostic artifacts include the benchmark JSON and deterministic regression assertions.The algorithm is shared host-side code for local, daemon, SSH and paired-runtime output. No host selection, filesystem, wire, lifecycle or folder/worktree identity changes. Native provider journeys remain outside this pure string-operation check; CI covers other operating systems.
Agent skill upstream boundary
Checklist