Skip to content

fix(server): a secret card closes when its request is aborted right after it opens - #42135

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
SvetlomirB:fix/request-secret-stranded-card
Nov 24, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
SvetlomirB:fix/request-secret-stranded-card

Conversation

@SvetlomirB

Copy link
Copy Markdown
Contributor

Problem

request_secret recorded the card before attaching the cleanup that closes it, so a call aborted in between left the card pending for good. Fixes #42134.

Change

The wait now runs in Effect.acquireUseRelease: recording the card is the acquire step and closing it is the release, which also covers a timeout. Most of the diff is re-indentation.

Scope

A bug fix with a regression test. Same function as #34634 and #38167, different failure.

Verification

  • New case in OrchestratorMcpService.activity.test.ts aborts the call while the card is being recorded. On main: expected [ 'pending' ] to deeply equal [ 'pending', 'cancelled' ]. With the fix it passes.
  • The existing timeout case now also checks that only a timed-out card is closed.
  • vp run check:changed passes at 4146b1b3b6.
  • Real web app: the replay agent calls request_secret over MCP, then aborts the call. Real Chromium web client, 1280×800, light theme, fresh isolated databases and synthetic data on both commits. For the captures only, both commits carry a yield* Effect.sleep("3 seconds") right after the card is recorded, so the abort lands in the window.
Step Before — 75443857dc After — 4146b1b3b6
Card open Before: secret card open After: secret card open
Call aborted, run ended Before: card still pending After: card shows Request ended
Recording
stranded-base.webm
stranded-head.webm

Scenario and replay driver · proof.json. scenarios:prove exited 0: failed on base and passed on head.

Not checked: desktop, mobile, and a real provider's abort.

Done with claude-opus-5-5 via Claude Code

…fter it opens

request_secret recorded the card as pending before installing the cleanup that
closes it. A call aborted in between (a Stop, or the MCP client dropping the
call) left the card pending for good: the thread showed "Input" with no one
waiting, a secret saved there never reached the agent, and after the run ended
the form stayed in the thread and failed with "The agent that asked has stopped".

Record the pending card as the acquire step of acquireUseRelease, with the wait
as its use and closing the card as its release. The release also covers a
timeout, so every way the wait ends without an answer closes the card, and an
abort lands either before the card exists or after its cleanup is in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 24, 2026
@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

requestSecret now records pending within the wait’s resource scope and closes the card on release unless the wait succeeds with a timeout result. Tests verify dispatched status sequences for timeout, decline, cancellation, and interruption.

Changes: Secret request cleanup

Layer / File(s) Summary
Wait and cleanup lifecycle
apps/server/src/mcp/OrchestratorMcpService.ts, apps/server/src/mcp/OrchestratorMcpService.activity.test.ts
The wait records pending during resource acquisition. The release step closes the card unless the wait succeeds with a timeout result. Tests check timeout and interruption sequences, and confirm declined and cancelled requests record only pending.

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related issues

  • Issue 41797: Both issues involve cleanup when an MCP client aborts request_secret. The reported client-side timeout remains outside this change.

Suggested reviewers: ali-al1, juliusmarminge

Merge Risk: Minimal · up to 23118

This fix makes a secret request card close as "Request ended" when the call is aborted just after the card is recorded. The change is localized to the server's secret-request wait, with new test coverage for the abort case. No remaining merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix: a secret card closes when its request is aborted right after it opens. The raw summary shows the change wraps the pending-card recording in an acquire/use/release scope, so th…
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section states the bug and links issue #42134. The Change section explains the acquire/use/r…
Linked Issues check Passed Issue #42134 requires that a secret card closes as "Request ended" when its request_secret call is aborted while the card is being recorded. The test diff at the reviewed head adds `requestSecret clos…
Out of Scope Changes check Passed The test diff contains only changes that support the fix. It adds the Deferred import and the abort-during-recording regression case. It records secret statuses in the existing outcome test and checks…
Full details: Title check

Explanation

The title names the fix: a secret card closes when its request is aborted right after it opens. The raw summary shows the change wraps the pending-card recording in an acquire/use/release scope, so the release closes the card on abort. The title matches the main change and the linked issue #42134.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section states the bug and links issue #42134. The Change section explains the acquire/use/release fix. The Scope section says it is a bug fix with a regression test. Verification gives a focused test with observed failure and pass results, a check command result, and before/after evidence. It also states what was not checked (desktop, mobile, real provider abort). The template's optional agent-model line is present. The Problem section does not describe expected behavior in detail, and the Scope section does not explicitly link the bug issue beyond the Problem section, but both are covered elsewhere, so the description is mostly complete.

Full details: Linked Issues check

Explanation

Issue #42134 requires that a secret card closes as "Request ended" when its request_secret call is aborted while the card is being recorded. The test diff at the reviewed head adds requestSecret closes its card when the call is aborted while the card is being recorded. That test blocks the dispatch of the "pending" record, interrupts the request, and expects the recorded statuses to equal ["pending", "cancelled"]. The timeout test now expects ["pending", "cancelled"] and the declined and cancelled tests expect ["pending"]. This matches the issue's expected behavior. The service diff for apps/server/src/mcp/OrchestratorMcpService.ts could not be read because changed blobs are missing from the checkout. The implementation claim (acquire records pending, release writes cancelled unless the use ends with a timeout result) rests on the AI-generated summary. The test pass result and check:changed result are author-reported and were not run.

Full details: Out of Scope Changes check

Explanation

The test diff contains only changes that support the fix. It adds the Deferred import and the abort-during-recording regression case. It records secret statuses in the existing outcome test and checks the timeout cancellation. The service changes, as summarized, restructure the secret wait into acquire/use/release, remove the pre-wait pending record and the separate timeout cancellation, and keep the polling cancellation rules and the MAX_SECRET_REQUEST_TIMEOUT_MS cap. The summary lists no exported declaration changes. The re-indentation follows from the restructuring. Limitation: the service diff could not be read, so this verdict relies on the summary for those hunks.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4146b1b and 2311818.

Files selected for processing: 1

  • apps/server/src/mcp/OrchestratorMcpService.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Real web client, Replay provider, fresh synthetic data, 1280×800 viewport, light theme. Both commits received the same temporary three-second delay after recording the pending card. Replay called request_secret with clientRequestId: router-key, sent MCP cancellation after 1.2 seconds during that delay, and ended the run. The base retained Save securely and Decline; the fix displayed Request ended. scenarios:prove exited 0. Captures and recordings were visually inspected.

Before After
Commit f692811b95 23118187cf
Request opened Before: request opened After: request opened
After abort and run end Before: card remains answerable After: Request ended
Recording Before recording After recording

Scenario · Replay and timing fixture · Scenario startup hook

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 24, 2026
@juliusmarminge
juliusmarminge merged commit fc92aef into pingdotgg:main Nov 24, 2026
55 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: A secret card stays pending for good when its request_secret call is aborted while the card is being recorded

2 participants