Skip to content

fix(server): a secret card closes when the user replies in chat instead - #42355

Closed
OmarAlex24 wants to merge 1 commit into
pingdotgg:mainfrom
OmarAlex24:t3/cancel-secret-request-on-message
Closed

OmarAlex24 wants to merge 1 commit into
pingdotgg:mainfrom
OmarAlex24:t3/cancel-secret-request-on-message

Conversation

@OmarAlex24

Copy link
Copy Markdown
Contributor

Problem

When an agent calls request_secret and the user replies in the composer instead of using the card, the card stays open and the agent never sees the reply. With providers that steer into the running turn (Codex, Antigravity agy acp >= 1.5.0 via steersWithPrompt), the steer joins the same run under the same root node. The request_secret wait only exits on an answer, a terminal run, a superseded root (#34634) or the timeout, so the tool call keeps blocking the turn. The provider only delivers the steer after the call returns, so the user waits until they press Decline or the timeout (10 min by default) runs out.

Reproduced on T3 Code 0.1.12-nightly.20261123 with Antigravity agy 1.5.15. The agent asked for a DATABASE_URL, the user typed a reply under the card, and the card stayed pending while the message showed as "Steer".

Change

In the requestSecret wait loop, the card is closed as cancelled (same as the restart case from #34634) once a user-authored steer lands in the same run after the card. That means a user_message with createdBy: "user", no scheduledTaskId, inputIntent steer/promoted_queued_to_steer and a higher ordinal than the card. The agent gets { status: "cancelled", note } right away and then reads the user's message.

Agent and system wakes (monitor notifications, delegated completions, continuations, MCP sends) use createdBy: "agent"/"system" and don't close the card. Scheduled-task messages can carry createdBy: "user", so they are excluded through scheduledTaskId.

The poll now passes turnItemRunId: runId and reads secret_request and user_message items for this run only. Before, it read every secret_request card in the thread every 500ms, so each poll now loads less.

Scope and approval

No prior issue. This is a small, focused fix for an obvious bug: a card that can't be answered from chat still blocks the user's chat reply. It extends the exit conditions #34634 added to the same loop, to cover the active-steering path that #34634 doesn't reach (the root node doesn't change there). Two files: the wait loop and one test.

Verification

  • New test in apps/server/src/mcp/OrchestratorMcpService.activity.test.ts ("requestSecret cancels its card when the user steers a reply into the run instead"), on TestClock:
    • User-steer row: on main it fails with timed_out instead of cancelled; with the fix it passes with cancelled and records ["pending", "cancelled"].
    • Agent-steer row, plus a user steer from before the card: the card is not closed early and the call ends timed_out.
  • vp test run apps/server/src/mcp/OrchestratorMcpService.activity.test.ts: 13 passed. The secret tests in OrchestratorMcpService.test.ts pass.
  • vp run check:changed: format, lint, knip, typecheck (3 packages) and tests (4 files, 115 tests) pass.

Not checked: an end-to-end run against a live Codex or Antigravity session, a test row for the scheduled-task exclusion, or the turnItemRunId filter against real SQLite (the test uses a mock projection; the filter already exists in ProjectionStore and is covered by type-checking).

Written by Claude Opus 5.5 via Devin (ACP) in T3 Code.

When a provider steers a message into the active run (Codex, Antigravity), request_secret kept waiting on its card and blocked the turn, so the user's reply sat unread until they declined or the card timed out. The wait now closes the card as cancelled once a user-authored steer lands in the same run after the card was asked.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.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
@AymanKhan9

Copy link
Copy Markdown
Contributor

The PR for this issue is already open check - #40204

@juliusmarminge

Copy link
Copy Markdown
Member

Thanks for this. #40218 makes the same change and is the one being kept.

#40218 fixes the same deadlock by cancelling pending secret cards when the user steer is dispatched. It also demonstrates the fix with a real Claude session, which this submission leaves unverified.

Your same-run reproduction confirms the same underlying problem. We can keep the fix and its verification together in the existing pull request.

Closing as a duplicate.

@OmarAlex24

Copy link
Copy Markdown
Contributor Author

fair enough! my PR is cleaner tho 👀 jk, glad it's getting fixed!

Thanks for this. #40218 makes the same change and is the one being kept.

#40218 fixes the same deadlock by cancelling pending secret cards when the user steer is dispatched. It also demonstrates the fix with a real Claude session, which this submission leaves unverified.

Your same-run reproduction confirms the same underlying problem. We can keep the fix and its verification together in the existing pull request.

Closing as a duplicate.

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.

3 participants