Repository navigation
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 7 minutes. View limit details
No actionable comments were generated in the recent review.
|
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:
40a95da6-eea6-4d82-b16d-5b46e25b3dc1
📒 Files selected for processing: 7
config/reliability-gates.jsoncsrc/main/daemon/headless-emulator.tssrc/main/runtime/orchestration/pi-terminal-prompt-framing.tssrc/main/runtime/orchestration/terminal-pane-mail-routing.tssrc/main/runtime/rpc/methods/terminal/terminal-prompt-routing.tssrc/main/runtime/rpc/methods/terminal/terminal-send-method.tssrc/main/runtime/rpc/pi-terminal-prompt-framing.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
| const canPaste = async (): Promise<boolean> => { | ||
| this.assertAgentPromptExpectedBinding(handle, binding) | ||
| const state = this.headlessTerminals.get(binding.ptyId) | ||
| // A partial suffix of a restored provider stream cannot certify negotiated modes. | ||
| if (!state || this.providerSnapshotPreferredPtys.has(binding.ptyId)) { | ||
| return false | ||
| } | ||
| if (recognizeAgentProcess(await confirm(binding.ptyId))?.agent !== 'pi') { | ||
| return false | ||
| } | ||
| const pendingOutput = state.writeChain | ||
| await pendingOutput | ||
| this.assertAgentPromptExpectedBinding(handle, binding) | ||
| const supported = | ||
| state.writeChain === pendingOutput && | ||
| this.headlessTerminals.get(binding.ptyId) === state && | ||
| !this.providerSnapshotPreferredPtys.has(binding.ptyId) && | ||
| state.emulator.getModes().bracketedPaste | ||
| const pty = this.ptysById.get(binding.ptyId) | ||
| if (supported && pty) { | ||
| pty.foregroundAgent = 'pi' | ||
| } | ||
| return supported |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
-
🏁 Script executed:
sed -n '1,85p' src/main/runtime/orchestration/pi-terminal-prompt-framing.ts rg -n 'confirmForeground|foregroundProcess|pendingOutput|writeChain' src/main/runtime/orchestration/pi-terminal-prompt-framing.ts src/main/runtime/terminal/input/terminal-agent-prompt.ts
Repository: stablyai/orca
Length of output: 3095
🏁 Script executed:
set -eu printf '%s\n' '--- confirmForegroundProcess bindings ---' rg -n -F --glob '*.ts' -e 'confirmForegroundProcess' -e 'foregroundAgent' -e 'writeChain' src/main src/shared tests 2>/dev/null || true printf '%s\n' '--- framing references and tests ---' rg -n -F --glob '*.{ts,tsx}' -e 'preparePiTerminalPrompt' -e 'agent_not_in_foreground' -e 'OrcaRuntimeWithPreparePiTerminalPrompt' src tests 2>/dev/null || true printf '%s\n' '--- candidate declarations ---' rg -n -F --glob '*.ts' -e 'class .*Pty' -e 'confirmForeground' src/main/runtime src/main 2>/dev/null || true
Repository: stablyai/orca
Length of output: 41511
🏁 Script executed:
set -eu printf '%s\n' '--- confirmForegroundProcess and state bindings ---' rg -n -F --glob '*.ts' -e 'confirmForegroundProcess' -e 'foregroundAgent' -e 'writeChain' src/main src/shared || true printf '%s\n' '--- framing references and tests ---' rg -n -F --glob '*.{ts,tsx}' -e 'preparePiTerminalPrompt' -e 'agent_not_in_foreground' -e 'OrcaRuntimeWithPreparePiTerminalPrompt' src tests 2>/dev/null || true
Repository: stablyai/orca
Length of output: 30627
🏁 Script executed:
set -eu printf '%s\n' '--- foreground inspection ---' sed -n '245,290p' src/main/daemon/pty-subprocess/foreground-process-tracker.ts sed -n '245,265p' src/main/daemon/session.ts sed -n '185,202p' src/main/providers/local-pty-provider.ts printf '%s\n' '--- headless state and output-chain mutation ---' sed -n '90,180p' src/main/runtime/terminal/output/headless-terminal-state.ts sed -n '170,198p' src/main/runtime/terminal/output/terminal-output-generation.ts printf '%s\n' '--- cached foreground-agent updates ---' sed -n '110,145p' src/main/runtime/runtime-pty-foreground-agent.ts printf '%s\n' '--- focused framing tests ---' sed -n '1,275p' src/main/runtime/rpc/pi-terminal-prompt-framing.test.ts
Repository: stablyai/orca
Length of output: 17462
🏁 Script executed:
set -eu printf '%s\n' '--- complete foreground confirmation tail ---' sed -n '260,340p' src/main/daemon/pty-subprocess/foreground-process-tracker.ts printf '%s\n' '--- remaining framing tests ---' sed -n '220,380p' src/main/runtime/rpc/pi-terminal-prompt-framing.test.ts printf '%s\n' '--- output ingestion and write-chain ownership ---' sed -n '90,145p' src/main/runtime/terminal/output/pty-output-ingestion.ts sed -n '175,235p' src/main/runtime/terminal/output/headless-terminal-state.ts
Repository: stablyai/orca
Length of output: 10772
Reconfirm the foreground process after pendingOutput.
confirmForegroundProcess performs a fresh process scan before await pendingOutput. A foreground transition during that wait does not change the headless state or write-chain identity. The current checks can therefore still pass, and the writer can send the Pi paste and Enter to the new foreground program.
Suggested fix
-
const pendingOutput = state.writeChain await pendingOutput this.assertAgentPromptExpectedBinding(handle, binding) + if (recognizeAgentProcess(await confirm(binding.ptyId))?.agent !== 'pi') { + return false + } const supported =
📝 Committable suggestion
-
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.Suggested changeconst canPaste = async (): Promise<boolean> => { this.assertAgentPromptExpectedBinding(handle, binding) const state = this.headlessTerminals.get(binding.ptyId) // A partial suffix of a restored provider stream cannot certify negotiated modes. if (!state || this.providerSnapshotPreferredPtys.has(binding.ptyId)) { return false } if (recognizeAgentProcess(await confirm(binding.ptyId))?.agent !== 'pi') { return false } const pendingOutput = state.writeChain await pendingOutput this.assertAgentPromptExpectedBinding(handle, binding) const supported = state.writeChain === pendingOutput && this.headlessTerminals.get(binding.ptyId) === state && !this.providerSnapshotPreferredPtys.has(binding.ptyId) && state.emulator.getModes().bracketedPaste const pty = this.ptysById.get(binding.ptyId) if (supported && pty) { pty.foregroundAgent = 'pi' } return supported const canPaste = async (): Promise<boolean> => { this.assertAgentPromptExpectedBinding(handle, binding) const state = this.headlessTerminals.get(binding.ptyId) // A partial suffix of a restored provider stream cannot certify negotiated modes. if (!state || this.providerSnapshotPreferredPtys.has(binding.ptyId)) { return false } if (recognizeAgentProcess(await confirm(binding.ptyId))?.agent !== 'pi') { return false } const pendingOutput = state.writeChain await pendingOutput this.assertAgentPromptExpectedBinding(handle, binding) if (recognizeAgentProcess(await confirm(binding.ptyId))?.agent !== 'pi') { return false } const supported = state.writeChain === pendingOutput && this.headlessTerminals.get(binding.ptyId) === state && !this.providerSnapshotPreferredPtys.has(binding.ptyId) && state.emulator.getModes().bracketedPaste const pty = this.ptysById.get(binding.ptyId) if (supported && pty) { pty.foregroundAgent = 'pi' } return supported
A desktop CLI prompt such as
check issue #12 please。can open Pi's asynchronous file completion. The delayed Enter then inserts.agents/instead of submitting the prompt. Eligible Pi sends now reuse the existing atomic bracketed-paste writer and one separate Enter.This is a partial repair for #20695. It requires a Pi launch target, fresh foreground Pi confirmation, authoritative negotiated paste mode, and a durable request. The exact PTY/process binding, foreground and mode are checked again before frame and Enter. A failed recheck or cancellation stops delivery without a raw fallback or rescue Enter. The receipt truthfully remains
observation: unsupported.Validation:
@earendil-works/[email protected]Editor/StdinBuffer/CombinedAutocompleteProvider consumed captured production RPC writes: disabling only the Pi route produces.agents/completion with zero submissions; the candidate submits the exact prompt once. The same check preserves and includes an ordinary existing draft.a1749505ff60; that follow-up changes only the manifest confirmation-budget wording./varversus/private/var).Reliability contract:
terminal-input.cli-agent-prompt-submitremains experimental/partial and now records the Pi-specific oracle and limits. The Pi route adds at most three targeted process confirmations beyond existing classification (up to four for the full operation) and existing output-chain awaits, with no polling, inventories, snapshots or new timers. Local runtime/RPC and the official recipient are covered on macOS. Live daemon, SSH/remote, WSL and native Linux/Windows Pi journeys remain gaps. Mobile/relay keeps its existing direct route; no git-worktree-only assumptions were added.Cursor, worker-start readiness and generic Pi draft detection remain follow-ups. Control input and leading
/,.,~stay raw because Pi paste normalization can change those draft semantics. Missing provider confirmation, partially restored mode state, non-durable calls, and Pi manually started in a pane launched for another provider also retain raw delivery. This does not claim a model turn started or close all of #20695.