Remove external Relaycast MCP dependency#977
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAgent Relay now bundles a Relaycast-backed MCP stdio server (invoked via npx -y agent-relay mcp). Broker startup no longer persists Relaycast MCP entries to project .mcp.json; spawned agents receive MCP configuration at launch. CLI, tests, plugins, docs, and packaging updated accordingly. ChangesMCP Server Migration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related issues
Suggested reviewers
🚥 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 unit tests (beta)
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 |
|
Preview deployed!
This preview will be cleaned up when the PR is merged or closed. |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@packages/openclaw/src/setup.ts`:
- Around line 398-410: The mcporter execFileSync call that builds the array for
mcp.cmd (the block using execFileSync with mcp.cmd, mcp.prefix,
'config','add','relaycast','--command','npx','--arg','agent-relay','--arg','mcp')
must include the non-interactive flag; insert '--arg','-y' immediately after the
existing '--arg','mcp' entry so the persisted command becomes npx agent-relay
mcp -y. Make the same change in the other identical execFileSync/config block
elsewhere in this file (the second occurrence that builds the relaycast config).
In `@scripts/watch-cli-tools.sh`:
- Line 76: RELAYCAST_MCP_COMMAND is set to a relative path which can resolve
against the wrong CWD when the watcher spawns processes; change the assignment
of the RELAYCAST_MCP_COMMAND variable in scripts/watch-cli-tools.sh to build and
export an absolute path (e.g., prefix the relative path with the project root
variable like $PROJECT_DIR or use $(pwd) at runtime) so the command always
points to the correct dist/src/cli/relaycast-mcp.js file.
🪄 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: e77975ef-71dc-4cbf-9537-d80771714611
⛔ Files ignored due to path filters (2)
package-lock.jsonis excluded by!**/package-lock.jsonplugins/gemini-relay-extension/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (24)
CHANGELOG.mdcrates/broker/src/cli/mod.rscrates/broker/src/cli_mcp_args.rscrates/broker/src/relaycast/mod.rscrates/broker/src/runtime/init.rscrates/broker/src/runtime/mod.rscrates/broker/src/runtime/relaycast_events.rscrates/broker/src/runtime/session.rscrates/broker/src/snippets.rscrates/broker/src/wrap.rspackage.jsonpackages/openclaw/skill/SKILL.mdpackages/openclaw/src/setup.tsplugins/codex-relay-skill/README.mdplugins/codex-relay-skill/codex-config/config.tomlplugins/codex-relay-skill/scripts/setup.shplugins/gemini-relay-extension/package.jsonplugins/gemini-relay-extension/relay-server.jsscripts/watch-cli-tools.shsrc/cli/bootstrap.tssrc/cli/relaycast-mcp.startup.test.tssrc/cli/relaycast-mcp.tstests/mcp_merge_e2e.rsweb/content/docs/reference-cli.mdx
💤 Files with no reviewable changes (5)
- plugins/gemini-relay-extension/package.json
- crates/broker/src/wrap.rs
- crates/broker/src/runtime/session.rs
- crates/broker/src/relaycast/mod.rs
- crates/broker/src/runtime/init.rs
| execFileSync( | ||
| mcp.cmd, | ||
| [ | ||
| ...mcp.prefix, | ||
| 'config', | ||
| 'add', | ||
| 'relaycast', | ||
| '--command', | ||
| 'npx', | ||
| '--arg', | ||
| 'agent-relay', | ||
| '--arg', | ||
| 'mcp', |
There was a problem hiding this comment.
Add -y to mcporter-managed npx agent-relay mcp args
Line 406 and Line 478 currently persist npx agent-relay mcp (without -y). This diverges from the migration contract used elsewhere in this PR and can block non-interactive startup on first install.
Suggested patch
execFileSync(
mcp.cmd,
[
...mcp.prefix,
'config',
'add',
'relaycast',
'--command',
'npx',
+ '--arg',
+ '-y',
'--arg',
'agent-relay',
'--arg',
'mcp',
...envArgs,
'--scope',
'home',
'--description',
'Relaycast messaging MCP server',
],
{ stdio: 'pipe' }
);
...
execFileSync(
mcp.cmd,
[
...mcp.prefix,
'config',
'add',
'relaycast',
'--command',
'npx',
+ '--arg',
+ '-y',
'--arg',
'agent-relay',
'--arg',
'mcp',
...envArgs,
'--env',
`RELAY_AGENT_TOKEN=${agentToken}`,
'--scope',
'home',
'--description',
'Relaycast messaging MCP server',
],
{ stdio: 'pipe' }
);Also applies to: 470-483
🤖 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 `@packages/openclaw/src/setup.ts` around lines 398 - 410, The mcporter
execFileSync call that builds the array for mcp.cmd (the block using
execFileSync with mcp.cmd, mcp.prefix,
'config','add','relaycast','--command','npx','--arg','agent-relay','--arg','mcp')
must include the non-interactive flag; insert '--arg','-y' immediately after the
existing '--arg','mcp' entry so the persisted command becomes npx agent-relay
mcp -y. Make the same change in the other identical execFileSync/config block
elsewhere in this file (the second occurrence that builds the relaycast config).
| export RUST_LOG=debug | ||
| export RELAY_DASHBOARD_STATIC_DIR=/Users/khaliqgant/Projects/agent-workforce/relay-dashboard/packages/dashboard/out | ||
| export RELAYCAST_MCP_COMMAND="node /Users/khaliqgant/Projects/agent-workforce/relaycast/packages/mcp/dist/stdio.js" | ||
| export RELAYCAST_MCP_COMMAND="node dist/src/cli/relaycast-mcp.js" |
There was a problem hiding this comment.
Use an absolute MCP command path in watch mode.
This command is consumed from a process launched under $PROJECT_DIR, so dist/src/cli/relaycast-mcp.js can resolve to the wrong repo and fail.
🔧 Suggested fix
-export RELAYCAST_MCP_COMMAND="node dist/src/cli/relaycast-mcp.js"
+export RELAYCAST_MCP_COMMAND="node ${CLI_REPO_DIR}/dist/src/cli/relaycast-mcp.js"📝 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.
| export RELAYCAST_MCP_COMMAND="node dist/src/cli/relaycast-mcp.js" | |
| export RELAYCAST_MCP_COMMAND="node ${CLI_REPO_DIR}/dist/src/cli/relaycast-mcp.js" |
🤖 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 `@scripts/watch-cli-tools.sh` at line 76, RELAYCAST_MCP_COMMAND is set to a
relative path which can resolve against the wrong CWD when the watcher spawns
processes; change the assignment of the RELAYCAST_MCP_COMMAND variable in
scripts/watch-cli-tools.sh to build and export an absolute path (e.g., prefix
the relative path with the project root variable like $PROJECT_DIR or use $(pwd)
at runtime) so the command always points to the correct
dist/src/cli/relaycast-mcp.js file.
| function createInitialSession(options: { | ||
| workspaceKey?: string | null; | ||
| agentToken?: string | null; | ||
| agentName?: string | null; | ||
| }): SessionState { | ||
| const agentToken = options.agentToken ?? null; | ||
| const agentName = options.agentName ?? null; | ||
| const agents = | ||
| agentToken && agentName | ||
| ? new Map([[agentName, { agentName, agentToken }]]) | ||
| : new Map<string, RegisteredAgent>(); | ||
|
|
||
| return payload.data ?? {}; | ||
| return { | ||
| workspaceKey: options.workspaceKey ?? null, | ||
| agentToken, | ||
| agentName, | ||
| agents, | ||
| wsBridge: null, | ||
| subscriptions: null, | ||
| wsInitAttempted: false, | ||
| }; |
There was a problem hiding this comment.
Preserve resource subscriptions across WS lifecycle changes.
subscriptions are currently dropped/ignored in common paths (before WS init and on workspace/token switch), so clients can stop receiving sendResourceUpdated events without resubscribing.
🔧 Suggested fix
function createInitialSession(options: {
workspaceKey?: string | null;
agentToken?: string | null;
agentName?: string | null;
}): SessionState {
@@
return {
@@
- subscriptions: null,
+ subscriptions: new SubscriptionManager(),
wsInitAttempted: false,
};
}
@@
const setSession: SessionSetter = (partial) => {
@@
if (switchingWorkspace || changingToken) {
notifySubscribers();
session.wsBridge?.stop();
- session.subscriptions?.clear();
session.wsBridge = null;
- session.subscriptions = null;
session.wsInitAttempted = false;
}
@@
if (session.agentToken && !session.wsBridge && !session.wsInitAttempted) {
try {
- const subscriptions = new SubscriptionManager();
+ const subscriptions = session.subscriptions ?? new SubscriptionManager();
+ session.subscriptions = subscriptions;
const wsClient = new WsClient({
token: session.agentToken,
baseUrl: options.baseUrl,
});
@@
mcpServer.server.setRequestHandler(SubscribeRequestSchema, async (req) => {
- session.subscriptions?.subscribe(req.params.uri);
+ (session.subscriptions ??= new SubscriptionManager()).subscribe(req.params.uri);
return {};
});
mcpServer.server.setRequestHandler(UnsubscribeRequestSchema, async (req) => {
- session.subscriptions?.unsubscribe(req.params.uri);
+ (session.subscriptions ??= new SubscriptionManager()).unsubscribe(req.params.uri);
return {};
});Also applies to: 1331-1360, 1395-1401
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2806eb2553
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| 'npx', | ||
| '--arg', | ||
| 'agent-relay', | ||
| '--arg', | ||
| 'mcp', |
There was a problem hiding this comment.
Add
-y when configuring npx agent-relay mcp
This registration writes npx agent-relay mcp without -y, so fresh machines that don’t already have agent-relay cached can block on an install confirmation prompt instead of starting the MCP server. npm’s own npx/npm exec docs say it “prompts before installing anything” and that -y/--yes suppresses it, which makes this path brittle in non-interactive OpenClaw sessions; the same missing flag is repeated in the later re-add block with RELAY_AGENT_TOKEN.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
2 issues found across 26 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/openclaw/src/setup.ts">
<violation number="1" location="packages/openclaw/src/setup.ts:408">
P2: Missing `-y` in `npx` MCP command. Non-interactive setup can hang or fail on install prompt. Add `-y` before `agent-relay` (and mirror in the token reconfigure call).</violation>
</file>
<file name="plugins/gemini-relay-extension/relay-server.js">
<violation number="1" location="plugins/gemini-relay-extension/relay-server.js:84">
P1: Windows launch can break. `spawn('npx', ...)` fails for `.cmd` shims. Use `cmd /c` on win32.</violation>
</file>
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
|
|
||
| function runAgentRelayMcp() { | ||
| return new Promise((resolve, reject) => { | ||
| const child = spawn('npx', ['-y', 'agent-relay', 'mcp'], { |
There was a problem hiding this comment.
P1: Windows launch can break. spawn('npx', ...) fails for .cmd shims. Use cmd /c on win32.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/gemini-relay-extension/relay-server.js, line 84:
<comment>Windows launch can break. `spawn('npx', ...)` fails for `.cmd` shims. Use `cmd /c` on win32.</comment>
<file context>
@@ -56,49 +56,59 @@ if (workspaceKey) {
+
+function runAgentRelayMcp() {
+ return new Promise((resolve, reject) => {
+ const child = spawn('npx', ['-y', 'agent-relay', 'mcp'], {
+ stdio: 'inherit',
+ env: process.env,
</file context>
| const child = spawn('npx', ['-y', 'agent-relay', 'mcp'], { | |
| const command = process.platform === 'win32' ? 'cmd' : 'npx'; | |
| const args = process.platform === 'win32' ? ['/c', 'npx', '-y', 'agent-relay', 'mcp'] : ['-y', 'agent-relay', 'mcp']; | |
| const child = spawn(command, args, { |
| '--command', | ||
| 'npx', | ||
| '--arg', | ||
| 'agent-relay', |
There was a problem hiding this comment.
P2: Missing -y in npx MCP command. Non-interactive setup can hang or fail on install prompt. Add -y before agent-relay (and mirror in the token reconfigure call).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/openclaw/src/setup.ts, line 408:
<comment>Missing `-y` in `npx` MCP command. Non-interactive setup can hang or fail on install prompt. Add `-y` before `agent-relay` (and mirror in the token reconfigure call).</comment>
<file context>
@@ -393,27 +395,50 @@ export async function setup(options: SetupOptions): Promise<SetupResult> {
+ '--command',
+ 'npx',
+ '--arg',
+ 'agent-relay',
+ '--arg',
+ 'mcp',
</file context>
|
@copilot resolve the merge conflicts in this pull request |
…ay-mcp # Conflicts: # plugins/gemini-relay-extension/package-lock.json Co-authored-by: willwashburn <957608+willwashburn@users.noreply.github.com>
Resolved in 35d0a92. There was a single conflict in |
…ay-mcp # Conflicts: # plugins/gemini-relay-extension/package-lock.json
…o codex/owned-agent-relay-mcp
There was a problem hiding this comment.
🧹 Nitpick comments (1)
CHANGELOG.md (1)
24-24: ⚡ Quick winSplit dense bullets into shorter impact-first items.
These entries are accurate but overloaded; breaking them into 2–4 shorter bullets would better match changelog readability and scanning expectations.
As per coding guidelines, "Entries should be concise, impact-first, and use sections like Added, Changed, Deprecated, Removed, Fixed, Security, Breaking Changes, and Migration Guidance".
Also applies to: 30-31
🤖 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` at line 24, The changelog bullet is too dense; split it into 2–4 concise, impact-first bullets under appropriate sections (e.g., Changed, Removed, Migration Guidance) that each focus on one key change: (1) replacement of `@agentworkforce/harness-kit` + `@agentworkforce/workload-router` with `@agentworkforce/persona-kit`@^3 and its impact; (2) removal of the persona tier system and the tier option on spawnPersona; (3) removal of legacy types (PersonaFile, PersonaTier, PersonaTierSpec, ResolvedPersona, PersonaSpawnSpec, MaterializedConfigFile) and helper functions (buildPersonaSpawnSpec, materializePersonaConfigFiles, restorePersonaConfigFiles); and (4) API changes: loadPersona now returns PersonaSpec and spawnPersona({ persona }) now expects a PersonaSpec — include a short migration note for each breaking change.
🤖 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.
Nitpick comments:
In `@CHANGELOG.md`:
- Line 24: The changelog bullet is too dense; split it into 2–4 concise,
impact-first bullets under appropriate sections (e.g., Changed, Removed,
Migration Guidance) that each focus on one key change: (1) replacement of
`@agentworkforce/harness-kit` + `@agentworkforce/workload-router` with
`@agentworkforce/persona-kit`@^3 and its impact; (2) removal of the persona tier
system and the tier option on spawnPersona; (3) removal of legacy types
(PersonaFile, PersonaTier, PersonaTierSpec, ResolvedPersona, PersonaSpawnSpec,
MaterializedConfigFile) and helper functions (buildPersonaSpawnSpec,
materializePersonaConfigFiles, restorePersonaConfigFiles); and (4) API changes:
loadPersona now returns PersonaSpec and spawnPersona({ persona }) now expects a
PersonaSpec — include a short migration note for each breaking change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ee8bb3b9-dbce-420c-9511-b27bc2da7f05
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
CHANGELOG.mdpackages/sdk/src/relay.ts
✅ Files skipped from review due to trivial changes (1)
- packages/sdk/src/relay.ts
There was a problem hiding this comment.
1 issue found across 4 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/prettier-fmt-fix.yml">
<violation number="1" location=".github/workflows/prettier-fmt-fix.yml:9">
P2: Include the repo's other Prettier-managed extensions here. Right now `.mjs`, `.cjs`, `.mts`, `.cts`, and `.toml` edits will not trigger this bot.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| paths: | ||
| - '**.css' | ||
| - '**.html' | ||
| - '**.js' |
There was a problem hiding this comment.
P2: Include the repo's other Prettier-managed extensions here. Right now .mjs, .cjs, .mts, .cts, and .toml edits will not trigger this bot.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/prettier-fmt-fix.yml, line 9:
<comment>Include the repo's other Prettier-managed extensions here. Right now `.mjs`, `.cjs`, `.mts`, `.cts`, and `.toml` edits will not trigger this bot.</comment>
<file context>
@@ -0,0 +1,78 @@
+ paths:
+ - '**.css'
+ - '**.html'
+ - '**.js'
+ - '**.json'
+ - '**.jsonc'
</file context>
Summary
agent-relay mcpstdio server backed by the Relaycast SDK, including resource subscriptions and result callback supportnpx -y agent-relay mcpand remove@relaycast/mcpfrom package manifests.mcp.json; spawned agents still receive MCP config at launch timeTests
npx tsc --noEmit --pretty falsenpx vitest run src/cli/relaycast-mcp.test.ts src/cli/relaycast-mcp.startup.test.ts src/cli/entrypoint.test.ts src/cli/index.test.ts src/cli/commands/core.test.ts(src/cli/index.test.tsskipped in the clean worktree because no built CLI artifact was present)cargo checkcargo test snippetscargo test cli_mcp_argsnpm --prefix plugins/gemini-relay-extension run check