Fix model approval resume across self-hosted MCP sessions - #2175
Open
ThomsenDrake wants to merge 2 commits into
Open
ThomsenDrake wants to merge 2 commits into
ThomsenDrake wants to merge 2 commits into
Conversation
This branch has not been deployed
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.
Summary
An execution paused in one model-mode MCP session returns
execution_not_foundwhen the same client initializes another session before callingresume. Wire the existing resume fallback into the in-memory session store so the second session can resume the original live engine.Lookup is restricted to the same authenticated account, organization, MCP resource, and model approval mode. It retains the resuming request's permissions, protects the owning session from idle eviction during resume, and uses the engine's existing in-flight/result replay behavior. Browser approval sessions remain excluded.
This is an in-process fix: it does not preserve executions across session disposal, process restarts, or different replicas. No approval requirement is removed.
Linked issue
Related to #1778.
Verification
bun run format:checkbun run lintbun run typecheck— 45/45 tasks passed.TURBO_TEST_CONCURRENCY=2 bun run test— 39/39 tasks passed.bun run --cwd e2e test:selfhost scenarios/policy-tool-approval.test.ts— both scenarios passed. On self-host, the approval test initializes a second session, resumes, and retries the completed result; the decline test confirms no operation occurs. Sanitized HTTP trace (initial 401s are the test client's OAuth discovery).Real-engine regression coverage includes cross-session resume/replay, ordinary execution, permission demotion, account/organization/resource isolation, browser-mode isolation, and a disposed owner session. Optional MCP debug logs now include the existing session/request join keys for execute and resume correlation.
The cloud approval scenarios also passed after restricting cross-session replay to self-host; cloud uses a separate owner directory. Full repository gates above ran at 645da79; the subsequent test-only change at 633ef3a passed formatting and both targeted suites. GitHub CI on the current head also passed, including the Docker build and all self-host/cloud/local end-to-end shards.
Checklist
@executor-js/host-mcpis private and explicitly ignored by the changeset configuration.