mirror of
https://github.com/openai/codex.git
synced 2026-11-28 15:33:11 +00:00
Honor app link settings for MCP tool approvals (#42056)
## What changed - Pass the resolved app `link_id` into MCP tool approval policy evaluation. - Apply link-specific `default_tools_approval_mode` and `approvals_reviewer` settings before app and global defaults, while preserving per-tool and managed policy precedence. ## Testing - Cover link-specific approval prompts, selected account links, reviewer routing, fallback behavior, and managed-policy overrides. GitOrigin-RevId: caa07ec3e73c87aad9522bd69808cd1c0b1686f5
This commit is contained in:
1 parent
0e37d834d4
commit
3a04482645
11 files changed
+429
-39
No files matched your search
@@ -22,10 +22,11 @@ impl Default for AppToolPolicy {
|
||||
}
|
||||
}
|
||||
|
||||
/// Connector-owned metadata used to evaluate one app tool.
|
||||
/// App and account metadata used to evaluate one tool.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct AppToolPolicyInput<'a> {
|
||||
pub connector_id: Option<&'a str>,
|
||||
pub link_id: Option<&'a str>,
|
||||
pub tool_name: &'a str,
|
||||
pub tool_title: Option<&'a str>,
|
||||
pub destructive_hint: Option<bool>,
|
||||
@@ -186,6 +187,12 @@ fn app_tool_policy_from_apps_config(
|
||||
});
|
||||
let approval = managed_approval
|
||||
.or_else(|| tool_config.and_then(|tool| tool.approval_mode))
|
||||
.or_else(|| {
|
||||
input
|
||||
.link_id
|
||||
.and_then(|link_id| app?.links.as_ref()?.links.get(link_id))
|
||||
.and_then(|link| link.default_tools_approval_mode)
|
||||
})
|
||||
.or_else(|| app.and_then(|app| app.default_tools_approval_mode))
|
||||
.or_else(|| {
|
||||
input
|
||||
|
||||
Reference in new issue
Block a user