Skip to content

[Bug]: After a serve restart, terminal send types into a Claude permission menu that was open before the restart #35962

Closed

Description

@Sangkwun

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_use at 0 and its tool_result at +24, in the same second as the accepted send. The tool_result records "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:

  1. Run orca serve so 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).
  2. In a managed terminal, start claude --permission-mode default and ask it to run a Bash command that needs approval, for example touch /private/tmp/x. Wait for the menu.
  3. Run orca terminal send --terminal <h> --text hello --enter --wait-submit 10 --json. It returns agent_prompt_blocked.
  4. Restart the runtime, for example launchctl kickstart -k gui/$UID/<serve label>.
  5. 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

  1. deleted a comment from AmethystLiang on Oct 31, 2026
  2. added a commit that references this issue on Nov 6, 2026
    767624b
  3. added a commit that references this issue on Nov 6, 2026
    29f1b5d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions