diff --git a/codex-rs/core/src/agent/control/sender_context.rs b/codex-rs/core/src/agent/control/sender_context.rs index 9a0cd514f9..b3ab74db8f 100644 --- a/codex-rs/core/src/agent/control/sender_context.rs +++ b/codex-rs/core/src/agent/control/sender_context.rs @@ -47,10 +47,18 @@ impl LocalAgentRuntime { .trim() .strip_prefix("")? .split_once("")?; - input - .trim() - .strip_prefix("")? - .strip_suffix("")?; + let input = input.trim(); + // Cloud deliveries include Dot attribution, but authority comes from the source thread. + let input = if let Some(rest) = input.strip_prefix("") { + let (orbit_id, input) = rest.split_once("")?; + if orbit_id.contains('<') { + return None; + } + input.trim() + } else { + input + }; + input.strip_prefix("")?.strip_suffix("")?; ThreadId::from_string(source) .ok() .filter(|source| *source != receiver_thread_id) diff --git a/codex-rs/core/tests/suite/scenarios_guardian_sender_context.rs b/codex-rs/core/tests/suite/scenarios_guardian_sender_context.rs index 3f1546c0d8..c6e0a31a78 100644 --- a/codex-rs/core/tests/suite/scenarios_guardian_sender_context.rs +++ b/codex-rs/core/tests/suite/scenarios_guardian_sender_context.rs @@ -130,7 +130,7 @@ async fn cross_host_sender_context(history_mode: ThreadHistoryMode) -> Result<() let delivery: ResponseItem = serde_json::from_value(json!({ "type": "function_call_output", "id": "delivery-0", "name": "send_message", "namespace": "cloud_threads", - "output": format!("{sender_id}Inspect."), + "output": format!("{sender_id}orbit-sourceInspect."), }))?; receiver .codex diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__guardian_sender_context__cross_host_sender_context.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__guardian_sender_context__cross_host_sender_context.snap index 4d38c6b29c..ad9c24e1f7 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__guardian_sender_context__cross_host_sender_context.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__guardian_sender_context__cross_host_sender_context.snap @@ -81,7 +81,7 @@ Settings: relative to window 2 02:message/user: -03:function_call_output/cloud_threads.send_message:Inspect. +03:function_call_output/cloud_threads.send_message:orbit-sourceInspect. ## Window 4 (after request 5: input diverged at item 00) Settings: relative to window 3 @@ -117,7 +117,7 @@ Settings: relative to window 3 [03] >>> TRANSCRIPT START - [04] [1] tool cloud_threads.send_message result: Inspect. + [04] [1] tool cloud_threads.send_message result: Inspect. [hash=d07acc49b7555746] [05] [2] tool exec_command call: {"cmd":"exit 0","sandbox_permissions":"require_escalated"} @@ -166,6 +166,6 @@ Settings: same as window 3 02:message/user: -03:function_call_output/cloud_threads.send_message:Inspect. +03:function_call_output/cloud_threads.send_message:orbit-sourceInspect. 04:function_call/exec_command:{"cmd":"exit 0","sandbox_permissions":"require_escalated"} 05:function_call_output:exec_command failed: CreateProcess { message: "Rejected(\\"This action was rejected due to unacceptable r...e risk. Otherwise, stop and request user input.\\")" } [hash=099c82d6bbb0d161]