Skip to content

fix(forwarder): wait for shell approval before recovery - #293

Open
philau2512 wants to merge 2 commits into
leookun:mainfrom
philau2512:fix/shell-approval-state
Open

fix(forwarder): wait for shell approval before recovery#293
philau2512 wants to merge 2 commits into
leookun:mainfrom
philau2512:fix/shell-approval-state

Conversation

@philau2512

Copy link
Copy Markdown
Contributor

What this fixes

When Cursor shows a Shell command approval dialog, the command has not started yet—it is waiting for the user to click Run or Skip.

Previously, the forwarder could start its Shell timeout/recovery logic before the user made that choice. If the approval dialog stayed open for too long, it could incorrectly mark the Shell tool as incomplete or finished, even though the command had never run.

What changed

This PR distinguishes between:

  • Waiting for approval: the command is shown in Cursor but has not started.
  • Running: the client has sent a Shell start, stdout, or stderr event.

Shell timeout and recovery now begin only after the command is actually running.

If the user skips the command, it is still completed normally. If the Shell is running and its stream closes without a terminal event, the existing recovery behavior remains unchanged.

Tests

Added coverage for:

  • waiting at the approval dialog without timing out;
  • starting recovery after Shell execution begins;
  • skipping a command;
  • transport-close and foreground-timeout recovery.

Validation

go test ./internal/backend/forwarder

This PR is intentionally limited to Shell approval and recovery behavior.

Keep shell executions pending until the client reports Run, Skip, or another terminal state, and start foreground recovery only after execution begins.
znjhahaha pushed a commit to znjhahaha/cursor-byok that referenced this pull request Aug 13, 2026
- wait for shell approval before foreground/transport recovery (upstream leookun#293)
- validate openai stream terminal state and skip replayed tool completions
- pin replayed request-context dates to entry timestamps for prefix cache
- merge persisted conversation name when writing meta snapshots
- round-trip providerFirstTokenTimeout in frontend config state
- align request hash boolean encoding with backend
- run go build/vet and frontend build in CI test job

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant