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:
Abhinav authored and copyberry committed 2026-08-26 05:58:04 +00:00
1 parent 3e4707b34b
commit 04907ab95a
8 files changed
+98 -14

No files matched your search

+2
View File
@@ -45,6 +45,7 @@ fn test_mcp_turn_metadata_context() -> McpTurnMetadataContext<'static> {
McpTurnMetadataContext {
model: "gpt-5.4",
reasoning_effort: Some(ReasoningEffortConfig::High),
node_repl_disabled: false,
}
}
@@ -501,6 +502,7 @@ fn turn_metadata_state_includes_model_and_reasoning_effort_only_in_request_meta(
.current_meta_value_for_mcp_request(McpTurnMetadataContext {
model: "gpt-5.4",
reasoning_effort: None,
node_repl_disabled: false,
})
.expect("turn metadata should be present");
assert_eq!(