Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
a8229beb-0fea-45cc-96a5-318b29954341
📒 Files selected for processing: 25
config/reliability-gates.jsoncsrc/main/ipc/pty/ipc/write-input-user-input.test.tssrc/main/runtime/agent-prompt-submission-runtime.test.tssrc/main/runtime/construction/runtime-construction-services.tssrc/main/runtime/construction/runtime-service-state.tssrc/main/runtime/orchestration-mailbox-notification-consistency.test.tssrc/main/runtime/orchestration-mailbox-notification-test-harness.tssrc/main/runtime/orchestration/mailbox-pointer-delivery-contract.tssrc/main/runtime/orchestration/mailbox-pointer-delivery.tssrc/main/runtime/orchestration/mailbox-pointer-pty-write.tssrc/main/runtime/orchestration/mailbox-pointer-stage.tssrc/main/runtime/orchestration/mailbox-pointer-state.tssrc/main/runtime/orchestration/mailbox-pointer-submit.test.tssrc/main/runtime/orchestration/mailbox-pointer-submit.tssrc/main/runtime/orchestration/terminal-authority/write-orchestration-pointer-pty.tssrc/main/runtime/rpc/terminal-prompt-delivery-receipt.test.tssrc/main/runtime/runtime-terminal-contracts.tssrc/main/runtime/terminal-automated-input-guard.tssrc/main/runtime/terminal-human-draft-admission.test.tssrc/main/runtime/terminal-run-facts-input.test.tssrc/main/runtime/terminal-run-facts.test.tssrc/main/runtime/terminal-run-facts.tssrc/main/runtime/terminal/input/terminal-agent-prompt.tssrc/main/runtime/terminal/output/terminal-visible-state.tssrc/shared/pty-write-settlement.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| const sequence = this.getPtyOutputSequence(ptyId) | ||
| const screen = await this.readVisibleTerminalState(ptyId) | ||
| guard.assertCurrent() | ||
| if ( | ||
| screen | ||
| ? screen.generation !== this.getPtyLifecycleGeneration(ptyId) || | ||
| screen.sequence < this.getPtyOutputSequence(ptyId) | ||
| : sequence !== this.getPtyOutputSequence(ptyId) | ||
| ) { | ||
| throw new Error('terminal_input_changed') | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
🔎 Supported by static analysis
-
🏁 Script executed:
set -u printf '%s\n' '--- changed file ---' nl -ba src/main/runtime/terminal/output/terminal-visible-state.ts | sed -n '1,240p' printf '%s\n' '--- related symbols ---' rg -n -F --glob '*.ts' -e 'readVisibleTerminalState' -e 'readHeadlessVisibleTerminalState' -e 'loadVisibleTerminalState' -e 'getPtyOutputSequence' -e 'outputSequence' -e 'admitTerminalAutomatedInput' -e 'captureTerminalAutomatedInputGuard' src/main src/shared tests || test "$?" -eq 1 printf '%s\n' '--- directly relevant definitions/callers ---' rg -n -F --glob '*.ts' -e 'class TerminalAutomatedInputGuard' -e 'interface RuntimeVisibleTerminalState' -e 'type RuntimeVisibleTerminalState' -e 'class Headless' -e 'writeChain' src/main src/shared tests || test "$?" -eq 1 printf '%s\n' '--- changed-file diff against requested base ---' git diff --no-ext-diff --unified=35 22a95c4efe7ecf5bf619c4259950a28d8b86a5bc bb7787666a5f79fabcde63c0875d83c7eda8a6ac -- src/main/runtime/terminal/output/terminal-visible-state.ts
Repository: stablyai/orca
Length of output: 42440
🏁 Script executed:
git status --short
Repository: stablyai/orca
Length of output: 151
🏁 Script executed:
printf '%s\n' 'awaiting prior inspection'
Repository: stablyai/orca
Length of output: 177
🏁 Script executed:
set -u printf '%s\n' '--- headless sequence ownership and ingestion ---' nl -ba src/main/runtime/terminal/output/headless-terminal-state.ts | sed -n '90,190p' nl -ba src/main/runtime/terminal/output/terminal-output-generation.ts | sed -n '150,215p' nl -ba src/main/runtime/terminal/output/pty-output-ingestion.ts | sed -n '80,155p' printf '%s\n' '--- provider snapshot publication ---' nl -ba src/main/runtime/rpc/methods/terminal/terminal-snapshot-publication.ts | sed -n '260,305p' printf '%s\n' '--- admission tests and callers ---' nl -ba src/main/runtime/terminal-human-draft-admission.test.ts | sed -n '1,430p' nl -ba src/main/runtime/orchestration/terminal-authority/write-orchestration-pointer-pty.ts | sed -n '1,100p' rg -n -F --glob '*.test.ts' -e 'terminal_input_changed' -e 'terminal_composer_occupied' -e 'admitTerminalAutomatedInput' src/main/runtime tests || test "$?" -eq 1
Repository: stablyai/orca
Length of output: 40934
🏁 Script executed:
printf '%s\n' 'pending source inspection'
Repository: stablyai/orca
Length of output: 177
🏁 Script executed:
rg -n -F -- 'state.outputSequence' src/main/runtime/terminal/output src/main/runtime nl -ba src/main/runtime/terminal/output/headless-terminal-state.ts | sed -n '180,245p' nl -ba src/main/runtime/terminal/output/terminal-output-generation.ts | sed -n '1,155p'
Repository: stablyai/orca
Length of output: 11646
Retry output-only stale reads.
admitTerminalAutomatedInput can reject valid automated input when output advances while readVisibleTerminalState is pending. Retry only for output-sequence staleness. Keep immediate rejection for input-revision changes, lifecycle changes, and recognized screen.draft values.
For provider snapshots, perform the retry after the existing snapshot backoff. Do not immediately repeat a null result while providerVisibleRetryAt still blocks another snapshot.
Automated agent prompts and orchestration mailbox pointers could paste into an existing composer draft and submit it. Reuse the existing attributed composer projection to refuse a positively recognized occupied draft before any automated bytes, regardless of age or focus.
Keep the exact PTY identity, incarnation, generation, input revision and admitted output sequence current through the actual initial write. Retain the input fence through paste-to-Enter and remote settlement; Codex retry Enter additionally requires the unchanged owned prompt and no observed turn. Park refused mail without an immediate retry loop, preserve unread mail and durable attempted phases, and prevent same-key RPC replay after partial delivery.
Validation: the expanded suite passes 1,816 tests across 21 files (3 skipped), including actual runtime with real HeadlessEmulator, real SQLite mailbox refusal/resume, production renderer/runtime input funnels, final-await draft arrival, provider snapshots ahead of the local stream, and durable RPC replay. Node typecheck, changed-code quality and reliability-gate validation are recorded in the implementation evidence.
Scope: positive recognized drafts only. Unsupported, hidden, unavailable, whitespace-only and otherwise unrecognized composers retain legacy admission; input whose echo has not arrived before admission can remain unrecognized. A takeover error after paste can represent partial delivery; durable keyed receipts remain conservative. No native provider or visible Electron journey was exercised. This does not address external-input authorization, attribution or browser confinement in #19546.
Related: #11242, #18478.
Reliability contract:
terminal-input.automated-draft-admissionis experimental/partial. The manifest records the before/after oracle, provider matrix, failure modes, diagnostics and cost. O(1) input/lifecycle revisions reuse existing write funnels and visible-screen acquisition/cache; no polling, process spawn, focus check or duplicate parser. No draft text is added to logs.Independent review exercised 21 cases, including real IPC/controller takeover and durable no-replay behavior. It found and red/green verified two freshness races; both are fixed. Node typecheck checks 17,631 files; changed-code quality has zero findings and all 151 gate definitions validate. The original implementation passed 248 tests /17 files after the file-length cleanup. A second independent review at bb77876 passes 58 targeted tests /4 files, confirms the actual input funnels and provider-snapshot-ahead control, and finds a clean three-way manifest merge with Pi #32197. Combined runtime execution was not performed.
Cross-platform/remote scope: shared host-side logic, no wire change, no path/shortcut changes, Git and folder workspaces use the same PTY contract. Deterministic macOS runtime/SQLite tests cover delayed remote-style settlement and existing Windows scheduling contracts; physical native agents, daemon/SSH, Windows/Linux and mobile caller journeys remain gaps. Parked mail resumes on an existing notification/idle edge or explicit check; no new polling watches draft edits. A prewrite occupied refusal can conservatively keep a durable request pending; a takeover error after paste must not be treated as a zero-byte receipt by unkeyed callers.
Visual proof: no rendered app proof captured. Before/after behavioral evidence uses actual runtime ingestion and real HeadlessEmulator cursor attributes with real SQLite; no live native provider or visible window was launched. This is not a rendered app or physical input acceptance claim.
Initial CI found 23 broader compatibility assertions that assumed synchronous pointer writes or a second Enter after a turn had started. A test/manifest-only correction now awaits actual admission, stages the pointer before lifecycle interruption, and strengthens permission/unverified-readiness checks to require zero bytes plus eventual delivery after readiness returns. Production safeguards are unchanged. Independent review found no blockers and independently passed 1,538 tests /3 entrypoints (3 skipped). The expanded 21-file gate passes 1,816 tests (3 skipped); these counts overlap. Fresh CI passed at
13a4889774f3: all five unit shards, static analysis/typecheck, mobile verification, Linux/Windows packaging, Linux persistence, relay integration and Ubuntu/Debian/Fedora WSL checks. These checks do not establish native-provider draft acceptance.