mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Remove the legacy code-mode tool metadata inventory (#37500)
## What changed - Stop adding `code_mode_tool_names` to Responses Lite turn metadata. - Keep `code_mode_tool_names` reserved so client metadata cannot reintroduce the removed, unbounded inventory. - Use the opt-in `tool_namespaces_info` metadata, including each function's `code_mode_name`, when authoritative tool details are requested. ## Testing - Update Responses Lite and code-mode tests to verify the opt-in namespace metadata and normalized code-mode names. GitOrigin-RevId: cbfb9af984de71c7cc175d0cd47ae799a5275309
This commit is contained in:
1 parent
6db53df37f
commit
8e4b10446e
8 files changed
+32
-112
No files matched your search
@@ -1,9 +1,9 @@
|
||||
use super::*;
|
||||
|
||||
use crate::responses_metadata::CODE_MODE_TOOL_NAMES_KEY;
|
||||
use crate::responses_metadata::CodexResponsesRequestKind;
|
||||
use crate::responses_metadata::CompactionTurnMetadata;
|
||||
use crate::responses_metadata::INSTALLATION_ID_KEY;
|
||||
use crate::responses_metadata::LEGACY_CODE_MODE_TOOL_NAMES_KEY;
|
||||
use crate::responses_metadata::PARENT_TURN_ID_KEY;
|
||||
use crate::responses_metadata::TOOL_NAMESPACES_INFO_KEY;
|
||||
use crate::responses_metadata::TurnToolFunctionInfo;
|
||||
@@ -15,7 +15,6 @@ use codex_analytics::CompactionImplementation;
|
||||
use codex_analytics::CompactionPhase;
|
||||
use codex_analytics::CompactionReason;
|
||||
use codex_analytics::CompactionTrigger;
|
||||
use codex_protocol::ToolName;
|
||||
use codex_protocol::models::PermissionProfile;
|
||||
use codex_protocol::openai_models::ReasoningEffort as ReasoningEffortConfig;
|
||||
use codex_protocol::protocol::SessionSource;
|
||||
@@ -550,7 +549,7 @@ fn turn_metadata_state_ignores_client_reserved_metadata_before_start() {
|
||||
);
|
||||
state.set_responsesapi_client_metadata(HashMap::from([
|
||||
(
|
||||
CODE_MODE_TOOL_NAMES_KEY.to_string(),
|
||||
LEGACY_CODE_MODE_TOOL_NAMES_KEY.to_string(),
|
||||
"client-supplied".to_string(),
|
||||
),
|
||||
(
|
||||
@@ -576,7 +575,7 @@ fn turn_metadata_state_ignores_client_reserved_metadata_before_start() {
|
||||
let header = test_turn_metadata_header(&state);
|
||||
let json: Value = serde_json::from_str(&header).expect("json");
|
||||
|
||||
assert!(json.get(CODE_MODE_TOOL_NAMES_KEY).is_none());
|
||||
assert!(json.get(LEGACY_CODE_MODE_TOOL_NAMES_KEY).is_none());
|
||||
assert!(json.get(TOOL_NAMESPACES_INFO_KEY).is_none());
|
||||
assert!(json.get("turn_started_at_unix_ms").is_none());
|
||||
assert!(json.get("forked_from_thread_id").is_none());
|
||||
@@ -650,7 +649,7 @@ fn turn_metadata_state_merges_client_metadata_without_replacing_reserved_fields(
|
||||
("parent_turn_id".to_string(), "client-supplied".to_string()),
|
||||
("subagent_kind".to_string(), "client-supplied".to_string()),
|
||||
(
|
||||
CODE_MODE_TOOL_NAMES_KEY.to_string(),
|
||||
LEGACY_CODE_MODE_TOOL_NAMES_KEY.to_string(),
|
||||
"client-supplied".to_string(),
|
||||
),
|
||||
(
|
||||
@@ -667,13 +666,6 @@ fn turn_metadata_state_merges_client_metadata_without_replacing_reserved_fields(
|
||||
),
|
||||
]));
|
||||
state.set_turn_started_at_unix_ms(/*turn_started_at_unix_ms*/ 1_700_000_000_123);
|
||||
state.set_code_mode_tool_names(BTreeMap::from([
|
||||
("exec_command".to_string(), ToolName::plain("exec_command")),
|
||||
(
|
||||
"mcp__calendar__lookup".to_string(),
|
||||
ToolName::namespaced("mcp__calendar", "lookup"),
|
||||
),
|
||||
]));
|
||||
state.set_tool_namespaces_info(BTreeMap::from([(
|
||||
"mcp__calendar".to_string(),
|
||||
TurnToolNamespaceInfo {
|
||||
@@ -705,19 +697,7 @@ fn turn_metadata_state_merges_client_metadata_without_replacing_reserved_fields(
|
||||
assert_eq!(json["reasoning_effort"].as_str(), Some("client-supplied"));
|
||||
assert_eq!(json["session_id"].as_str(), Some("session-a"));
|
||||
assert_eq!(json["thread_id"].as_str(), Some("thread-a"));
|
||||
assert_eq!(
|
||||
json[CODE_MODE_TOOL_NAMES_KEY],
|
||||
serde_json::json!({
|
||||
"exec_command": {
|
||||
"name": "exec_command",
|
||||
"namespace": null,
|
||||
},
|
||||
"mcp__calendar__lookup": {
|
||||
"name": "lookup",
|
||||
"namespace": "mcp__calendar",
|
||||
},
|
||||
})
|
||||
);
|
||||
assert!(json.get(LEGACY_CODE_MODE_TOOL_NAMES_KEY).is_none());
|
||||
assert_eq!(
|
||||
json[TOOL_NAMESPACES_INFO_KEY],
|
||||
serde_json::json!({
|
||||
@@ -795,7 +775,7 @@ fn turn_metadata_state_merges_client_metadata_without_replacing_reserved_fields(
|
||||
.expect("compatibility metadata json");
|
||||
assert!(
|
||||
compatibility_metadata
|
||||
.get(CODE_MODE_TOOL_NAMES_KEY)
|
||||
.get(LEGACY_CODE_MODE_TOOL_NAMES_KEY)
|
||||
.is_none()
|
||||
);
|
||||
assert!(
|
||||
@@ -809,7 +789,7 @@ fn turn_metadata_state_merges_client_metadata_without_replacing_reserved_fields(
|
||||
.expect("turn metadata should be present");
|
||||
assert_eq!(meta["model"].as_str(), Some("gpt-5.4"));
|
||||
assert_eq!(meta["reasoning_effort"].as_str(), Some("high"));
|
||||
assert!(meta.get(CODE_MODE_TOOL_NAMES_KEY).is_none());
|
||||
assert!(meta.get(LEGACY_CODE_MODE_TOOL_NAMES_KEY).is_none());
|
||||
assert!(meta.get(TOOL_NAMESPACES_INFO_KEY).is_none());
|
||||
assert!(meta.get(PARENT_TURN_ID_KEY).is_none());
|
||||
assert!(meta.get(WINDOW_ID_KEY).is_none());
|
||||
|
||||
Reference in new issue
Block a user