mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Use step settings for MCP request metadata (#40807)
## Why MCP tool calls can be issued by a model step whose settings differ from the turn's initial settings. Request metadata must describe the issuing step. ## What changed - Build MCP tool-call metadata from the captured `StepContext` model and its effective reasoning effort. - Populate `node_repl_disabled` from the issuing step while leaving turn-owned Responses metadata unchanged. - Apply the same step-scoped values to MCP requests emitted by stop hooks. ## Testing Add coverage for configured and model-default reasoning effort, model changes, Node REPL restrictions, and preservation of the original step and turn metadata. GitOrigin-RevId: f9cce52fbe559f15437bd19d699b657229c0d145
This commit is contained in:
1 parent
3e4707b34b
commit
04907ab95a
8 files changed
+98
-14
No files matched your search
@@ -466,7 +466,7 @@ async fn handle_approved_mcp_tool_call(
|
||||
tool_input = rewritten_arguments.clone();
|
||||
}
|
||||
let request_meta = build_mcp_tool_call_request_meta(
|
||||
turn_context,
|
||||
step_context,
|
||||
&server,
|
||||
call_id,
|
||||
Some(&metadata),
|
||||
@@ -1180,7 +1180,7 @@ async fn custom_mcp_tool_approval_mode(
|
||||
}
|
||||
|
||||
fn build_mcp_tool_call_request_meta(
|
||||
turn_context: &TurnContext,
|
||||
step_context: &StepContext,
|
||||
server: &str,
|
||||
call_id: &str,
|
||||
metadata: Option<&McpToolApprovalMetadata>,
|
||||
@@ -1191,11 +1191,13 @@ fn build_mcp_tool_call_request_meta(
|
||||
serde_json::Value::String(call_id.to_string()),
|
||||
);
|
||||
|
||||
if let Some(turn_metadata) = turn_context
|
||||
if let Some(turn_metadata) = step_context
|
||||
.turn
|
||||
.turn_metadata_state
|
||||
.current_meta_value_for_mcp_request(McpTurnMetadataContext {
|
||||
model: turn_context.model_info().slug.as_str(),
|
||||
reasoning_effort: turn_context.effective_reasoning_effort(),
|
||||
model: step_context.settings.model_info.slug.as_str(),
|
||||
reasoning_effort: step_context.settings.effective_reasoning_effort(),
|
||||
node_repl_disabled: step_context.settings.model_info.node_repl_disabled,
|
||||
})
|
||||
{
|
||||
request_meta.insert(
|
||||
|
||||
Reference in new issue
Block a user