Include code-mode tool names in Responses Lite metadata (#35271)

## What changed

- Add `code_mode_tool_names` to Responses Lite turn metadata, mapping each normalized code-mode identifier to its structured `ToolName`.
- Reserve the metadata key against client overrides and omit it from metadata exposed to external MCP servers.
- Keep non-Lite requests and the legacy top-level client metadata unchanged.

## Testing

- Cover HTTP and WebSocket Responses Lite requests, including switching from a non-Lite model.
- Verify reserved-key handling and external MCP metadata filtering.

GitOrigin-RevId: b678afba13d57a91e26f5895aa37238fbb4cb276
This commit is contained in:
rka-oai
2026-07-25 01:05:33 +00:00
committed by copyberry
parent 63fe5a6b71
commit 25b6fc9bbc
6 changed files with 124 additions and 0 deletions
+16
View File
@@ -493,6 +493,22 @@ fn build_code_mode_executors(
code_mode_nested_tool_specs.push(spec);
}
if turn_context.model_info.use_responses_lite {
let code_mode_tool_names =
collect_code_mode_exec_prompt_tool_definitions(code_mode_nested_tool_specs.iter())
.into_iter()
.map(|tool| {
(
codex_code_mode::normalize_code_mode_identifier(&tool.name),
tool.tool_name,
)
})
.collect();
turn_context
.turn_metadata_state
.set_code_mode_tool_names(code_mode_tool_names);
}
let namespace_descriptions = code_mode_namespace_descriptions(&exec_prompt_tool_specs);
let mut enabled_tools =
collect_code_mode_exec_prompt_tool_definitions(exec_prompt_tool_specs.iter());