core: rename metadata -> internal_chat_message_metadata_passthrough (#28968)

## Description
This PR cuts Codex over from generic `ResponseItem.metadata` (introduced
here: https://github.com/openai/codex/pull/28355) to
`ResponseItem.internal_chat_message_metadata_passthrough`, which is the
blessed path and has strongly-typed keys.

For now we have to drop this MAv2 usage of `metadata`:
https://github.com/openai/codex/pull/28561 until we figure out where
that should live.
This commit is contained in:
Owen Lin authored and GitHub committed 2026-06-22 11:11:25 -07:00
1 parent 9f06cf1a09
commit 5b95745eae
77 files changed
+866 -797

No files matched your search

@@ -329,7 +329,7 @@ mod tests {
text: "extension history".to_string(),
}],
phase: None,
metadata: None,
internal_chat_message_metadata_passthrough: None,
};
session
.record_conversation_items(&turn, std::slice::from_ref(&history_item))
@@ -1198,11 +1198,6 @@ async fn multi_agent_v2_spawn_returns_path_and_send_message_accepts_relative_pat
&& communication.other_recipients.is_empty()
&& communication.content.is_empty()
&& communication.encrypted_content.as_deref() == Some("encrypted-spawn-message")
&& communication
.metadata
.as_ref()
.and_then(|metadata| metadata.source_call_id.as_deref())
== Some("call-1")
&& communication.trigger_turn
)
}));
@@ -1230,11 +1225,6 @@ async fn multi_agent_v2_spawn_returns_path_and_send_message_accepts_relative_pat
&& communication.other_recipients.is_empty()
&& communication.content.is_empty()
&& communication.encrypted_content.as_deref() == Some("encrypted-send-message")
&& communication
.metadata
.as_ref()
.and_then(|metadata| metadata.source_call_id.as_deref())
== Some("call-1")
&& !communication.trigger_turn
)
}));
@@ -2048,11 +2038,6 @@ async fn multi_agent_v2_followup_task_completion_notifies_parent_on_every_turn()
if communication.author == AgentPath::root()
&& communication.recipient == worker_path
&& communication.encrypted_content.as_deref() == Some("continue")
&& communication
.metadata
.as_ref()
.and_then(|metadata| metadata.source_call_id.as_deref())
== Some("call-1")
&& communication.trigger_turn
)
}));
@@ -2831,7 +2816,7 @@ async fn resume_agent_restores_closed_agent_and_accepts_send_input() {
text: "materialized".to_string(),
}],
phase: None,
metadata: None,
internal_chat_message_metadata_passthrough: None,
})]),
AuthManager::from_auth_for_testing(CodexAuth::from_api_key("dummy")),
/*parent_trace*/ None,
@@ -6,7 +6,6 @@
use super::*;
use crate::tools::context::FunctionToolOutput;
use crate::turn_timing::now_unix_timestamp_ms;
use codex_protocol::models::ResponseItemMetadata;
use codex_protocol::protocol::InterAgentCommunication;
#[derive(Clone, Copy, PartialEq, Eq)]
@@ -100,12 +99,8 @@ pub(crate) async fn handle_message_string_tool(
.session_source
.get_agent_path()
.unwrap_or_else(AgentPath::root);
let mut communication =
let communication =
communication_from_tool_message(author, receiver_agent_path.clone(), message);
communication
.metadata
.get_or_insert_with(ResponseItemMetadata::default)
.source_call_id = Some(call_id.clone());
let result = session
.services
.agent_control
@@ -8,7 +8,6 @@ use crate::tools::handlers::multi_agents_spec::SpawnAgentToolOptions;
use crate::tools::handlers::multi_agents_spec::create_spawn_agent_tool_v2;
use crate::turn_timing::now_unix_timestamp_ms;
use codex_protocol::AgentPath;
use codex_protocol::models::ResponseItemMetadata;
use codex_protocol::protocol::Op;
use codex_tools::ToolSpec;
@@ -123,12 +122,8 @@ async fn handle_spawn_agent(
.session_source
.get_agent_path()
.unwrap_or_else(AgentPath::root);
let mut communication =
let communication =
communication_from_tool_message(author, new_agent_path.clone(), message);
communication
.metadata
.get_or_insert_with(ResponseItemMetadata::default)
.source_call_id = Some(call_id.clone());
Op::InterAgentCommunication { communication }
}
initial_operation => initial_operation,