Skip to content

Route delegated MCP elicitations back to child session#22399

Draft
canvrno-oai wants to merge 4 commits into
mainfrom
canvrno/delegated-mcp-elicitation-routing
Draft

Route delegated MCP elicitations back to child session#22399
canvrno-oai wants to merge 4 commits into
mainfrom
canvrno/delegated-mcp-elicitation-routing

Conversation

@canvrno-oai
Copy link
Copy Markdown
Contributor

/review threads could surface an MCP elicitation prompt in the parent UI, but the user’s response was then submitted to the parent session. The pending elicitation responder actually lived in the delegated child session, so resolution failed with elicitation request not found and the /review remained blocked as if the user never responded.

This change handles delegated MCP elicitation events in the delegate bridge: it asks through the parent session/UI, then relays the resolved response back to the child session. Per codex feedback, an additional change was made to retain auto-deny behavior in Xcode clients. Added one focused regression test for the round trip.

@canvrno-oai
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown
Contributor

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

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: 4cc7f6fdf2

ℹ️ 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".

}
response = parent_session.request_mcp_server_elicitation(
parent_ctx,
request_id.clone(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Namespace delegated elicitation request ids

When two delegated sessions (or a delegated session and the parent) prompt the same MCP server concurrently, their independent MCP connections can reuse the same request id; Session::request_mcp_server_elicitation stores the parent-side waiter by only (server_name, request_id), so forwarding the child's raw id here can overwrite an existing pending elicitation. In that case the overwritten bridge receives None and cancels the wrong child request, while the user's first response may be delivered to another child; use a bridge-generated parent request id and map it back to the child's original id when submitting ResolveElicitation.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

A valid concern in subagent scenarios, looking into this...

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.

1 participant