Repository navigation
Conversation
…tion
Agent communication now accepts RELAY_RUN_TOKEN_FILE (access-only
{"token":"rt_live_...","expiresAt":...}) alongside the legacy RELAY_API_KEY
(rk_live_), preferring the file when both are set.
- preflight validates the file (absolute path, readable, rt_live_ token,
future expiresAt, no refresh token) without ever echoing the value
- the runtime registers and deletes its journal agent through a thin
POST /v1/agents + DELETE /v1/agents/:name adapter that re-reads the file
on every request; GET /v1/agents/:name is never used in this mode
- HarnessDriverClient.spawn receives runTokenFile (the path), never the value
- RELAY_RUN_TOKEN_FILE is blanked for communication agents; redaction covers rt_
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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 |
relaycast#550 expires at_live_ tokens after 15 minutes while runs can last hours. In run-token mode the SDK now rotates the journal agent's token via POST /v1/agents/:name/rotate-token (authenticated by its own at_live_) at two thirds of the lifetime or five minutes before expiry, whichever is earlier, matching the relay broker's schedule and fail-closed policy (401/403/404 stop; transient failures back off 2/5/10/20/30s). The token stays in memory; the messaging facade rebuilds its client on rotation and forces one rotation plus a single retry on 401. Run-token register/delete retry once on 401 after re-reading the file. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
maintainability lens — PASSMaintainability review — PR #675 (run-token mode + agent token rotation)The change is small (~460 LOC in two new files + wiring) and the WHY comments at the top of each new file are genuinely helpful. Below are the maintainability flags. Concerns1. 2. 3. Scheduled rotation fails closed silently. 4. Broker boundary not actually verified. 5. Notes
No defects that block correctness, but items 1–4 are the ones a stranger will trip on. REVIEW_PASSED |
history lens — PASSBlockers: none identified under the HISTORY criteria. Notes
Concerns — nonblocking for this lens
REVIEW_PASSED |
structure lens — UNCLEARError: OpenCode's free tier can only be used from within OpenCode. Download it at https://opencode.ai and keep building. |
|
🎯 review-swarm: FAILED (M:pass H:pass S:unclear) Lens transcripts posted as sibling comments above. |
Deploy hold
Do not merge or release yet. This change depends on:
rt_live_run tokens accepted byPOST /v1/agents/DELETE /v1/agents/:namefeat/broker-run-token-mode):HarnessDriverClient.spawn({ runTokenFile })plus broker run-token mode. The@agent-relay/harness-driverpeer floor must be raised to the release that ships it.WORKFLOW_SYSTEM_HELD_REFRESH_ENABLED.Legacy
RELAY_API_KEYruns behave the same as before.Summary
This implements section 3 of the run-token contract: a flow sandbox can run agent communication with no static
rk_live_workspace key.communication/run-token.ts(new)RELAY_RUN_TOKEN_FILEwins overRELAY_API_KEY.rt_live_token and a futureexpiresAt, and norefreshToken.POST /v1/agentsandDELETE /v1/agents/:namethat handles the{ok,data}/{ok:false,error}envelope.JSON.parseerrors, which quote their input, are replaced.preflight.ts: accepts either credential and validates the file.relay.ts(createRuntime)at_live_only.HarnessDriverClient.spawngetsrunTokenFile(the path), never the value, and noworkspaceKey.GET /v1/agents/:nameis never called.environment.ts:RELAY_RUN_TOKEN_FILEis added to the relay names that are blanked for communication agents and refused as grants.redact.ts: the token pattern now coversrt_/rt_live_.communication/agent-token.ts(new):at_live_expiry handling (relaycast#550). Agent tokens expire after 15 minutes, and runs can last 12 hours.at_live_is rotated viaPOST /v1/agents/:name/rotate-token, authenticated by its ownat_live_.token_expires_at, whichever is earlier. A token with no known expiry gets one probe rotation after 60s.agent_token_rotation.rs).RelayRuntime.messagingis a facade that rebuilds theRelaycastMessagingClientwhenever the token rotates. On a 401 it forces one rotation and retries once; sends carry idempotency keys, so a retry cannot duplicate a message.401 retry on register/delete: run-token register and delete retry once on 401. The retry re-reads the run token file, so a file Cloud rotated mid-request is picked up.
Relaycast auth check (relaycast#559 source). Every route the SDK uses in run-token mode accepts the per-agent
at_live_, so no Relaycast change is needed:channels.createPOST /v1/channelsrequireAuth(any)channels.getGET /v1/channels/:namerequireWorkspaceRead, agent allowedchannels.joinPOST /v1/channels/:name/joinrequireAgentTokenmessages.sendPOST /v1/channels/:name/messagesrequireSendermessages.directPOST /v1/dmrequireAgentTokenPOST /v1/agents/:name/rotate-tokenrequireAgentToken, self onlyWhy an adapter:
RelaycastMessagingClientin@agent-relay/sdktakes a single static credential when it is constructed (workspaceKey/apiKey/agentToken). It has no provider hook, so it cannot follow a rotating file. The SDK should grow first-class credential-provider support, after which the adapter can be removed.Tests
tests/communication-run-token.test.ts:rt_live_/rk_live_in the spawn options, and noworkspaceKey;RELAY_RUN_TOKEN_FILE=''.tests/communication-environment-preflight.test.ts:RELAY_API_KEY;rk_token, an empty token, a missing expiry, an expired token, arefreshToken, and a relative path, and the error messages do not contain the value;tests/redact.test.ts: added anrt_live_case.tests/communication-agent-token.test.ts(fake clock):at_live_/rt_live_value reaches the spawn options.npm run typecheckandnpm run typecheck:testsare clean.npm test: 53 failures across 15 files, all outside this change.origin/mainsources on this machine (Node 26: hosted-extension, live-kernel, webhook-live, mcp release binary, and others).close-pr-flow, was flaky and passed on the comparison run.Gaps
@agent-relay/harness-driverignoresrunTokenFile. Raise the peer floor before release so an old broker cannot start without credentials.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Agent Relay sessions
claudesession79b75307· opened viagh pr create· last active 2026-10-18