Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between c610ce71d5673bb1d2bfdabba52e1ef5d1b6838b and 4993842. 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe runtime adds Codex composer-readiness detection for PTY draft input. Prompt submission waits for readiness, handles cancellation and timeout errors, and revalidates PTY lifecycle and identity before writing. New tests cover readiness scanning, cleanup, terminal exit, generation changes, native-runtime ownership, and cancellation. Existing prompt-flow tests now emit Codex terminal readiness sequences. Priority: ➖ Normal 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4047e966-7f72-453c-8d6f-de61c4a3e189
📥 Commits
Reviewing files that changed from the base of the PR and between e4e54a1 and af5fd8b7f262cbc290de5c05208c75ef2bbe1d1d.
📒 Files selected for processing (2)
src/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.ts
Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review.
a7243d7 to
653becd
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Refreshed onto Review is bound to
External rereview was not rerun in this bounded patrol; this is a non-security change, so the SHA-bound source review and checks above are the publication gate. |
653becd to
c610ce7
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Codex can enable bracketed paste before the composer mounts. Wait for the composer-ready signal, abort if the PTY exits, and seed existing Codex send cases so the wait does not invent a timeout failure. Co-authored-by: Cursor <[email protected]>
Already-aborted and mid-wait Codex prompts ignored options.signal and failed as agent_composer_not_ready after 20s. Reject request_aborted on both send paths and dispose wait listeners/timers instead of racing the promise. Co-authored-by: Cursor <[email protected]>
subscribeToPtyExit invokes the listener immediately for an already-exited PTY, which settled the wait before unsubscribeExit was assigned and then registered an abort listener after reject. Bind listeners first, then clean up if the subscribe already settled. Co-authored-by: Cursor <[email protected]>
Native/Structured Chat can own a pane with no composer; waiting first turned typed refusals into agent_composer_not_ready. Existing Codex receipt and settle fixtures seed readiness only. Co-authored-by: Cursor <[email protected]>
c610ce7 to
4993842
Compare
ELI5
Codex can turn on bracketed paste before its composer is actually ready. Orca now waits for that composer signal, then pastes. If the PTY dies while waiting, the send fails instead of writing into a dead session.
What Changed
?2004h, alt-screen, bold›).options.signalinside the composer wait on both prompt paths, and dispose data/exit listeners plus quiet/hard timers on abort (including pre-aborted, buffered-ready, and PTY-exit races). Aborted waits rejectrequest_abortedinstead of waiting out the 20s timeout asagent_composer_not_ready.agentSessionPtyWriteGate.assertAdmittedpreflight on bothsendTerminalAgentPromptpaths before the composer wait. Native/Structured Chat can own the pane with no composer; waiting first hid the typed ownership refusal asagent_composer_not_ready. Per-writeassertAdmitted/assertReadmittedstill run at write time.Why
#14575 waits for Codex to redraw after paste and before Enter. That protects submit timing, but an MCP-heavy startup can redraw before that point and erase an early paste entirely. Waiting for the strong composer signal before paste closes that earlier race without changing the remote wire contract.
Linked Issue
Partially addresses #9976 (the Codex
input-missingstartup race; this PR does not implement the issue's broader delivery-state or first-turn deadline contract).Visual Proof
N/A — no visual redesign. Behavior is covered by deterministic PTY/runtime tests.
Testing
Validation is tied to
c610ce71d5673bb1d2bfdabba52e1ef5d1b6838b, based on main8f78c28248fbfa4d55fb837ab6698ac77d4e35c5.orca-runtime.test.tsumbrella, all 12 delivery-receipt tests, Structured Chat refusal/lease-transfer cases, and composer readiness/cancellation/cleanup regressions.--composite false, all 13 changed-file lint/format checks, native dependency preflight, and diff whitespace checks passed.3bf2a31f60: 8,241 files passed / 14 failed / 61 skipped; 76,586 tests passed / 41 failed / 391 skipped, 836.47 seconds. All 27 known clean-main failure names match. Thirteen additional runtime failures led to the final pre-wait ownership check and explicitly scoped fixture inputs described below; all pass in the final-SHA run. One cross-version checkout import timed out and produced a subsequent lock-file exception. The unchanged checkout file passed all 10 tests in separate candidate and clean-main reruns with no unhandled error; the full-load failure was not reproduced.Existing-test Codex readiness seeds (declared): these cases already launched
codexand would now failagent_composer_not_readybefore their original assertions. Each was given\x1b[?2004h\x1b[?1049h\x1b[1m›\x1b[0monpty-prompt/pty-bg/ the Structured Chat worker PTY only; assertions were not weakened.agent-prompt-submission-runtime.test.ts: queued receipt with existing-turn output; hook-only oldest queued receipt; one lifecycle reservation.agent-prompt-receipt-correlation.test.ts: FIFO historical lifecycle edges.worker-start-prompt-contract.test.ts: Codex harness (accepted/swallowed worker-start) and the busy-turn queued send.terminal-creation-and-readiness-part-07.spec.ts: Codex branch of composer-frame settle-before-submit.terminal-creation-and-readiness-part-08.spec.ts: late Codex render marker / fresh quiescence, and the foreground-detected Codex settle case (createTerminalwithoutlaunchAgent;getForegroundProcessreturnscodex). Original post-paste Enter-gating assertions stay.orchestration-structured-chat-lease.test.ts: onlystops a prompt when Structured Chat takes the lease between paste chunks. That case starts as TUI, so preflight admits; Codex launch identity still waits for composer before the first paste chunk. The two native-owner refusal tests (fails worker-start truthfully…,reports a real gate refusal…) are not seeded — they must keep failing immediately with typedagent_session_conflict/ zero bytes, not after a 20s composer wait.rpc/terminal-prompt-delivery-receipt.test.ts: file-localcreateHarness(agent, busy)seeds only whenagent === 'codex'. Claude and aider harnesses stay unseeded. Every receipt/dedup/queue/draft assertion is unchanged. This is a fixture adaptation: the harness already launched Codex and replaced the write controller, but never emitted composer-ready bytes, so the new pre-paste wait starved paste/Enter and the original receipt assertions never ran.createAgentPromptSubmissionRuntimeitself is not auto-seeded, so the new wait-before-write, timeout/exit, abort-during-wait, and native-owner preflight tests still observe an empty write list.Independent review cases in
orca-runtime-composer-cancellation-review.test.tswere copied with unused-import/format cleanup only; bothit.eachabort assertions (failuredefined quickly,writes === [], stillrequest_abortedafter 20s) are unchanged.Review
Cursor exact-SHA review PASS on
c610ce71d5, followed by independent Codex source review and the final checks above. The two native-owner refusal tests remain unseeded and preserve their typed refusal and zero-byte assertions. The shared prompt fixture remains unseeded, preserving readiness timeout, exit and cancellation coverage. Existing permission, generation, Enter-gating, receipt and replay assertions remain.Compatibility and Security
Send-path only;
waitForWorktreeStartupDraftis unchanged. Non-Codex agents skip the wait. Remote/SSH PTYs use the same composer signal. No new RPC method or stream opcode.AI Disclosure
Cursor ported and reviewed the rebase onto
8f78c28. Codex independently reviewed the candidate, supplied cancellation/cleanup regression cases, and ran final checks.