mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
[codex] Add plugin id to MCP tool call items (#23737)
Add owning plugin id to MCP tool call items so we can better filter them at plugin level. ## Summary - add optional `plugin_id` to MCP tool-call items and legacy begin/end events - propagate plugin metadata into emitted core items and app-server v2 `ThreadItem::McpToolCall` - preserve plugin ids through app-server replay/redaction paths and regenerate v2 schema fixtures ## Testing - `just write-app-server-schema` - `just fmt` - `just fix -p codex-core` - `cargo test -p codex-protocol -p codex-app-server-protocol` - `cargo test -p codex-app-server-protocol` - `cargo test -p codex-core mcp_tool_call_item_includes_plugin_id --lib` - `cargo check -p codex-tui --tests` - `cargo check -p codex-app-server --tests` - `git diff --check` ## Notes - `just fix -p codex-core` completed with two non-fatal `too_many_arguments` warnings on the touched MCP notification helpers. - A broader `cargo test -p codex-core` run passed core unit tests, then hit shell/sandbox/snapshot failures in the integration target. - A broader app-server downstream run hit the existing `in_process::tests::in_process_start_clamps_zero_channel_capacity` stack overflow; `cargo test -p codex-exec` also hit the existing sandbox expectation mismatch in `thread_lifecycle_params_include_legacy_sandbox_when_no_active_profile`.
This commit is contained in:
@@ -72,6 +72,7 @@ fn mcp_tool_call_result_preserves_meta_in_jsonl_event() {
|
||||
status: McpToolCallStatus::Completed,
|
||||
arguments: json!({"search_query": [{"q": "OpenAI Codex CLI documentation"}]}),
|
||||
mcp_app_resource_uri: None,
|
||||
plugin_id: None,
|
||||
result: Some(Box::new(codex_app_server_protocol::McpToolCallResult {
|
||||
content: vec![json!({"type": "text", "text": "search result"})],
|
||||
structured_content: None,
|
||||
|
||||
@@ -478,6 +478,7 @@ fn mcp_tool_call_begin_and_end_emit_item_events() {
|
||||
status: ApiMcpToolCallStatus::InProgress,
|
||||
arguments: json!({ "key": "value" }),
|
||||
mcp_app_resource_uri: None,
|
||||
plugin_id: None,
|
||||
result: None,
|
||||
error: None,
|
||||
duration_ms: None,
|
||||
@@ -495,6 +496,7 @@ fn mcp_tool_call_begin_and_end_emit_item_events() {
|
||||
status: ApiMcpToolCallStatus::Completed,
|
||||
arguments: json!({ "key": "value" }),
|
||||
mcp_app_resource_uri: None,
|
||||
plugin_id: None,
|
||||
result: Some(Box::new(McpToolCallResult {
|
||||
content: Vec::new(),
|
||||
structured_content: None,
|
||||
@@ -566,6 +568,7 @@ fn mcp_tool_call_failure_sets_failed_status() {
|
||||
status: ApiMcpToolCallStatus::Failed,
|
||||
arguments: json!({ "param": 42 }),
|
||||
mcp_app_resource_uri: None,
|
||||
plugin_id: None,
|
||||
result: None,
|
||||
error: Some(McpToolCallError {
|
||||
message: "tool exploded".to_string(),
|
||||
@@ -614,6 +617,7 @@ fn mcp_tool_call_defaults_arguments_and_preserves_structured_content() {
|
||||
status: ApiMcpToolCallStatus::InProgress,
|
||||
arguments: serde_json::Value::Null,
|
||||
mcp_app_resource_uri: None,
|
||||
plugin_id: None,
|
||||
result: None,
|
||||
error: None,
|
||||
duration_ms: None,
|
||||
@@ -631,6 +635,7 @@ fn mcp_tool_call_defaults_arguments_and_preserves_structured_content() {
|
||||
status: ApiMcpToolCallStatus::Completed,
|
||||
arguments: serde_json::Value::Null,
|
||||
mcp_app_resource_uri: None,
|
||||
plugin_id: None,
|
||||
result: Some(Box::new(McpToolCallResult {
|
||||
content: vec![json!({
|
||||
"type": "text",
|
||||
|
||||
Reference in New Issue
Block a user