fix(core): prevent TCP chunk escape sequence breakage in InputParser#1964
fix(core): prevent TCP chunk escape sequence breakage in InputParser#1964ionfwsrijan wants to merge 2 commits into
Conversation
|
Warning Review limit reached
Next review available in: 32 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughEscape-key parsing in InputParser.ts was refactored to use a new ChangesEscape Timeout Consolidation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/core/src/input/InputParser.ts (1)
203-207: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winAdd the escape timeout in
packages/core/src/input/InputParser.ts:203-207.
When the first chunk starts with\x1bbut already has more bytes,_tryParseEscape()can leave_escapeBufferpopulated without scheduling_startEscapeTimeout(), so a stalled sequence can keep swallowing later keystrokes.Proposed fix
if (str.startsWith('\x1b')) { this._escapeBuffer = data; this._tryParseEscape(); + if (this._escapeBuffer.length > 0) { + this._startEscapeTimeout(); + } return; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/input/InputParser.ts` around lines 203 - 207, The escape-sequence handling in InputParser._tryParseEscape can leave _escapeBuffer set without starting the escape timeout when the first chunk begins with \x1b and already contains more bytes. Update the early escape branch in InputParser to schedule _startEscapeTimeout() whenever _escapeBuffer is populated from that path, so stalled sequences will still time out and stop swallowing later keystrokes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/core/src/input/InputParser.ts`:
- Around line 314-336: Update the escape-sequence tests to match the new 500ms
behavior in InputParser._startEscapeTimeout so they still cover the standalone
Escape path; replace the existing 200ms/250ms timing in the relevant tests with
500ms-safe advances. Also extract the hardcoded 500 in _startEscapeTimeout into
a shared ESCAPE_TIMEOUT_MS constant (ideally reused with the paste timeout) so
the timeout value stays consistent across implementation and tests.
---
Outside diff comments:
In `@packages/core/src/input/InputParser.ts`:
- Around line 203-207: The escape-sequence handling in
InputParser._tryParseEscape can leave _escapeBuffer set without starting the
escape timeout when the first chunk begins with \x1b and already contains more
bytes. Update the early escape branch in InputParser to schedule
_startEscapeTimeout() whenever _escapeBuffer is populated from that path, so
stalled sequences will still time out and stop swallowing later keystrokes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: ef502fc8-bdbf-45bf-a39a-889bd73227bf
📒 Files selected for processing (1)
packages/core/src/input/InputParser.ts
…IMEOUT_MS constant
d119a7f to
92bd707
Compare
|
@Karanjot786 Please review this |
Fix: InputParser TCP chunk escape sequence breakage
Changes
packages/core/src/input/InputParser.ts_startEscapeTimeout()method that uses a 500ms timeout.Fixes
Closes #1957
Summary by CodeRabbit