Skip to content

Use relaycast Rust SDK v1.1.0 helpers#917

Merged
willwashburn merged 1 commit into
mainfrom
codex/relaycast-sdk-1-1
May 19, 2026
Merged

Use relaycast Rust SDK v1.1.0 helpers#917
willwashburn merged 1 commit into
mainfrom
codex/relaycast-sdk-1-1

Conversation

@willwashburn

Copy link
Copy Markdown
Member

Summary:

  • Bump relaycast Rust SDK to 1.1.0.
  • Replace local RelayCast event and command normalization, identity helpers, DM participant cache, registered agent client setup, and channel ensure/join handling with SDK helpers.
  • Keep Relay's broker-facing event types while delegating wire-shape handling to the SDK.

Tests:

  • cargo fmt --check
  • git diff --check
  • cargo test

@willwashburn willwashburn requested a review from khaliqgant as a code owner May 19, 2026 16:13
@coderabbitai

coderabbitai Bot commented May 19, 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: 21356173-a953-4af1-a09b-c573b24c96ec

📥 Commits

Reviewing files that changed from the base of the PR and between f326325 and bba7a20.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • .trajectories/compacted/compact_gqmrna24cmm4_2026-05-19.json
  • .trajectories/compacted/compact_gqmrna24cmm4_2026-05-19.md
  • .trajectories/index.json
  • crates/broker/Cargo.toml
  • crates/broker/src/relaycast/bridge.rs
  • crates/broker/src/relaycast/dm_participants.rs
  • crates/broker/src/relaycast/identity.rs
  • crates/broker/src/relaycast/mod.rs
  • crates/broker/src/relaycast/ws.rs
  • crates/broker/src/runtime/init.rs
  • crates/broker/src/wrap.rs
💤 Files with no reviewable changes (1)
  • crates/broker/src/relaycast/identity.rs

📝 Walkthrough

Walkthrough

This PR upgrades the relaycast dependency from 1.0.2 to 1.1.0 and refactors the broker's Relaycast integration to use new SDK-provided helpers for event normalization, DM caching, and identity matching. Event/command mapping is simplified via SDK normalization functions, WebSocket handling shifts to raw event streaming with consolidated agent-client acquisition, and local implementations are replaced with SDK exports.

Changes

Relaycast 1.1.0 SDK Integration and Refactoring

Layer / File(s) Summary
Dependency upgrade and trajectory metadata
crates/broker/Cargo.toml, .trajectories/compacted/*, .trajectories/index.json
relaycast dependency bumped from 1.0.2 to 1.1.0. Trajectory artifacts document the tooling decision for SDK 1.1.0 helpers and update index metadata.
Event and command mapping via SDK normalization
crates/broker/src/relaycast/bridge.rs
map_ws_event and map_ws_broker_command now delegate to relaycast::normalize_inbound_event and relaycast::normalize_command_invocation. Local EventAccessor/EventNesting utilities and JSON extraction helpers are removed; mapping helpers translate SDK kinds/priorities to internal types. Tests updated to remove coverage for deleted local utilities.
DM participant cache extraction to SDK
crates/broker/src/relaycast/dm_participants.rs
resolve_dm_participants_cached delegates to ::relaycast::DmParticipantsCache via cache.resolve_or_empty(). Local cache types, TTL logic, ID validation, and failure-insertion patterns removed. Function now checks for relay client and logs warnings when unavailable or empty.
Identity helper migration to SDK re-exports
crates/broker/src/relaycast/mod.rs, crates/broker/src/relaycast/identity.rs
identity.rs file removed entirely. Re-exports of agent_name_eq and is_self_name now sourced from relaycast crate instead of local module.
WebSocket handler refactoring for raw events and client consolidation
crates/broker/src/relaycast/ws.rs
Handler subscribes to raw SDK events (subscribe_raw_events) instead of typed events. New internal registered_agent_client() consolidates token/client acquisition. Channel setup refactored to use ensure_joined_channel (logs created/joined outcomes) instead of separate create_channel/join_channel with 409 handling. Message/history methods refactored to use new client helper. get_dm_participants method removed; relay_client() accessor added. Test ignore strings updated.
Runtime cache initialization updates
crates/broker/src/runtime/init.rs, crates/broker/src/wrap.rs
Cache initialization switched from HashMap::new() to DmParticipantsCache::new(). Unused HashMap import removed from wrap.rs.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • khaliqgant
  • barryollama

🐰 A rabbit hops through the relay,
Trading local maps for SDK's way,
Raw events stream, one client to call,
The cache now shared—simplicity for all!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: upgrading the relaycast Rust SDK to v1.1.0 and using its new helpers.
Description check ✅ Passed The description covers the main changes and lists the tests run, but lacks a formal Test Plan section with checkboxes as specified in the template.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 codex/relaycast-sdk-1-1

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 and usage tips.

@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 5 additional findings.

Open in Devin Review

@barryollama barryollama left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review: Approved ✅

Clean refactoring that properly delegates wire-shape handling to the Relaycast SDK v1.1.0 while preserving Relay's broker-facing event types.

Summary

  • Bumps relaycast from earlier version to 1.1.0 via exact-pin (=1.1.0)
  • Replaces ~570 lines of local normalization logic with SDK helpers
  • Delegates identity comparison, DM participant resolution, and channel management to the SDK

What’s Reviewed

Correctness

  • bridge.rs properly maps SDK normalized events to broker InboundRelayEvent types
  • All event kind, sender kind, and priority mappings are exhaustive and match
  • Command invocation mapping preserves spawn/release behavior with suffix support
  • WebSocket raw events now pass through directly from SDK to broker bridge

Code Quality

  • Excellent reduction in duplication: bridge.rs went from ~750 lines to ~115 lines
  • Deleted identity.rs module — identity helpers now imported from SDK (relaycast::{agent_name_eq, is_self_name})
  • DM participants cache now uses SDK type with DmParticipantsCache::new() constructor
  • ws.rs registered agent client setup simplified via registration.registered_agent_client()
  • Channel ensure/join consolidated into single ensure_joined_channel() SDK call

Compatibility

  • All existing tests preserved and passing
  • Contract identity fixture test remains to ensure normalization behavior alignment
  • Event normalization test cases still validate both top-level and payload-wrapped shapes
  • No breaking changes to public broker types

Documentation

  • Code comments updated to reflect SDK delegation

Minor Notes (non-blocking)

  1. The trajectories compaction files included in the PR appear to be from prior work
  2. Consider adding a brief note in CHANGELOG.md about the SDK version bump

Verdict

Well-executed refactoring that reduces maintenance burden by centralizing wire-protocol handling in the SDK. Tests pass, types align, and behavior is preserved. Ready to merge.

@willwashburn willwashburn merged commit c38b356 into main May 19, 2026
40 checks passed
@willwashburn willwashburn deleted the codex/relaycast-sdk-1-1 branch May 19, 2026 16:39
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.

2 participants