Skip to content

refactor(relaycast): consume sdk bootstrap helpers#657

Open
noodleonthecape wants to merge 4 commits into
mainfrom
noodle/relay-use-relaycast-sdk-bootstrap
Open

refactor(relaycast): consume sdk bootstrap helpers#657
noodleonthecape wants to merge 4 commits into
mainfrom
noodle/relay-use-relaycast-sdk-bootstrap

Conversation

@noodleonthecape
Copy link
Copy Markdown
Contributor

@noodleonthecape noodleonthecape commented Mar 27, 2026

Summary

  • switch relay's broker-side Relaycast bootstrap logic to the new SDK helpers
  • use the Rust SDK's idempotent workspace-stream and channel ensure/join APIs instead of hand-rolled 409 handling in relay
  • pin the Rust dependency to the relaycast SDK branch commit so this PR remains buildable before a crates.io release

Why

Relay had SDK-shaped logic locally in src/relaycast_ws.rs for:

  • enabling the workspace stream before websocket connect
  • creating broker channels if missing
  • joining those channels while treating create/join conflicts as no-ops

That logic now lives in the relaycast SDK, so relay should consume it rather than re-implement it.

Validation

  • Cross-repo validation completed for the new SDK API surface in AgentWorkforce/relaycast:
    • npm run build --workspace=@relaycast/types
    • npx vitest run packages/sdk-typescript/src/__tests__/agent.test.ts packages/sdk-typescript/src/__tests__/relay.test.ts
  • Relay-side Rust tests could not be executed in this environment because cargo is not installed on the host.
  • The relay Cargo.lock entry was updated to the exact relaycast git revision used by this PR so CI can resolve the dependency consistently.

Depends on


Open with Devin

Copy link
Copy Markdown
Contributor

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

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 2 additional findings.

Open in Devin Review

@willwashburn
Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

…ycast-sdk-bootstrap

# Conflicts:
#	Cargo.lock
#	Cargo.toml

Co-authored-by: willwashburn <957608+willwashburn@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented May 18, 2026

@copilot resolve the merge conflicts in this pull request

Merge conflicts resolved in a8c6c48. The only conflicts were in Cargo.toml and Cargo.lock — the feature branch had relaycast pinned to a git commit (pre-release), while main had since updated to use the published crates.io version 1.0.2. Resolved by taking the crates.io version.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

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: 8ee3cecf-8fe7-4195-827b-7b873604b31b

📥 Commits

Reviewing files that changed from the base of the PR and between 1bd6e48 and a8c6c48.

📒 Files selected for processing (1)
  • src/relaycast_ws.rs

📝 Walkthrough

Walkthrough

This PR refactors the Relaycast SDK integration to replace two-step channel operations (create_channel + join_channel) with idempotent ensure_channel_joined() calls, updates workspace stream setup to use ensure_workspace_stream_enabled(), and removes explicit RelayError pattern matching in favor of outcome-based logging.

Changes

Relaycast SDK API Refactoring

Layer / File(s) Summary
Workspace stream setup and error handling
src/relaycast_ws.rs
Remove RelayError from imports. Workspace stream enabling now calls relay.ensure_workspace_stream_enabled() and wraps SDK errors with anyhow! messages instead of workspace_stream_set(true) and error mapping.
Channel joining refactoring for default and extra channels
src/relaycast_ws.rs
Replace prior two-step create_channel + join_channel flows (with 409 status error handling for idempotency) with single agent_client.ensure_channel_joined(request) calls. Log outcomes based on created and joined fields. On failure, log warnings and continue to next channel instead of separate join/error handling paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • willwashburn

Poem

A rabbit hops through channel streams so fair,
No more the two-step dance—one call's all there!
With idempotent ensures, errors wrapped tight,
The Relaycast refactor shines clean and bright.
🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly summarizes the main refactoring change: consuming SDK bootstrap helpers instead of reimplementing them locally.
Description check ✅ Passed The PR description comprehensively covers the summary, motivation, validation steps, and dependency information, matching the template requirements.
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 noodle/relay-use-relaycast-sdk-bootstrap

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

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.

3 participants