Skip to content

feat(provider-codex): support MCP elicitation requests (fixes Computer Use perms, etc) - #5664

Merged
SawyerHood merged 8 commits into
get-bb:mainfrom
smsunarto:scott/mcp-elicitation
Oct 19, 2026
Merged

SawyerHood merged 8 commits into
get-bb:mainfrom
smsunarto:scott/mcp-elicitation

Conversation

@smsunarto

@smsunarto smsunarto commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

BB did not handle Codex's mcpServer/elicitation/request, so Computer Use app-access requests were silently declined and other MCP elicitations could not collect answers. Revives #3113, which was auto-closed as stale, rebased onto current main.

What changed

  • Computer Use: the card shows the app's native icon with a Computer Use badge, its name, and its bundle ID. It offers session or persistent approval, and Decline. Codex owns permission storage. The title reads "Allow Codex to use ?".
  • Risk: high-risk warnings appear first, in a destructive callout.
  • Forms: typed text, numbers, booleans, and choices with defaults and validation, checked in the UI and again at the bridge boundary. Actions stay pinned while fields scroll. Unsupported schemas offer only Decline.
  • URLs: show the destination and open only on user action. Acceptance means the URL opened, not that sign-in completed.
  • Long prompts: titles are capped at the 160-character interaction limit; the card shows the full message when the title truncates it.
  • Provider-origin cards: the core composer no longer adds "Asked by the agent through " above cards from the thread's own provider (Codex, Pi). Plugin-origin cards keep "Requested by ".
  • Docs and stories: CLI/SDK responses for every request kind are in the codex-provider skill. A Ladle story covers each card state.

Changes from #3113 required by current main:

  • The experimental_hideHeader SDK API is dropped, along with the SDK version bump and the audit entry. Main's pending-interaction shell owns the title.
  • No host-daemon protocol bump: no server/daemon wire fields change.
  • Response encoding shares providerInteractionOutcomeSchema with main's Codex user_question path.
  • Tests use only public SDK imports, keeping the plugin forkable.

Previews

Live Computer Use request from Codex:

Computer Use request for Calculator

High-risk app access:

High-risk Computer Use request with warning callout

Form, with actions pinned while fields scroll:

MCP form with team choice and text fields

URL request:

MCP URL request for GitHub sign-in

Unsupported schema:

Unsupported MCP request with Decline only

How you verified

  • pnpm exec turbo run typecheck test lint --filter=bb-plugin-provider-codex: 496 tests pass. @bb/app typecheck and lint pass; composer and banner tests pass. @bb/agent-runtime tests pass.
  • The long-prompt regression fails when the title cap is removed.
  • Live dev instance: a real Codex Computer Use request rendered the card with Calculator's native icon. Decline resolved as {"action":"decline"}, and Codex reported that access was not approved.
  • The form, URL, high-risk, and unsupported previews come from the Ladle story; no live MCP server sent those kinds.

Fixes #4645

AGENT GENERATED

Maintainer follow-up (rebased on main)

  • Computer Use card is no longer spoofable: it now requires the cua_repl server plus connector_id: "computer-use". The same _meta from any other server renders as a plain tool approval. Every card names the requesting MCP server.
  • MCP tool-call approvals (codex_approval_kind: "mcp_tool_call") get a tool_approval card showing server, tool, description and (size-capped) arguments, with Allow / Decline, plus session/always scopes only when _meta.persist offers them.
  • Core attribution restored: the "Asked by the agent through …" byline change in PluginPendingInteractionComposer.tsx is reverted.
  • Stop turn / disconnect now answers Codex with {action:"cancel"} instead of a JSON-RPC error (Codex was turning that into a decline).
  • Titles reuse PLUGIN_INTERACTION_MAX_TITLE_LENGTH (re-exported from @get-bb/plugin-sdk/provider-bridge) and truncate without splitting surrogate pairs; fixed the card bundle's browser build. Plugin SDK → 0.6.57.
  • Verified end to end against codex-cli 0.163.0 with a throwaway MCP server: form, URL, tool approval (once/session/decline), spoofed Computer Use, and stop-turn cancel.

@maxweissenbaeck

Copy link
Copy Markdown

+1

sms-yui and others added 7 commits October 19, 2026 20:19
Codex's mcpServer/elicitation/request was rejected, so Computer Use app
access was silently declined and other MCP forms could not collect answers.

- Computer Use: native app icon, session/always scopes, Decline, and
  visible high-risk warnings. Codex owns grant persistence.
