fix(terminal): prevent focus prefix in startup drafts - #8433
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughStartup draft paste delivery now accepts an optional PTY writer and routes draft and bracketed-paste marker writes through it, with the runtime writer as fallback. The terminal pane passes a transport-backed writer for Codex startup drafts and records accepted input once. Tests verify delivery after xterm emits CSI 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 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 |
Summary
Root cause
When Codex enabled terminal focus reporting, xterm could emit the focus-in sequence
ESC[I. That input used the pane transport queue, while the generated PR draft bypassed the queue and wrote directly to the PTY. On Windows ConPTY the writes could race, leaving the focus sequence inside the bracketed paste and exposing a literal[Ior[prefix.The startup draft now uses the same ordered, backpressured pane transport as xterm input.
Related work
This complements #8281. That PR improves Codex startup draft readiness, retry, and delivery ownership, but its startup paste still uses the direct PTY writer and does not address focus-input ordering.
Testing
pty-connection.test.ts: 422 passedagent-paste-draft.test.ts: 30 passedmainpnpm run typecheck:webpnpm run check:max-lines-ratchetgit diff --check origin/main...HEAD