refactor: drop relay base-URL defaults; inherit from relaycast SDK 4.2.0#1199
Conversation
The hosted engine base URL default now lives solely in the relaycast SDK. relay holds no base-URL literal: clients pass RELAYCAST_BASE_URL / RELAY_BASE_URL through for self-hosting and otherwise inherit the SDK default (cast.agentrelay.com). Removes the strangled gateway.relaycast.dev / api.relaycast.dev domains. - broker: resolve the engine base from env into Option<String> (None when unset) and thread it so SDK calls default via the SDK; build the fleet node-control WS URL via relaycast::node_control_ws_url; inject RELAY_BASE_URL into spawned agents only when an override is set. Bump relaycast to =4.2.0. - cli: normalizeBaseUrl no longer injects a literal (the SDK owns the default). - sdk-py / sdk-swift: de-default base URL — callers supply base_url / baseURL (or set RELAY_BASE_URL). (Breaking for these SDKs.) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
📝 WalkthroughWalkthroughBase URL handling is changed across broker, runtime, CLI, Python, and Swift code to accept optional or explicit values instead of hardcoded defaults. Tests and documentation were updated to use ChangesHosted base URL unification
Sequence Diagram(s)sequenceDiagram
participant connect_relay
participant AuthClient
participant MultiWorkspaceSession
participant run_init
participant node_control_ws_url
participant run_wrap
participant spawn_env_vars
connect_relay->>AuthClient: new(configured_base)
connect_relay->>MultiWorkspaceSession: new(configured_base, configured_ws)
run_init->>node_control_ws_url: node_control_ws_url(configured_base.as_deref())
run_wrap->>spawn_env_vars: child_base_url.as_deref()
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed due to a network error. 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. Comment |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
CHANGELOG.md (1)
10-18: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsolidate duplicate section headers under
[Unreleased].This adds a second
### Changed(Line 10) and### Removed(Line 14) while the same headers already exist later in the section (Lines 45 and 64). Keep a Changelog expects one heading per change type per release; merge these into the existing groups.As per coding guidelines: "Curate
[Unreleased]inCHANGELOG.md... following Keep a Changelog format and Semantic Versioning."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@CHANGELOG.md` around lines 10 - 18, The [Unreleased] section in CHANGELOG.md has duplicate change-type headings, so merge the newly added `### Changed` and `### Removed` entries into the existing `### Changed` and `### Removed` groups instead of creating second headers. Keep the content under the existing headings and remove the duplicate section titles so the changelog follows Keep a Changelog structure.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Around line 14-18: The changelog has conflicting base-URL guidance between the
new Removed entry and the existing [Unreleased] note. Update the relevant
CHANGELOG sections so the entries for codex-relay-skill, gemini-relay-extension,
and the SDKs all describe the same current behavior, using the correct default
base URL and migration guidance consistently. Reconcile the text in the Removed
section with the earlier base-URL note so there is only one accurate story about
gateway.relaycast.dev, api.relaycast.dev, and cast.agentrelay.com.
In `@crates/broker/src/runtime/session.rs`:
- Around line 129-133: The base URL selection in session handling is picking
RELAYCAST_BASE_URL before applying trim/filter, so an empty canonical value can
block a valid RELAY_BASE_URL fallback. Update the logic in session.rs around
configured_base so each env var is trimmed and checked for emptiness before
falling back to the next one, using the existing configured_base expression to
preserve the intended override order.
---
Nitpick comments:
In `@CHANGELOG.md`:
- Around line 10-18: The [Unreleased] section in CHANGELOG.md has duplicate
change-type headings, so merge the newly added `### Changed` and `### Removed`
entries into the existing `### Changed` and `### Removed` groups instead of
creating second headers. Keep the content under the existing headings and remove
the duplicate section titles so the changelog follows Keep a Changelog
structure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 855b38bb-4913-4320-b430-5ee91f0d4009
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (22)
CHANGELOG.mdcrates/broker/Cargo.tomlcrates/broker/src/cli_mcp_args.rscrates/broker/src/relaycast/auth.rscrates/broker/src/relaycast/workspace.rscrates/broker/src/relaycast/ws.rscrates/broker/src/runtime/init.rscrates/broker/src/runtime/mod.rscrates/broker/src/runtime/paths.rscrates/broker/src/runtime/session.rscrates/broker/src/runtime/tests.rscrates/broker/src/spawner.rscrates/broker/src/wrap.rspackages/cli/src/cli/agent-relay-mcp.startup.test.tspackages/cli/src/cli/agent-relay-mcp.tspackages/sdk-py/src/agent_relay/communicate/transport.pypackages/sdk-py/src/agent_relay/communicate/types.pypackages/sdk-py/tests/communicate/test_types.pypackages/sdk-swift/README.mdpackages/sdk-swift/Sources/AgentRelaySDK/AgentRelayClient.swiftpackages/sdk-swift/Tests/AgentRelaySDKTests/AgentRelaySDKTests.swifttests/integration/sdk/v8-api-smoke.mjs
💤 Files with no reviewable changes (2)
- crates/broker/src/runtime/mod.rs
- crates/broker/src/runtime/paths.rs
| ### Removed | ||
|
|
||
| - Removed all `gateway.relaycast.dev` / `api.relaycast.dev` references; clients target `cast.agentrelay.com` only. | ||
| - **Breaking (SDKs):** relay's Swift `AgentRelay` client and Python `communicate` client no longer default the base URL — callers must pass `baseURL`/`base_url` or set `RELAY_BASE_URL`. | ||
|
|
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Changelog contradicts an existing [Unreleased] entry.
Line 16 states all gateway.relaycast.dev / api.relaycast.dev references were removed and clients target cast.agentrelay.com only. However, the existing entry on Line 51 still documents these domains as live defaults:
codex-relay-skillandgemini-relay-extensionnow default tohttps://gateway.relaycast.dev... SetRELAY_BASE_URLto keep usinghttps://api.relaycast.dev.
Reconcile these two entries so the changelog presents a single, accurate base-URL story for the release.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@CHANGELOG.md` around lines 14 - 18, The changelog has conflicting base-URL
guidance between the new Removed entry and the existing [Unreleased] note.
Update the relevant CHANGELOG sections so the entries for codex-relay-skill,
gemini-relay-extension, and the SDKs all describe the same current behavior,
using the correct default base URL and migration guidance consistently.
Reconcile the text in the Removed section with the earlier base-URL note so
there is only one accurate story about gateway.relaycast.dev, api.relaycast.dev,
and cast.agentrelay.com.
| let configured_base: Option<String> = std::env::var("RELAYCAST_BASE_URL") | ||
| .ok() | ||
| .or_else(|| std::env::var("RELAY_BASE_URL").ok()) | ||
| .unwrap_or_else(|| DEFAULT_RELAYCAST_BASE_URL.to_string()); | ||
| let ws_base = std::env::var("RELAYCAST_WS_URL") | ||
| .unwrap_or_else(|_| derive_ws_base_url_from_http(&http_base)); | ||
| .map(|s| s.trim().to_string()) | ||
| .filter(|s| !s.is_empty()); |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Trim/filter before falling back to RELAY_BASE_URL.
Line 129 chooses RELAYCAST_BASE_URL before trimming, so an empty canonical env var suppresses a valid RELAY_BASE_URL override and can send self-hosted workspace keys to the SDK default host.
Proposed fix
- let configured_base: Option<String> = std::env::var("RELAYCAST_BASE_URL")
- .ok()
- .or_else(|| std::env::var("RELAY_BASE_URL").ok())
- .map(|s| s.trim().to_string())
- .filter(|s| !s.is_empty());
+ let configured_base: Option<String> = std::env::var("RELAYCAST_BASE_URL")
+ .ok()
+ .map(|s| s.trim().to_string())
+ .filter(|s| !s.is_empty())
+ .or_else(|| {
+ std::env::var("RELAY_BASE_URL")
+ .ok()
+ .map(|s| s.trim().to_string())
+ .filter(|s| !s.is_empty())
+ });📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| let configured_base: Option<String> = std::env::var("RELAYCAST_BASE_URL") | |
| .ok() | |
| .or_else(|| std::env::var("RELAY_BASE_URL").ok()) | |
| .unwrap_or_else(|| DEFAULT_RELAYCAST_BASE_URL.to_string()); | |
| let ws_base = std::env::var("RELAYCAST_WS_URL") | |
| .unwrap_or_else(|_| derive_ws_base_url_from_http(&http_base)); | |
| .map(|s| s.trim().to_string()) | |
| .filter(|s| !s.is_empty()); | |
| let configured_base: Option<String> = std::env::var("RELAYCAST_BASE_URL") | |
| .ok() | |
| .map(|s| s.trim().to_string()) | |
| .filter(|s| !s.is_empty()) | |
| .or_else(|| { | |
| std::env::var("RELAY_BASE_URL") | |
| .ok() | |
| .map(|s| s.trim().to_string()) | |
| .filter(|s| !s.is_empty()) | |
| }); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/broker/src/runtime/session.rs` around lines 129 - 133, The base URL
selection in session handling is picking RELAYCAST_BASE_URL before applying
trim/filter, so an empty canonical value can block a valid RELAY_BASE_URL
fallback. Update the logic in session.rs around configured_base so each env var
is trimmed and checked for emptiness before falling back to the next one, using
the existing configured_base expression to preserve the intended override order.
What
agent-relayandagent-relay-brokerno longer hardcode an engine base URL. They passRELAYCAST_BASE_URL/RELAY_BASE_URLthrough for self-hosting and otherwise inherit the default from the relaycast SDK (cast.agentrelay.com). Builds against publishedrelaycast4.2.0.Scope: broker + CLI only. The standalone Python (
communicate) and Swift hosted SDKs are handled separately by #1187 (wraprelaycast-sdk) and #1188 (wrap relaycast's Swift SDK) — the better pattern, since wrapping the relaycast SDK makes those clients inherit the cast default instead of requiring callers to pass one. This PR no longer touchessdk-py/sdk-swift.Changes
broker (
agent-relay-broker)RELAYCAST_BASE_URL→RELAY_BASE_URL) intoOption<String>(None when unset) and thread it so every relaycast SDK call inherits the SDK default when None.relaycast::node_control_ws_url(...)(removed relay'sderive_ws_base_url_from_http).RELAY_BASE_URLinto spawned agents / generated MCP config only when an override is configured.DEFAULT_RELAYCAST_BASE_URLconst; bumpedrelaycast = "=4.2.0".cli
normalizeBaseUrlno longer injects a literal (the SDK owns the default); stalegatewaycomment fixed; test fixtures neutralized.Verification
cargo build+cargo test -p agent-relay-brokeragainst publishedrelaycast 4.2.0: 774 lib tests pass, 0 failures.agent-relay-mcp.startup.test.ts: 19 pass.gateway/api.relaycast.devin broker or CLI source.🤖 Generated with Claude Code