Use a shared ToolCallId for dispatched tool invocations (#62888)

## Why

Dispatched invocations, model-visible Responses calls, and Code Mode's
per-cell runtime calls use IDs with different roles. A dedicated Rust type
makes the dispatch identity explicit in APIs that carry it.

## What changed

Add `codex-tool-call-id` and use its `ToolCallId` across core tool dispatch,
nested Code Mode calls, and rollout tracing. The type wraps a string and
continues to serialize as a string.

GitOrigin-RevId: 119de57a9af840c4de72895adc9acdd0ed15b4fd
This commit is contained in:
cassirer-openai
2026-11-21 03:14:33 +00:00
committed by copyberry
parent 7edf91b13c
commit 8a1a476659
78 changed files with 402 additions and 286 deletions
+1 -1
View File
@@ -4830,7 +4830,7 @@ impl Session {
communication
.delivery
.as_ref()
.and_then(|d| d.source_tool_call_id.as_deref()),
.and_then(|d| d.source_tool_call_id.as_ref()),
);
}
if let Some(delivery) = delivery.take() {
+3 -3
View File
@@ -7653,7 +7653,7 @@ async fn request_permissions_tool_resolves_legacy_paths_against_selected_environ
turn: turn_context,
cancellation_token: CancellationToken::new(),
tracker,
call_id,
call_id: call_id.into(),
tool_name: codex_tools::ToolName::plain("request_permissions"),
source: ToolCallSource::Direct,
native_call: None,
@@ -7739,7 +7739,7 @@ async fn request_permissions_tool_rejects_invalid_requests(
turn: turn_context,
cancellation_token: CancellationToken::new(),
tracker: Arc::new(tokio::sync::Mutex::new(TurnDiffTracker::new())),
call_id: "call-1".to_string(),
call_id: "call-1".into(),
tool_name: codex_tools::ToolName::plain("request_permissions"),
source: ToolCallSource::Direct,
native_call: None,
@@ -13255,7 +13255,7 @@ async fn unified_exec_rejects_escalated_permissions_when_policy_not_on_request()
step_context,
cancellation_token: CancellationToken::new(),
tracker: Arc::clone(&tracker),
call_id: "exec-call".to_string(),
call_id: "exec-call".into(),
tool_name: codex_tools::ToolName::plain("exec_command"),
source: crate::tools::context::ToolCallSource::Direct,
native_call: None,
@@ -616,7 +616,7 @@ async fn guardian_allows_exec_command_additional_permissions_requests_past_polic
step_context,
cancellation_token: CancellationToken::new(),
tracker: Arc::new(tokio::sync::Mutex::new(TurnDiffTracker::new())),
call_id: "test-call".to_string(),
call_id: "test-call".into(),
tool_name: codex_tools::ToolName::plain("exec_command"),
source: crate::tools::context::ToolCallSource::Direct,
native_call: None,
@@ -742,7 +742,7 @@ async fn strict_auto_review_turn_grant_forces_guardian_for_exec_command_policy_s
step_context,
cancellation_token: CancellationToken::new(),
tracker: Arc::new(tokio::sync::Mutex::new(TurnDiffTracker::new())),
call_id: "strict-shell-command-call".to_string(),
call_id: "strict-shell-command-call".into(),
tool_name: codex_tools::ToolName::plain("exec_command"),
source: ToolCallSource::Direct,
native_call: None,
@@ -896,7 +896,7 @@ async fn delayed_exec_command_uses_its_captured_authority_after_next_turn_starts
step_context,
cancellation_token: CancellationToken::new(),
tracker: Arc::new(tokio::sync::Mutex::new(TurnDiffTracker::new())),
call_id: call_id.to_string(),
call_id: call_id.into(),
tool_name: codex_tools::ToolName::plain("exec_command"),
source: ToolCallSource::Direct,
native_call: None,
@@ -1104,7 +1104,7 @@ async fn guardian_allows_unified_exec_additional_permissions_requests_past_polic
step_context,
cancellation_token: CancellationToken::new(),
tracker: Arc::clone(&tracker),
call_id: "exec-call".to_string(),
call_id: "exec-call".into(),
tool_name: codex_tools::ToolName::plain("exec_command"),
source: crate::tools::context::ToolCallSource::Direct,
native_call: None,
@@ -1230,7 +1230,7 @@ async fn exec_command_allows_sticky_turn_permissions_without_inline_request_perm
step_context,
cancellation_token: CancellationToken::new(),
tracker: Arc::new(tokio::sync::Mutex::new(TurnDiffTracker::new())),
call_id: "sticky-turn-grant".to_string(),
call_id: "sticky-turn-grant".into(),
tool_name: codex_tools::ToolName::plain("exec_command"),
source: crate::tools::context::ToolCallSource::Direct,
native_call: None,