mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Use captured step settings for tool planning and execution (#44242)
## Why After a model change within a turn, tools could still use the turn's original model capabilities, output limits, and telemetry attribution. ## What changed - Build each step's tool plan from its captured model settings. - Use those settings for image support and detail, command and MCP output truncation, extension metadata, and tool telemetry. - Preserve the issuing step's model for delayed command completion events while allowing later `write_stdin` calls to use their own step's output limits. ## Testing Add regression coverage for model changes within a turn, including tool replanning, Code Mode execution, image handling, MCP tool and resource output limits, extension settings, and delayed command completion. GitOrigin-RevId: ef991598e89a846889baf770a0c9e12e56886d5d
This commit is contained in:
1 parent
ed4ca07ba6
commit
205f3671e1
24 files changed
+1053
-241
No files matched your search
@@ -1,7 +1,7 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::session::turn_context::TurnContext;
|
||||
use codex_mcp::MCP_TOOL_CODEX_APPS_META_KEY;
|
||||
use codex_otel::SessionTelemetry;
|
||||
use codex_otel::sanitize_metric_tag_value;
|
||||
use codex_protocol::mcp::CallToolResult;
|
||||
use serde_json::Value as JsonValue;
|
||||
@@ -38,7 +38,7 @@ impl McpCallMetricOutcome {
|
||||
}
|
||||
|
||||
pub(super) fn emit_mcp_call_metrics(
|
||||
turn_context: &TurnContext,
|
||||
session_telemetry: &SessionTelemetry,
|
||||
outcome: &McpCallMetricOutcome,
|
||||
server_name: &str,
|
||||
tool_name: &str,
|
||||
@@ -57,15 +57,9 @@ pub(super) fn emit_mcp_call_metrics(
|
||||
.iter()
|
||||
.map(|(key, value)| (*key, value.as_str()))
|
||||
.collect();
|
||||
turn_context
|
||||
.session_telemetry
|
||||
.counter(MCP_CALL_COUNT_METRIC, /*inc*/ 1, &tag_refs);
|
||||
session_telemetry.counter(MCP_CALL_COUNT_METRIC, /*inc*/ 1, &tag_refs);
|
||||
if let Some(duration) = duration {
|
||||
turn_context.session_telemetry.record_duration(
|
||||
MCP_CALL_DURATION_METRIC,
|
||||
duration,
|
||||
&tag_refs,
|
||||
);
|
||||
session_telemetry.record_duration(MCP_CALL_DURATION_METRIC, duration, &tag_refs);
|
||||
}
|
||||
|
||||
let (Some(error_type), Some(error_code)) = (outcome.error_type, outcome.error_code.as_deref())
|
||||
@@ -79,11 +73,7 @@ pub(super) fn emit_mcp_call_metrics(
|
||||
.iter()
|
||||
.map(|(key, value)| (*key, value.as_str()))
|
||||
.collect();
|
||||
turn_context.session_telemetry.counter(
|
||||
MCP_CALL_ERROR_COUNT_METRIC,
|
||||
/*inc*/ 1,
|
||||
&error_tag_refs,
|
||||
);
|
||||
session_telemetry.counter(MCP_CALL_ERROR_COUNT_METRIC, /*inc*/ 1, &error_tag_refs);
|
||||
}
|
||||
|
||||
fn mcp_call_metric_tags(
|
||||
|
||||
Reference in new issue
Block a user