Skip to content

Add option to approve and remember MCP/Apps tool usage#10584

Merged
canvrno-oai merged 5 commits intomainfrom
canvrno/mcp_elicitation_changes
Feb 4, 2026
Merged

Add option to approve and remember MCP/Apps tool usage#10584
canvrno-oai merged 5 commits intomainfrom
canvrno/mcp_elicitation_changes

Conversation

@canvrno-oai
Copy link
Contributor

This PR adds a new approval option for app/MCP tool calls: “Allow and remember” (session-scoped).
When selected, Codex stores a temporary approval and auto-approves matching future calls for the rest of the session.

Added a session-scoped approval key (server, connector_id, tool_name) and persisted it in tool_approvals as ApprovedForSession.
On subsequent matching calls, approval is skipped and treated as accepted.

  • Updated the approval question options to conditionally include:
  • Accept
  • Allow and remember (conditional)
  • Decline
  • Cancel

The new “Allow and remember” option is only shown when all of these are true:

  1. The call is routed through the Codex Apps MCP server (codex_apps).
  2. The tool requires approval based on annotations:
  • read_only_hint == false, and
  • destructive_hint == true or open_world_hint == true.
  1. The tool includes a connector_id in metadata (used to build the remembered approval key).

If no connector_id is present, the prompt still appears (when approval is required), but only with the existing choices (Accept / Decline / Cancel). Approval prompting in this path has an explicit early return unless server == codex_apps.

@etraut-openai etraut-openai added the oai PRs contributed by OpenAI employees label Feb 4, 2026
@canvrno-oai canvrno-oai marked this pull request as ready for review February 4, 2026 03:52
}

const MCP_TOOL_APPROVAL_QUESTION_ID_PREFIX: &str = "mcp_tool_call_approval";
const MCP_TOOL_APPROVAL_ACCEPT: &str = "Accept";
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make them match the phrases we use for command approval so we can unify them later? i.e.
"Accept" -> "Approve Once"
"Allow and remember" -> "Approve this Session"
"Decline" -> "Deny"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mzeng-openai For commands, here are the phrases we have now:

  1. Yes, proceed (y)
  2. Yes, and don't ask again for commands that start with `echo hello world` (p)
  3. No, and tell Codex what to do differently (esc)

How would you feel about something like:

 1. Yes, proceed once (y)
 2. Yes, and don't ask again for this tool and this session (p)
 3. No (esc)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ive updated the phrasing, we can adjust or unify next.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh you are right, the phrases I was mentioning are from the webview. That complicates things a little bit because the phrases we use for elicitation here are reused both in the CLI and the webview. So I guess either way works (my slight preference is to use the webview version since it's cleaner but your call)

@mzeng-openai
Copy link
Contributor

This is great! Just one nit on the copy, otherwise good to go! Have we tested locally?

Copy link
Contributor

@mzeng-openai mzeng-openai left a comment

Choose a reason for hiding this comment

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

Approve to unblock

@canvrno-oai
Copy link
Contributor Author

This is great! Just one nit on the copy, otherwise good to go! Have we tested locally?

Yes, I tested with the slack connector.

const MCP_TOOL_APPROVAL_QUESTION_ID_PREFIX: &str = "mcp_tool_call_approval";
const MCP_TOOL_APPROVAL_ACCEPT: &str = "Accept";
const MCP_TOOL_APPROVAL_DECLINE: &str = "Decline";
const MCP_TOOL_APPROVAL_ACCEPT: &str = "Yes, proceed once (y)";
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: The hotkey here will not work on webview, you have to either

  1. Drop the hotkey
  2. Check the originator() and optionally add it when the originator is codex_cli_rs

Copy link
Contributor Author

@canvrno-oai canvrno-oai Feb 4, 2026

Choose a reason for hiding this comment

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

Thanks for catching that! For now I'm going to remove the hotkeys, and implement the second recommendation in a fast follow. Also adjusting the labels as described above.

@canvrno-oai
Copy link
Contributor Author

/merge

@canvrno-oai canvrno-oai merged commit 282f42c into main Feb 4, 2026
36 of 38 checks passed
@canvrno-oai canvrno-oai deleted the canvrno/mcp_elicitation_changes branch February 4, 2026 17:38
@github-actions github-actions bot locked and limited conversation to collaborators Feb 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

oai PRs contributed by OpenAI employees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants