Repository navigation
Description
Operating system
macOS 27.0.1
Orca version
1.4.244, headless orca serve under a LaunchAgent. The runtime had just been updated in place from 1.4.243 with the runtime updater. The two refusals below came from 1.4.243, and the accepted send was the first one after 1.4.244 started. Claude Code 2.1.312.
Details
Short summary: before a runtime restart, terminal send correctly refused a Claude session that was showing a permission menu (agent_prompt_blocked). After the restart, the send was accepted while the menu was still open. The text and Enter went into the menu, the menu closed with a one-time yes, and the pending tool call ran. The message never reached Claude as a prompt.
This is separate from #22809. When the runtime has no evidence about an adopted terminal, the send guard fails open.
What happened (one Claude Code session; times are minutes after the menu opened)
| time | event |
|---|---|
| 0 | A background subagent of the session asked for permission to run a Bash command. Claude showed its permission menu. |
| +8, +20 | orca terminal send --terminal <h> --text <message> --enter --wait-submit 10 --json returned agent_prompt_blocked. Correct. |
| +23¾ | The runtime restarted for the update. The terminal daemon and the Claude process survived. |
| +24 | The sender's queued retry of the +20 request (--retry-request <requestId>) returned accepted: true with stages input_accepted, turn_started, 26 seconds after the new runtime started. In the same second the subagent's pending Bash call ran. |
Evidence that the text went into the menu and not into the composer:
- The subagent transcript shows the Bash
tool_useat 0 and itstool_resultat +24, in the same second as the accepted send. Thetool_resultrecords"permissionDecision": {"decision": "accept", "source": "user_temporary", "grantScope": "once"}. I found no other input to that terminal in that window. - The message does not appear in Claude Code's prompt history (
~/.claude/history.jsonl) or in the main session transcript. A resend 13 minutes later appears normally in both. - No allow rule was written.
Five minutes after the restart, orca terminal read --screen for this terminal returned source: "screen-unavailable". As far as I can tell from the bundled 1.4.244 runtime, the send guard (isAgentPromptPermissionBlocked) and agentWait both depend on in-memory hook, title and screen state, and none of it carried the open menu across the restart.
In this case the approved command deleted and re-encoded scratch audio files and edited two scratch scripts with sed -i. Claude had flagged it as a safety check (dangerousRemoval). The same path can approve any tool call, and a digit inside the message text could pick a menu option such as "Yes, and always allow".
How can we reproduce it?
I saw this once on a live host and have not yet run these steps in isolation:
- Run
orca serveso that the terminal daemon survives a runtime restart (a LaunchAgent, as in [Bug]: After an orca serve restart, surviving terminals come back with no title and unknown agent status #22809). - In a managed terminal, start
claude --permission-mode defaultand ask it to run a Bash command that needs approval, for exampletouch /private/tmp/x. Wait for the menu. - Run
orca terminal send --terminal <h> --text hello --enter --wait-submit 10 --json. It returnsagent_prompt_blocked. - Restart the runtime, for example
launchctl kickstart -k gui/$UID/<serve label>. - Repeat step 3 with
--retry-request <requestId from step 3>, which is what happened here, and once more as a new request.
Expected behavior
Step 5 is refused like step 3. If the runtime cannot tell whether an adopted agent terminal is at a menu, an agent prompt send should not treat that terminal as safe. Possible directions: restore the permission state with the rest of the persisted agent status, read the screen of an adopted terminal before its first agent prompt, or refuse with a distinct error until a hook or screen read shows the composer.
Related: #22809 (a restart leaves surviving terminals without title and agent status), #22103 (permission menu and terminal send), #33462 (answering approval requests from the CLI), #25854 (agentWait coverage).
Activity
fix(runtime): keep a restored permission wait blocking prompts while …
fix(runtime): keep a restored permission wait blocking prompts while …