Skip to content

Route Claude MCP elicitation requests to the input prompt (#173) - #1579

Merged
currentbits merged 1 commit into
mainfrom
coder/mcp-elicitation-173
Oct 10, 2026
Merged

currentbits merged 1 commit into
mainfrom
coder/mcp-elicitation-173

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Problem

The Claude provider answered every control request other than can_use_tool with Unsupported control request. MCP elicitations (a server asking the user mid-run) were auto-errored and never reached the user (#173).

Fix

  • electron/runner-provider-claude.js: elicitation control requests (mcp_server_name, message, mode, url, elicitation_id, requested_schema) go through Codex's existing pendingFromInput. That reuses the InputPrompt card, the form-schema validation and the URL rules. Forms that can't be displayed get an explicit error reply, which the CLI treats as cancel.
  • electron/runner-permissions.js: answers to elicitation prompts reply {action, content?}. Allow becomes accept with the validated values, Deny becomes decline, and Cancel stays cancel. Values that fail the schema throw before anything is sent, so the prompt stays open.

The wire shape was checked against the claude 2.1.283 binary, which answers elicitations from the host by default (hostAnswersElicitations).

Tests

  • guardrails-runner.test.js: the fake CLI can now send any control request. New cases cover accept-with-content (after a rejected bad value), decline, and the error reply for a form that can't be displayed.
  • Full npm run test:electron: 4525 pass, 0 fail.

Not tested against a real MCP server in the live app.

Closes #173

🤖 Generated with Claude Code

The Claude provider answered every non-can_use_tool control request with
an error, so MCP servers asking the user mid-run never reached them.
Elicitation requests now reuse Codex's pendingFromInput (same InputPrompt
card and schema validation) and reply { action, content? } to the CLI.

Closes #173

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T08:28:55.307164Z ba323d9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba323d9996

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +731 to +734
mode: request.mode,
url: request.url,
elicitationId: request.elicitation_id,
requestedSchema: request.requested_schema,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Accept URL elicitations without correlation IDs

When a valid Claude URL-mode elicitation omits elicitation_id, this call passes undefined into pendingFromInput, whose URL branch rejects the request and sends an unsupported-elicitation error instead of displaying the authentication link. Claude's protocol explicitly makes elicitation_id optional, including for URL mode, so the Claude adapter needs provider-specific validation rather than inheriting Codex's requirement. See the published Claude Agent SDK types.

Useful? React with 👍 / 👎.

Comment on lines +743 to +744
markTurnContent();
e.pendingPermissions.push(pending);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove elicitations canceled by the CLI

If Claude emits control_cancel_request while this elicitation is awaiting an answer, the newly queued entry is never removed because the event handler only dispatches control_request. The thread therefore remains marked awaitingInput with a stale card, and a later click attempts to answer a request the CLI has already canceled. The stream protocol explicitly defines this stdout message as canceling an open control request; handle it by matching request_id, removing the pending entry, and refreshing the waiting state. See the Claude Agent SDK control types.

Useful? React with 👍 / 👎.

@currentbits
currentbits merged commit a8366f1 into main Oct 10, 2026
6 checks passed
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.

MCP elicitation requests are auto-errored; mid-run questions from MCP servers never reach the user

1 participant