Skip to content

fix(runtime): keep a restored permission wait blocking prompts while the reattached screen shows its dialog - #38761

Merged
nwparker merged 1 commit into
mainfrom
fix/35962-send-guard-adopted
Nov 6, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/35962-send-guard-adopted

Conversation

@nwparker

@nwparker nwparker commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

If Claude was asking "Do you want to proceed?" when orca serve restarted, the question was still on screen afterwards, but Orca forgot it was waiting for an answer. orca terminal send then typed the next prompt straight into that menu. Now Orca keeps treating the pane as waiting for permission until the screen shows the question is gone.

Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​205 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​204
Prod 17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​186 $\color{#cf222e}{\Huge{\mathbf{−}}}$​39 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​147

What Changed

Before: after a server restart, the saved "waiting for permission" status is restored as unconfirmed, and the send guard ignored unconfirmed rows, so prompts went into the open dialog. After: a restored permission wait still blocks prompts (and status reads report permission) while the pane's current screen could show the dialog.

How:

  • A restored permission row (not provider-session-only, inside the existing 30-minute freshness window) stands until a current screen rules the dialog out. No input reaches a pane while the runtime is down, so a dialog open at shutdown is still open.
  • "Current screen" is the caught-up headless grid. Right after reattach, while that grid may only hold the bytes since the restart, only the provider's own current frame counts. An unreadable, blank or outdated screen keeps the wait (fail closed).
  • Status reads, prompt writes and the onPermission: wait hold read the screen first while a restored wait stands, so a dialog answered after the restart (for example with Esc, which posts no hook) lifts the wait without waiting for a hook.
  • Once a screen rules the dialog out, the restored wait is spent for that PTY, so later output (the prompt's own echo) can't revive it.

The logic lives in a new OrcaRuntimeWithRestoredAgentDialogScreen step of the runtime class chain (restored-agent-dialog-screen.ts). Restored working/idle rows stay unconfirmed as before.

Why

The restored row is the only evidence that a dialog is open, and trusting it blindly would block a pane whose dialog was answered while Orca was down. Checking it against the screen (and failing closed when the screen can't be read) keeps the guard safe without leaving panes stuck.

Thank you @Sangkwun for the report.

Linked Issue

Fixes #35962

Visual Proof

N/A: host-side guard behaviour, covered by runtime tests.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

agent-prompt-restored-permission.test.ts: refuses while the reattached screen still shows the dialog; sends once the provider-owned screen shows it dismissed; releases a held prompt once the dialog is dismissed; keeps the wait while only the partial live grid (not the provider) shows the dialog gone; sends when the reattached screen shows the composer. The 22 test files that import the changed modules pass. pnpm tc, pnpm lint and the changed-code quality gate pass.

Risk

Level: Medium

Host-only; no wire change. The riskiest part is a pane wrongly held as "waiting for permission" after a restart: that can only happen inside the 30-minute window, for a restored permission row, while no readable current screen shows the dialog gone; the next hook from the agent replaces the row. Extra cost is one hook-row scan per status read/prompt write, plus a bounded screen read only while a restored wait stands. Back out with a plain revert.

Review

Independent Opus reviews: no P0-P2. Codex review: no findings (an earlier Codex P2, trusting a partial post-reattach grid, is fixed here).

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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 20 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 5a38e32b-fb50-4d03-9e53-1d55fe73b62c
Commits

Reviewing files that changed from the base of the PR and between 3a4fe5a and 767624b.

Files selected for processing: 19

  • src/main/runtime/agent-prompt-restored-permission.test.ts
  • src/main/runtime/claude-open-dialog-hold.ts
  • src/main/runtime/construction/runtime-construction-services.ts
  • src/main/runtime/construction/runtime-service-state.ts
  • src/main/runtime/orca-runtime-tests/agent-status-and-waits.spec.ts
  • src/main/runtime/terminal/input/agent-prompt-permission-hold.ts
  • src/main/runtime/terminal/input/agent-prompt-submission-runtime-test-fixture.ts
  • src/main/runtime/terminal/input/terminal-agent-prompt-submit.ts
  • src/main/runtime/terminal/input/terminal-agent-status-and-submission.ts
  • src/main/runtime/terminal/lifecycle/floating-session-liveness.ts
  • src/main/runtime/terminal/lifecycle/pty-exit-lifecycle.ts
  • src/main/runtime/terminal/lifecycle/terminal-view-resources.ts
  • src/main/runtime/terminal/output/headless-buffer-snapshot.ts
  • src/main/runtime/terminal/output/restored-agent-dialog-screen.ts
  • src/main/runtime/terminal/output/terminal-output-generation.ts
  • src/main/runtime/terminal/output/terminal-visible-state.ts
  • src/main/runtime/terminal/query/runtime-terminal-agent-status-query.ts
  • src/main/runtime/terminal/wait/terminal-wait-permission.ts
  • src/main/runtime/workspaces/process-listing/runtime-hook-agent-row-selection.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…the reattached screen shows its dialog

After an orca serve restart, the hook row that recorded a Claude permission
wait is hydrated as restoredUnconfirmed and the explicit-status selector
skipped it, so the send guard saw no evidence and typed into the open menu.

No input reaches a pane while its runtime is down, so a dialog open at
shutdown is still open. A restored permission row (not provider-session-only,
inside the 30-minute window) now stands until a current screen shows no
dialog:

- The current screen is the caught-up headless grid, or, while that grid may
  hold only the bytes since reattach, the provider's current frame. An
  unreadable, blank or outdated screen keeps the wait (fail closed).
- Status reads, prompt writes and the onPermission wait hold read the
  screen first when a restored wait stands, so a dialog answered after the
  restart lifts it without waiting on a hook.
- Once a screen rules the dialog out, the restored wait is spent for that
  PTY; later output, such as the prompt's own echo, cannot revive it.

Restored working/idle rows stay unconfirmed. Host-only change.

Fixes #35962
@nwparker
nwparker force-pushed the fix/35962-send-guard-adopted branch from 8ed34dd to 767624b Compare November 6, 2026 06:12
@nwparker
nwparker merged commit 29f1b5d into main Nov 6, 2026
55 checks passed
brennanb2025 added a commit that referenced this pull request Nov 7, 2026
Resolve the pinned main sync in place, on main's new module organization:
- Keep the shared readiness predicates (agent-state-rules, terminal-wait detection and tail
  window, qoder readiness, screen-input veto) at their shared owner; redirect main's moved
  importers to it
- Carry the generated-input write options into terminal/input/agent-prompt-write-options,
  register the generated-input RPC methods in the method registry under methods/terminal
- #38761: the restored-wait override passes the prompt's turn checks and retarget through
- #38401: the moved render gate takes options.promptForSchedule as its third argument
- #38939: typed pre-ready text recovers through the canonical notice, which carries Copy
- Add to chat notes go through the generated operation unsubmitted
- Split files main's growth and these additions took past the line budget by owner

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant