mirror of
https://github.com/openai/codex.git
synced 2026-10-23 18:08:45 +00:00
## What changed Move duplicated action preparation into `codex_guardian_context::action_for_review`, shared by approval rendering and cached-evidence size checks. Preserve the existing behavior: omit top-level `tool_description` and `connector_description` metadata from MCP tool calls while keeping tool arguments intact. ## Testing Add unit tests verifying that MCP arguments retain description fields, including nested fields, and that other action types remain unchanged. GitOrigin-RevId: 8e890fb263556596f695177f917750377c04d43c
42 lines
1.2 KiB
Rust
42 lines
1.2 KiB
Rust
//! Approval projections omit optional host metadata without changing the actual action.
|
|
|
|
use super::action_for_review;
|
|
use pretty_assertions::assert_eq;
|
|
use serde_json::json;
|
|
|
|
#[test]
|
|
fn mcp_projection_preserves_arguments_with_description_fields() {
|
|
let arguments = json!({
|
|
"description": "required argument",
|
|
"tool_description": "also an argument",
|
|
"nested": {"connector_description": "required nested argument"},
|
|
});
|
|
let action = json!({
|
|
"tool": "mcp_tool_call",
|
|
"server": "example",
|
|
"tool_name": "publish",
|
|
"tool_description": "optional host metadata",
|
|
"connector_description": "optional connector metadata",
|
|
"arguments": arguments,
|
|
});
|
|
assert_eq!(
|
|
action_for_review(action),
|
|
json!({
|
|
"tool": "mcp_tool_call",
|
|
"server": "example",
|
|
"tool_name": "publish",
|
|
"arguments": arguments,
|
|
}),
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn other_actions_preserve_description_fields() {
|
|
let action = json!({
|
|
"tool": "custom_action",
|
|
"tool_description": "required argument",
|
|
"connector_description": "also required",
|
|
});
|
|
assert_eq!(action_for_review(action.clone()), action);
|
|
}
|