fix: bundle Rust broker binary for SDK programmatic usage#440
Merged
khaliqgant merged 1 commit intomainfrom Feb 18, 2026
Merged
fix: bundle Rust broker binary for SDK programmatic usage#440khaliqgant merged 1 commit intomainfrom
khaliqgant merged 1 commit intomainfrom
Conversation
4c481e0 to
30ad64a
Compare
Comment on lines
+165
to
+174
| await writeFile( | ||
| cachePath, | ||
| JSON.stringify({ | ||
| workspace_id: workspaceId, | ||
| api_key: apiKey, | ||
| agent_id: '', | ||
| agent_name: null, | ||
| updated_at: new Date().toISOString(), | ||
| }), | ||
| ); |
Check failure
Code scanning / CodeQL
Potential file system race condition High
Comment on lines
+167
to
+173
| JSON.stringify({ | ||
| workspace_id: workspaceId, | ||
| api_key: apiKey, | ||
| agent_id: '', | ||
| agent_name: null, | ||
| updated_at: new Date().toISOString(), | ||
| }), |
Check warning
Code scanning / CodeQL
Network data written to file Medium
The SDK's AgentRelayClient spawns `agent-relay init --name broker
--channels <channel>` which requires the Rust broker binary, not
the Bun-compiled Node.js CLI. The publish workflow was uploading
the CLI as `agent-relay-{platform}-{arch}` and postinstall was
downloading it into sdk-ts/bin/, causing "broker exited (code=1)"
errors for all workflow runs.
Changes:
- Add `build-broker` CI job that compiles src/main.rs (Rust) for
all platforms as `agent-relay-broker-{platform}-{arch}`
- Update postinstall.js to download broker-specific release assets
- Add validation to detect wrong binary (CLI vs Rust broker)
- Check target/release before target/debug in dev fallback
- Add Relaycast auto-provisioning to WorkflowRunner so workflows
run without manual RELAY_API_KEY setup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30ad64a to
fa5a41f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AgentRelayClientspawnsagent-relay init --name broker --channels <channel>which requires the Rust broker binary, not the Bun-compiled Node.js CLIagent-relay-{platform}-{arch}andpostinstall.jswas downloading it intosdk-ts/bin/, causing "broker exited (code=1)" for all workflow runsRELAY_API_KEYsetupChanges
CI: Add
build-brokerjob (publish.yml)src/main.rsviacargo build --releasefor all 4 platformsagent-relay-broker-{platform}-{arch}(distinct from CLI'sagent-relay-{platform}-{arch})Postinstall: Download correct binary (
postinstall.js)getBrokerBinaryName()now returnsagent-relay-broker-{platform}-{arch}instead ofagent-relay-{platform}-{arch}--nameflag ininit --help)target/releasebeforetarget/debugin dev fallbackWorkflowRunner: Auto-provision Relaycast (
runner.ts)ensureRelaycastApiKey()runs before broker startupRELAY_API_KEYenv var → cached~/.agent-relay/relaycast.json→ auto-create workspacerelay-{channel}-{hex}) to avoid 409 conflictsTest plan
npm run buildpasses (sdk-ts compiles cleanly)agent-relay run workflows/example.yaml— broker should start without manual API key setupbuild-brokerjob produces valid Rust binaries for all platforms🤖 Generated with Claude Code