Skip to content

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

Merged
khaliqgant merged 3 commits into
mainfrom
fix/broker-blank-nested-session-ref
Aug 11, 2026
Merged

fix(broker): treat blank nested sessionRef as absent in bridge#1478
khaliqgant merged 3 commits into
mainfrom
fix/broker-blank-nested-session-ref

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Aug 11, 2026

Copy link
Copy Markdown
Member

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

Review in cubic

`attestation.session_ref.is_none()` did not cover the case where the
nested `sessionRef` inside `metadata.attestation` is a blank/whitespace
string (e.g. serialised as `"   "`).  A dispatcher that sends
`{"sessionRef":"  "}` inside the attestation object would suppress a
valid top-level `session_ref`, leaving the Session-Id trailer unset.

Replace the bare `is_none()` guard with the same blank-aware check used
by `spawner.rs::is_valid_attestation_value`: treat any value whose
trimmed form is empty as absent, so the top-level alias still wins.

Adds test `blank_nested_session_ref_is_treated_as_absent` to cover
this branch directly.  895 broker unit tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cursor

cursor Bot commented Aug 11, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7886c38e-fc39-490d-bd9e-a78fcbc4b20b

📥 Commits

Reviewing files that changed from the base of the PR and between dd16bba and 9488911.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • crates/broker/src/relaycast/bridge.rs

📝 Walkthrough

Walkthrough

Broker attestation bridging now treats blank or whitespace-only nested session references as absent. A valid top-level session_ref can populate the attestation field. A regression test and changelog entry document this behavior.

Changes

Spawn attestation bridging

Layer / File(s) Summary
Session reference fallback
crates/broker/src/relaycast/bridge.rs, CHANGELOG.md
The bridge trims nested session_ref values before checking whether they are absent. The regression test verifies fallback to a valid top-level session_ref. The changelog records the fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: willwashburn, claude

Poem

A rabbit found spaces hiding the thread,
So blank nested references bowed their head.
The top-level value hopped into place,
With tests and notes in a tidy chase.
“Bridge on!” said the rabbit, and raced.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main broker bridge fix for blank nested sessionRef values.
Description check ✅ Passed The description explains the change and lists targeted and full test commands with results; screenshots are not applicable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/broker-blank-nested-session-ref

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

Clippy (unnecessary_map_or) flagged the `.map_or(true, |v| v.is_empty())`
pattern; `.is_none_or(|v| v.is_empty())` is the idiomatic equivalent and
satisfies `-D warnings`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@khaliqgant
khaliqgant merged commit 851d559 into main Aug 11, 2026
38 of 39 checks passed
@khaliqgant
khaliqgant deleted the fix/broker-blank-nested-session-ref branch August 11, 2026 09:38
@khaliqgant

Copy link
Copy Markdown
Member Author

relayfile-subs-lead-0811 E2E delivery test — 2026-08-11T11:14:18Z

@khaliqgant

Copy link
Copy Markdown
Member Author

relayfile-subs-lead-0811 E2E delivery test — deploy confirmed green, firing live test 2026-08-11T11:45:02Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant