Preserve Guardian sender context for cloud deliveries with orbit IDs (#58946)

## Why

Delegation messages containing `<source_orbit_id>` fail sender provenance parsing, leaving Guardian without the sender's instructions.

## What changed

Accept an optional `<source_orbit_id>` between `<source_thread_id>` and `<input>`, rejecting values containing `<`. Continue to derive sender authority from the source thread ID.

## Testing

Update the cross-host sender context scenario and snapshot to include orbit attribution. The scenario checks that sender evidence reaches Guardian after compaction and rollback without exposing it to the receiving agent.

GitOrigin-RevId: 463b18667384d30297245eedcd0f6bcbf683634e
This commit is contained in:
felixxia-oai
2026-11-02 18:43:57 +00:00
committed by copyberry
parent 4515bc6df0
commit 00df7f65ab
3 changed files with 16 additions and 8 deletions
@@ -47,10 +47,18 @@ impl LocalAgentRuntime {
.trim()
.strip_prefix("<source_thread_id>")?
.split_once("</source_thread_id>")?;
input
.trim()
.strip_prefix("<input>")?
.strip_suffix("</input>")?;
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("<source_orbit_id>") {
let (orbit_id, input) = rest.split_once("</source_orbit_id>")?;
if orbit_id.contains('<') {
return None;
}
input.trim()
} else {
input
};
input.strip_prefix("<input>")?.strip_suffix("</input>")?;
ThreadId::from_string(source)
.ok()
.filter(|source| *source != receiver_thread_id)