- Forms: typed text, numbers, booleans, and choices with defaults and
  validation in the UI and again at the bridge boundary.
- URLs: show the destination and open only on user action.

Rebased onto main's pending-interaction shell: the shell's title carries
the request ("Allow Codex to use <App>?" for app access), so the
experimental_hideHeader SDK API is dropped. Docs live in the
codex-provider skill. No wire changes, so no host-daemon protocol bump.
- One source row: app icon with a Computer Use badge and its bundle ID,
  or the MCP server name, replacing three stacked attribution lines.
- High-risk warnings render as a destructive callout.
- Form actions stay pinned while fields scroll in the pending-interaction
  shell, instead of a nested scroll that hid Submit below the fold.
- Boolean fields lay out inline; the URL preview drops its misleading
  link arrow.
- App icons are fetched at 64px so they stay sharp on 2x displays.
- Ladle story covers every elicitation state.
"Asked by the agent through <provider>" repeated what the thread and the
card already say. Plugin-origin cards keep "Requested by <plugin>",
since that is the only sign of which plugin is asking.
…ction cards"

Restores the "Asked by the agent through <provider>" line on every
provider-origin plugin card. It is the only sign in core of which provider
plugin is relaying a request; the Codex MCP elicitation card now names the
requesting MCP server itself, so the two lines answer different questions.

This reverts commit b549ecff3c.
Computer Use identity: the Computer Use card was chosen from
`_meta.connector_id`/`connector_name` alone, which any MCP server can set:
Codex forwards a server's elicitation `_meta` verbatim (verified against
codex-cli 0.163.0). The card now requires Codex's own Computer Use server
(`cua_repl`, which Codex names itself) plus the `computer-use` connector;
the same metadata from any other server shows as a plain tool approval.
The Computer Use card also names the requesting server.

MCP tool-call approvals: Codex asks before running an MCP tool with a
fieldless form tagged `codex_approval_kind: "mcp_tool_call"`. These now
decode to a `tool_approval` card that shows the server, tool, description
and arguments (`tool_params_display`, falling back to `tool_params`, bounded
in count and length), with Allow / Decline plus "Allow for this session" and
"Always allow" when `_meta.persist` offers them. Answers encode as
`{action:"accept", content:{}, _meta:{persist}|null}`, which Codex honours
(a session grant stops the next prompt). A generic fieldless form now says
"Accept" instead of "Submit response".

Stop turn / disconnect: the runtime answers an interrupted interaction
with a JSON-RPC error, which the bridge forwarded to Codex as an error.
For MCP elicitations the bridge now answers `{action:"cancel"}` when the
runtime request fails or resolves with anything but a request answer;
invalid answers still fail closed with an error.

Titles: truncate with the shared PLUGIN_INTERACTION_MAX_TITLE_LENGTH, now
re-exported from @get-bb/plugin-sdk/provider-bridge (SDK 0.6.56; the plugin
requires >=0.6.56), without splitting surrogate pairs.

The earlier tsconfig change that dropped the @get-bb/plugin-sdk path
mappings stays: the package's `types` exports already point at the same
bundled declarations, and with `resolve.tsconfigPaths` (needed for the
`@/components/ui/*` aliases in the view tests) Vitest would otherwise
resolve runtime SDK imports to .d.ts files. Other plugins with tsx tests
use the same setup.

Fixtures for the tool approval and the spoofed Computer Use request were
captured from codex-cli 0.163.0 app-server.
…d bound tool args

The title helper imported PLUGIN_INTERACTION_MAX_TITLE_LENGTH from
@get-bb/plugin-sdk/provider-bridge inside mcp-elicitation.ts, which app.tsx
also imports. That pulled Node-only modules (cross-spawn, fs) into the
frontend bundle and the server's rebuild failed, leaving every Codex
elicitation as "The plugin form is unavailable". The title helper now lives
in host-only mcp-elicitation-title.ts.

Tool approval arguments are also held to a 32 KiB byte budget (on top of
the 50-argument and 2000-character caps) so a request with large arguments
stays under the 64 KiB interaction payload limit instead of being rejected.
@SawyerHood
SawyerHood force-pushed the scott/mcp-elicitation branch from 895e7c0 to a976332 Compare October 19, 2026 20:20
@SawyerHood
SawyerHood merged commit 595087a into get-bb:main Oct 19, 2026
46 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.

Codex Browser Use approvals are auto-declined in accept-edits mode (no interaction shown)

4 participants