mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
Deduplicate MCP text fallbacks in Code Mode output (#63540)
## Why MCP tools can return structured data alongside a JSON text fallback for clients that need it. Printing the whole result in Code Mode can show the same data twice. ## What changed Enable `features.code_mode_mcp_result_dedup` to let `text()` omit `content` when it prints an original, successful MCP result whose only content block is a plain text fallback that parses to the same JSON as `structuredContent`. The JavaScript result retains both fields. Carry the result format through gRPC so the host can distinguish MCP results from ordinary JSON. The feature is off by default. ## Testing Add coverage for both feature flag settings, for printing original MCP results and copies through gRPC, and for comparing equivalent JSON. GitOrigin-RevId: a8b0b42f5375d9744c235a0e663090dd5982e37e
This commit is contained in:
@@ -9,6 +9,7 @@ use codex_code_mode_runtime::CellId;
|
||||
use codex_code_mode_runtime::CodeModeNestedToolCall;
|
||||
use codex_code_mode_runtime::CodeModeSessionDelegate;
|
||||
use codex_code_mode_runtime::CodeModeToolKind;
|
||||
use codex_code_mode_runtime::CodeModeToolResult;
|
||||
use codex_code_mode_runtime::ExecuteRequest;
|
||||
use codex_code_mode_runtime::FunctionCallOutputContentItem;
|
||||
use codex_code_mode_runtime::InProcessCodeModeSession;
|
||||
@@ -39,7 +40,7 @@ impl CodeModeSessionDelegate for RecordingDelegate {
|
||||
.lock()
|
||||
.unwrap_or_else(PoisonError::into_inner)
|
||||
.push(invocation.tool_name);
|
||||
Box::pin(async { Ok(json!({"ok": true})) })
|
||||
Box::pin(async { Ok(CodeModeToolResult::from(json!({"ok": true}))) })
|
||||
}
|
||||
|
||||
fn notify<'a>(
|
||||
|
||||
Reference in New Issue
Block a user