Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe serializer now escapes strings with bounded Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The checkpoint writer now encodes strings with bounded native JSON conversion. Checkpoint content is described as unchanged, and no merge-blocking risk was found. 🚥 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
Saving a large terminal history can briefly delay input in other terminals. Checkpoints now encode text in small native JSON conversions, reducing that pause while saving the same bytes.
What Changed
The existing bounded writer replaces its character-by-character string escaping with native JSON encoding of at most 16,384 UTF-16 units per conversion. It reduces that bound near the byte limit and reuses the existing surrogate-safe splitter. Object traversal, byte limits, history trimming, saved fields and disk writes keep their current behavior.
Why
Color-dense histories made the old writer assemble many short escape strings in JavaScript. Encoding the entire checkpoint at once would allocate an oversized candidate before rejecting it. Bounded string conversions avoid both costs.
Four warmed trials through the real history manager, checkpoint writer and disk commit on macOS/Node produced identical normalized checkpoint hashes:
The color-dense fixture demonstrates a supported workload; it is not a captured user session or a reproduction of the reported Codex typing pause. Full checkpoints run on lifecycle/recovery boundaries or incremental-log overflow; routine persistence remains incremental.
A separate 48.36 MB stress fixture sampled additional heap immediately after serialization at 502.4 MB before and 52.8 MB after. This sampled point is not a peak-memory measurement. Separate processes retained the same flattened output after forced GC: 47.985 versus 47.991 MB, with identical UTF-8 buffer sizes.
Linked Issue
N/A — maintainer performance audit.
Visual Proof
N/A — saved JSON and terminal rendering remain identical. Input measurements used a background native PTY without showing or focusing a window.
Testing
176 history/checkpoint tests across 12 files passed. Another 1,697 snapshot, ownership and cross-version terminal tests passed, with one skipped. Node typecheck, full ordinary oxlint, formatting and changed-code quality passed.
Tests cover hardcoded control and surrogate JSON at chunk boundaries, exact UTF-8 caps, one-byte-below trimming, bounded conversions and huge escaped metadata rejection. Independent comparisons against the frozen original covered every UTF-16 code unit and 81 generated inputs across six cap variants, including fractional and unbounded caps. Production disk hashes matched in every input-delay trial.
Review
The implementation uses existing Node primitives and preserves checkpoint content, including terminal ownership and modes. SSH and WSL use the same serializer; no wire fields, capabilities, process ownership or workspace paths change. Timing evidence is macOS/Node only; Linux, Windows and phone performance are not claimed.
Agent skill upstream boundary
Notes
The 800-column stress fixture still delayed input by about 42 ms. This reduces encoding cost and allocation; checkpoint scheduling remains unchanged.
Checklist