fix(broker): treat blank nested sessionRef as absent in bridge

Merged
KH
3mo ago
+57-1

Summary

Follow-up to #1477 addressing one post-merge coderabbit finding.

  • attestation.session_ref.is_none() in broker_payload_from_action did not cover the case where the nested sessionRef inside metadata.attestation is a blank/whitespace string (e.g. " "). A dispatcher that sends {"sessionRef":" "} inside the attestation block would suppress a valid top-level session_ref, leaving the Session-Id commit trailer unset.
  • Replaces bare is_none() with the same blank-aware check used by spawner.rs::is_valid_attestation_value: trims the nested value and treats an empty result as absent, allowing the top-level alias to fill the field.
  • Adds blank_nested_session_ref_is_treated_as_absent test to cover this branch directly.

Test plan

  • cargo test -p agent-relay-broker --lib -- relaycast::bridge::tests::blank โ†’ 3 tests pass (blank_nested, blank_session_ref_falls_through, blank_session_id_falls_through)
  • Full suite: cargo test -p agent-relay-broker --lib โ†’ 895 tests pass, 0 failures

๐Ÿค– Generated with Claude Code