fix: isolate Relaycast agent auth#293
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Warning Review limit reached
Next review available in: 58 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
✨ 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 |
There was a problem hiding this comment.
Code Review
This pull request removes WORKFORCE_AGENT_TOKEN from the token resolution logic in packages/runtime/src/relay.ts to ensure workflow tokens are not sent to Relaycast, updating the associated tests and warning logs. Feedback highlights that a mirrored implementation of token resolution and warning logs in packages/delivery/src/relaycast.ts also needs to be updated to prevent the same authentication issue.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| function resolveAgentToken(env: NodeJS.ProcessEnv): string | undefined { | ||
| return ( | ||
| env.WORKFORCE_AGENT_TOKEN?.trim() || | ||
| env.RELAY_AGENT_TOKEN?.trim() || | ||
| env.RELAY_API_KEY?.trim() || | ||
| undefined |
There was a problem hiding this comment.
The file packages/delivery/src/relaycast.ts contains a mirrored implementation of token resolution (resolveRelayAgentToken) and warning logs that still reference WORKFORCE_AGENT_TOKEN. Since the goal of this PR is to isolate Relaycast agent auth and reject WORKFORCE_AGENT_TOKEN from being sent to /v1/dm, please update packages/delivery/src/relaycast.ts as well to prevent the same authentication issue there.
f802112 to
109d6d6
Compare
a179ff1 to
8b76065
Compare
8b76065 to
9842804
Compare
Summary
ctx.relay.dm()and delivery's default Relaycast sender only with a Relaycast credentialRELAY_AGENT_TOKEN, withRELAY_API_KEYretained as the legacy Relaycast fallbackWORKFORCE_AGENT_TOKENrather than sending it to/v1/dmRoot cause
Deployed personas currently receive a Relayfile/workflow JWT in
WORKFORCE_AGENT_TOKEN. Both workforce Relaycast send paths selected that token ahead of the real Relaycast token and sent it tocast.agentrelay.com/v1/dm, where the wrong audience correctly produced 401.This PR fixes the workforce credential boundary. The companion Cloud change will mint/register a stable Relaycast identity and inject
RELAY_AGENT_TOKENseparately.RED-first evidence
Before each implementation, the runtime and mirrored delivery regression tests both failed:
Bearer tok_agent, receivedBearer tok_workflowThe delivery mirror was added after independent review identified it, resetting the review SHA.
Validation
pnpm --filter @agentworkforce/delivery test— 19/19 passpnpm --filter @agentworkforce/runtime buildnode --test packages/runtime/dist/relay.test.js— 6/6 passThe full runtime suite has 13 pre-existing local-preview failures in this checkout because the host is Node 25.8 while the preview guard requires patched Node >=26.3.1. The Relaycast regression suites are isolated from that environment gate and pass completely.