Route delegated MCP elicitations back to child session#22399
Route delegated MCP elicitations back to child session#22399canvrno-oai wants to merge 4 commits into
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 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(), |
There was a problem hiding this comment.
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 👍 / 👎.
There was a problem hiding this comment.
A valid concern in subagent scenarios, looking into this...
/reviewthreads 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/reviewremained 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.