Repository navigation
fix(terminal): frame CLI prompts for every recognized agent, not just Claude and Codex - #33571
Conversation
… Claude and Codex orca terminal send --text ... --enter typed the prompt as raw keystrokes into Pi, Grok, Cursor and other agents. Pi's composer opened a # completion menu and the Enter accepted it, and Grok's folder-trust menu took the typed letters as its answer and quit. Recognized agents now take the same bracketed-paste prompt path orchestration dispatch already uses, which also refuses a prompt while a trust/permission menu is up.
Walkthrough
Priority: Merge Risk:
|
…nd keep generic process names on direct input agent_prompt_blocked from terminal send now says to answer the menu with separate --text and --enter sends, and the orca-cli guide says the same. Foregrounds named orca, acli, cn or vibe also belong to ordinary tools, so they take the prompt path only when a title or hook status proves the agent.
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:
20b354c6-f52a-4a69-bd02-ae1f1b5acafe
Files selected for processing: 6-
skill-guides/orca-cli.mdsrc/cli/bundled-skill-guides.tssrc/cli/runtime/terminal-prompt-mutation-recovery.tssrc/main/runtime/orca-runtime-tests/terminal-handles-and-agent-status-part-02.spec.tssrc/main/runtime/orchestration/terminal-pane-mail-routing.tssrc/shared/agent-process-recognition.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
| const proof = agent && GENERIC_PROCESS_NAME_AGENTS.has(agent) ? null : foregroundProcess | ||
| const presence = { retryForegroundWrappers: false, foregroundProcess: proof } | ||
| if (agent === undefined || !(await this.isTerminalRunningAgent(handle, presence))) { |
There was a problem hiding this comment.
🔎 Supported by static analysis
-
Script executed:
#!/bin/bash # Inspect recognition and the presence check without running repository code. ast-grep outline src/shared/agent-process-recognition.ts --match 'recognizeAgentProcess|GENERIC_PROCESS_NAME_AGENTS' rg -n -C 5 'terminalAgentPresence|class .*AgentPresence|isRunning\(' src/main/runtime rg -n -C 5 'foregroundProcess|paneTitle|hook' src/main/runtime/orca-runtime-tests/terminal-handles-and-agent-status-part-02.spec.ts
Repository: stablyai/orca
Length of output: 24480
Script executed:
#!/bin/bash set -e printf '%s\n' '--- terminal-pane-mail-routing ---' nl -ba src/main/runtime/orchestration/terminal-pane-mail-routing.ts | sed -n '105,160p' printf '%s\n' '--- runtime-terminal-agent-presence ---' nl -ba src/main/runtime/runtime-terminal-agent-presence.ts | sed -n '1,260p' printf '%s\n' '--- recognition definitions ---' nl -ba src/shared/agent-process-recognition.ts | sed -n '1,230p' printf '%s\n' '--- targeted presence tests ---' nl -ba src/main/runtime/orca-runtime-tests/terminal-handles-and-agent-status-part-02.spec.ts | sed -n '285,350p'
Repository: stablyai/orca
Length of output: 26727
Script executed:
#!/bin/bash set -e printf '%s\n' '--- generic process mappings ---' rg -n -C 8 -F -e "'orca'" -e "'acli'" -e "'cn'" -e "'vibe'" -e "claude-agent-teams" -e "rovo" -e "continue" -e "mistral-vibe" src/shared/tui-agent-config.ts src/shared/agent-process-recognition.ts printf '%s\n' '--- title proof declarations and implementations ---' rg -n -C 12 -F -e 'function ptyTitleProvesAgentPresence' -e 'function agentTitleProvesAgentPresence' -e 'export function ptyTitleProvesAgentPresence' -e 'export function agentTitleProvesAgentPresence' src/main/runtime/runtime-worktree-status-projection.ts printf '%s\n' '--- title classification declarations ---' rg -n -C 8 -F -e 'export function classifyAgentTitle' -e 'export function classifyLatestAgentTitle' src/main/runtime/runtime-worktree-status-projection.ts
Repository: stablyai/orca
Length of output: 14638
Require presence evidence to match the recognized agent.
orca, acli, cn, and vibe map to generic agent IDs. The settled-prompt path removes foreground proof for these agents. RuntimeTerminalAgentPresence.isRunning can then return true from any recognized pane or PTY title without matching that title to the recognized foreground agent. A different agent title can therefore authorize settled-prompt delivery for an ordinary generic process. Require title or hook evidence to match the recognized agent, and add a regression test for mismatched evidence.
ELI5
When you run
orca terminal send --text "…" --enterat a Claude or Codex pane, Orca pastes the text as one block and then presses Enter. For every other agent (Pi, Grok, Cursor, Gemini, …) it typed the text one key at a time instead. Agents react to typed keys. Pi opened a file-completion menu on#, so the Enter picked a file instead of sending the message. Grok's "trust this folder?" menu read the typed letters as an answer and quit. Now every recognized agent gets the paste-then-Enter path that orchestration dispatch already uses for all agents.Root cause
isTerminalRunningSettledPromptAgentdecides whether a CLIterminal send --text … --entergoes throughsendTerminalAgentPrompt(bracketed paste, permission and trust guard, then Enter) or through the legacysendTerminalpath (raw keystrokes, then Enter). It only returned true forclaudeandcodex. #14608 scoped it that way while the render gate was being validated per agent. The render gate is now limited to Claude/Codex insidecreateAgentPromptRenderGate, so other agents on the prompt path get the same pre-Enter delay as the raw path (resolveAgentPromptSubmitDelayForAgent). The only real difference is framing, plus the permission guard.Upstream behavior that makes raw keystrokes unsafe:
@earendil-works/pi-tui1.4.0,dist/components/editor.js:170):@and#are autocomplete triggers. If typed text ends with#1542the async completion runs, and the trailing Enter accepts the first entry (.git/). Bracketed paste is buffered whole intohandlePaste(editor.js:571-583), so the trigger never fires. This is the variant @m11y described in [Bug]: worker-start --agent cursor reports ready while the brief sits unsubmitted in the composer #20695.xai-grok-pager/src/views/welcome/mod.rs:1018,xai-grok-permission-rules/src/folder_trust.rs:145): in a folder with repo config (e.g.CLAUDE.md), the welcome screen asks "Do you trust the contents of this directory?" withy/nhotkeys. Typed prompt text answers it. With the prompt path, Orca sees the menu and refuses withagent_prompt_blocked.8116.index.js): the composer counts keys that arrive less than 35 ms apart and treats Return as a newline during such a burst. Raw typing goes through that heuristic, and a bracketed paste avoids it. This is theterminal sendhalf of [Bug]: worker-start --agent cursor reports ready while the brief sits unsubmitted in the composer #20695. I did not run it live because there's no Cursor login on the test machine.What changed
terminal-pane-mail-routing.ts: any agent thatrecognizeAgentProcessrecognizes takes the prompt path. Unrecognized foregrounds, shells, and stale launch identity after the shell returns stay on direct input.orca/orca-dev→ claude-agent-teams,acli→ rovo,cn→ continue,vibe→ mistral-vibe;GENERIC_PROCESS_NAME_AGENTSinagent-process-recognition.ts) need a title or hook status before taking the prompt path. The foreground name alone keeps main's direct input. This reuses the existing title/hook presence check.agent_prompt_blockedrefusal tells the caller how to answer the menu ("send --text and --enter as separate commands", interminal-prompt-mutation-recovery.ts). The shippedorca-cliguide (skill-guides/orca-cli.md, regenerated intobundled-skill-guides.ts) says the same.How verified
Real CLIs, isolated
HOME/GROK_HOME/PI_CODING_AGENT_DIR, and a local fake OpenAI-compatible model server (no spend). Driven through a background E2E Electron build (ORCA_BACKGROUND_LAUNCH=1) with the public CLI (orca-dev terminal send/orchestration dispatch --inject/worker-start):terminal send --text <prompt ending "#9838 for details. "> --enter… details. .git/, 0 model requests, receiptaccepted(1/1 Orca, 2/2 direct PTY)terminal sendwhile the folder-trust menu is upagent_prompt_blocked … to answer it, send --text and --enter as separate commands, Grok still on the trust menuterminal send(ready composer)orchestration dispatch --injectworker-start --agent pipnpm tc✅,pnpm run check:code-quality:changed✅pnpm test src/main/runtime/rpc src/main/runtime/terminal src/main/runtime/orchestration src/main/runtime/orca-runtime.test.ts: all passed (5982 + 1511 tests)Risk / trade-offs
terminal send --text … --enternow sanitizes ESC to a visible<ESC>, the same as Claude/Codex and Dispatch. Callers that used--text --enterto inject escape sequences into those agents must send them without--enter(raw channel, unchanged).agent_prompt_blocked(with the hint above) instead of typing into the menu.Not in this PR (still open, needs a login we don't have)
worker-start --agent cursorpath on Windows, and Orchestration dispatch to a Qoder CLI worker lands unsubmitted — user must press Enter #26486 (Qoder): these need a logged-in Cursor/Qoder to capture the composer and confirm whether the Enter is absorbed mid-paste (a Windows input-record burst, like fix(agent-prompt): press Enter again while a Windows Codex composer still holds a dispatch #33295 for Codex). Neither CLI reaches its composer without auth.Refs #20695, #18399