fix(forwarder): wait for shell approval before recovery - #293
Open
philau2512 wants to merge 2 commits into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
start,stdout, orstderrevent.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:
Validation
This PR is intentionally limited to Shell approval and recovery behavior.