Repository navigation
fix(terminal): filter focus reports after Codex history resume - #9259
Merged
brennanb2025 merged 2 commits intoJul 18, 2026
Merged
Conversation
Contributor
📝 WalkthroughWalkthroughWindows ConPTY pane initialization now detects Codex sidebar resume sessions without an initial agent status and enables suppression of native focus-report escape sequences while idle. Tests verify that 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
6 tasks
enrick-dev
pushed a commit
to enrick-dev/orca
that referenced
this pull request
Oct 15, 2026
…yai#9259) * fix(terminal): filter focus reports after Codex history resume * test(terminal): preserve focus reports outside Codex resume --------- Co-authored-by: Brennan Benson <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevents native Windows Codex history resumes from leaving literal
[I,[[I, or[Ofocus-report fragments in the idle composer.The existing Windows guard was armed by an agent
donestatus. A session resumed from Agent Session History can open directly on a completed Codex composer with focus reporting enabled but no pane status row, soESC[O/ESC[Icould still reach ConPTY. This change recognizes the explicit Codex sidebar-resume startup metadata and arms the same guard until the resumed session starts working again.Screenshots
No visual change.
Electron validation exercised the visible Agent Session History resume flow and a real focus handoff between the history search and resumed terminal. The completed Codex composer remained clean with focus reporting enabled and no agent-status row.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildAdditional focused validation:
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-connection.test.ts— 449 passedpnpm run typecheck:webpnpm exec oxlint src/renderer/src/components/terminal-pane/pty-connection.ts src/renderer/src/components/terminal-pane/pty-connection.test.tsAI Review Report
Reviewed the existing startup input ordering fix and the native Windows post-turn focus-report suppression path. The main risk was over-broadly suppressing legitimate focus events for normal shells, Cursor, WSL, SSH, or runtime-hosted terminals. The implementation is restricted to native Windows ConPTY, explicit sidebar resume requests, and Codex startup metadata with no authoritative initial status. Existing working-state transitions restore focus reports.
Cross-platform compatibility was explicitly checked. The change does not alter shortcuts, labels, paths, Git commands, shell selection, macOS/Linux behavior, SSH, WSL, or remote-runtime transport behavior. The full PTY connection test file includes the neighboring remote-safety and non-Codex focus-report coverage.
Security Audit
No new command execution, path handling, authentication, dependency, or IPC surface was introduced. The filter accepts only xterm's exact focus-in and focus-out control sequences and uses existing trusted startup telemetry. Ordinary keyboard input and terminal query replies remain unchanged.
Notes
The behavioral change is intentionally Windows ConPTY-specific. The pre-fix failure was reproduced deterministically at the PTY transport boundary; the visible corruption itself is timing-sensitive.
Reliability Evidence
terminal-input.focus-report-ownership): an idle native-Windows Codex history resume must not forward exact xterm focus-in/out reports as composer input; non-Codex resumes and fresh Codex launches must continue receiving them.?1004hactive and no pane status row, allowing literal[I/[Ofragments through ConPTY.config/reliability-gates.jsoncentry for this narrow focus-report invariant. The manifest validator passes, and the deterministic renderer-unit oracle is recorded here until a stable native-Windows Electron gate is added.