Exclude synthetic app links from approval metadata

This commit is contained in:
Alex Zamoshchin
2026-06-15 12:14:59 -07:00
parent 5061fe7714
commit e699e15061
2 changed files with 18 additions and 1 deletions

View File

@@ -1498,7 +1498,13 @@ fn connector_link_id_for_server(
server: &str,
meta: Option<&serde_json::Map<String, serde_json::Value>>,
) -> Option<String> {
if server != CODEX_APPS_MCP_SERVER_NAME {
if server != CODEX_APPS_MCP_SERVER_NAME
|| meta
.and_then(|meta| meta.get(MCP_TOOL_CODEX_APPS_META_KEY))
.and_then(|codex_apps_meta| codex_apps_meta.get("synthetic_link"))
.and_then(serde_json::Value::as_bool)
== Some(true)
{
return None;
}

View File

@@ -369,6 +369,17 @@ fn connector_link_id_is_only_honored_for_codex_apps() {
Some("link_123".to_string())
);
assert_eq!(connector_link_id_for_server("custom_server", meta), None);
let synthetic_link_meta = serde_json::json!({
MCP_TOOL_APPROVAL_LINK_ID_KEY: "synthetic_link::calendar",
MCP_TOOL_CODEX_APPS_META_KEY: {
"synthetic_link": true,
},
});
assert_eq!(
connector_link_id_for_server(CODEX_APPS_MCP_SERVER_NAME, synthetic_link_meta.as_object()),
None
);
}
#[test]