fix(voice): send the relay identity token where the backend can read it - #5428
Conversation
A realtime voice session passed the signed relay token only as `userId`. The provider never puts that value on the Custom-LLM request it makes to our relay: a capture of a live `POST /voice-agent/chat/completions` carried only [messages, model, max_tokens, stream, stream_options, temperature, tools], so the relay had no identity to verify and rejected every turn with "request is missing the user token". The desktop agent was never asked to answer. `customLlmExtraBody` does reach that request, forwarded under an `elevenlabs_extra_body` key, which is where the relay looks. Send the token there as well; `userId` stays for provider-side attribution.
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 42 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 Run ID: 📒 Files selected for processing (2)
Comment |
Summary
customLlmExtraBodyso itactually reaches the backend relay;
userIdalone never did.customLlmExtraBody, not only inuserId.Problem
A realtime voice session passed the relay token only as
startSession({ userId }).The provider puts that on its own conversation-init event, but it does not place
it on the Custom-LLM request it makes to our relay. A capture of a live
POST /voice-agent/chat/completionscarried only:No
user, nouser_id. The relay could not identify the caller, rejected theturn with
400 request is missing the user token, and the desktop agent wasnever asked to answer — the session connected, listened, and stayed silent.
Solution
Pass the same token through
customLlmExtraBody, which does reach theCustom-LLM request. The provider forwards it nested under an
elevenlabs_extra_bodykey rather than merging it into the top level, and therelay reads that shape (backend PR below).
userIdis left in place forprovider-side attribution, so nothing about the session binding changes.
Confirmed end to end against a live agent: with this change the relay logs
AUTH OKand dispatches to the desktop, where the orchestrator runs the turn.Submission Checklist
customLlmExtraBody, plus a dedicated case covering the token-delivery contract on its own. Failure paths for this hook (signed-URL rejection, SDKonError, disconnect) are already covered in the same suite.startSession, exercised by every passing case inuseRealtimeVoiceSession.test.ts(9 passing).N/A: behaviour-only fix inside an already-listed surface (5.1.x Voice); no feature row added, removed, or renamed.N/A: realtime voice ships dark behind VITE_VOICE_MODE and is not on a release-cut surface.Closes #NNN— see## Related.Impact
Desktop only, and only the realtime voice mode, which is gated behind
VITE_VOICE_MODEplus the persistedmascot.voiceModeand ships off bydefault. No change to the classic turn-based voice path.
Security: the value sent is the same short-lived, purpose-scoped relay token
already passed as
userId— no new secret leaves the client, and the relaystill verifies the signature rather than trusting any id in the payload.
Ordering: the backend accepts the token from both the top level and
elevenlabs_extra_body, so the two changes are independent and this can mergein either order.
Related
Depends on tinyhumansai/backend#1230 (relay reads the nested field and keeps the
stream alive while the desktop turn runs).
Follow-up to #5407 / #5399 (ElevenLabs Voice Agents).