Expose SDK broker exit notifications#947
Conversation
The broker name is otherwise derived from the project directory basename, which means re-running `up` against a workspace that already has an agent with that name fails the relaycast handshake with `agent name '<name>' already exists`. The only existing workarounds were to rename the project directory or rotate the workspace key. Threads a `brokerName` option through `UpOptions`, `CoreDependencies.createRelay`, `createDefaultRelay`, and `createAgentRelayClient` into the SDK's `AgentRelayClient.spawn`, which already supported it. Also forwards `--broker-name` from background re-execs in `childUpArgsForDetachedStart` so programmatic callers (not just CLI users whose argv is preserved verbatim) get the override. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (13)
✨ 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 |
Summary
AgentRelayClient.onBrokerExit()and exportedBrokerExitInfofor SDK-spawned brokersbrokerPidafter managed broker exit and skip event/lease setup if the child dies during startupFixes #945
Verification
npm exec vitest run --config vitest.config.ts src/__tests__/client-broker-exit.test.tsnpm exec vitest run --config vitest.config.ts src/__tests__/client-stdout-drain.test.tsnpm --prefix packages/sdk run checknpx tsc -p tsconfig.build.jsongit diff --check -- CHANGELOG.md packages/sdk/README.md packages/sdk/src/client.ts packages/sdk/src/index.ts packages/sdk/src/workers.ts packages/sdk/src/__tests__/client-broker-exit.test.ts