mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Use captured step settings for request metadata and tool hooks (#45248)
## Why Model and reasoning effort updates during a turn can leave request metadata and tool hooks reporting the turn's initial settings. Metadata should describe the step that issued the request or tool call. ## What changed - Share captured execution metadata across Responses, MCP, and extension tool calls, including model, reasoning effort, and automatic review and Node REPL flags. - Build Responses tool inventory metadata from the issuing step's finalized tool router. Attach the finalized inventory separately for remote compaction. - Use captured step settings for pre- and post-tool hooks, and captured review settings for permission-request hooks. ## Testing Add and extend regression tests for model and effort changes during a turn, MCP metadata, pre-tool hook model attribution, captured review flags, and tool inventory matching the issuing request. GitOrigin-RevId: 9dee46a8b4839de8b434cdad4ed441cc0bb6ff9b
This commit is contained in:
1 parent
36f0dbe796
commit
16537b20a5
20 files changed
+545
-255
No files matched your search
@@ -26,7 +26,7 @@ use crate::tools::handlers::apply_granted_turn_permissions;
|
||||
use crate::tools::lifecycle::extension_tool_call_source;
|
||||
use crate::tools::registry::CoreToolRuntime;
|
||||
use crate::tools::registry::ToolExecutor;
|
||||
use crate::turn_metadata::McpTurnMetadataContext;
|
||||
use crate::turn_metadata::ExecutionMetadata;
|
||||
|
||||
pub(crate) struct ExtensionToolAdapter(
|
||||
Arc<dyn for<'call> codex_tools::ToolExecutor<ExtensionToolCall<'call>>>,
|
||||
@@ -170,11 +170,9 @@ async fn to_extension_call(invocation: &ToolInvocation) -> ExtensionToolCall<'_>
|
||||
let codex_turn_metadata = invocation
|
||||
.turn
|
||||
.turn_metadata_state
|
||||
.current_meta_value_for_mcp_request(McpTurnMetadataContext {
|
||||
model: settings.model_info.slug.as_str(),
|
||||
reasoning_effort: settings.effective_reasoning_effort(),
|
||||
node_repl_disabled: settings.model_info.node_repl_disabled,
|
||||
})
|
||||
.current_meta_value_for_mcp_request(ExecutionMetadata::from_settings(
|
||||
&invocation.step_context.settings,
|
||||
))
|
||||
.and_then(|metadata| to_ascii_json_string(&metadata).ok());
|
||||
let mut environments = Vec::new();
|
||||
for environment in invocation.step_context.environments.turn_environments() {
|
||||
|
||||
Reference in new issue
Block a user