Skip to content

feat: add voice session bootstrap request - #197

Merged
nozokada merged 6 commits into
adobe:feature/voicefrom
nozokada:feat/voice-bootstrap
Nov 25, 2026
Merged

nozokada merged 6 commits into
adobe:feature/voicefrom
nozokada:feat/voice-bootstrap

Conversation

@nozokada

@nozokada nozokada commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Bottom of a stack: #197 → #205 → #206, merged in that order.
Base: feature/voice, cut from main at 3.10.2. Voice lands there, not in dev, so releases during the restricted change period don't pick it up. The pilot will use a prerelease build from that branch, and the branch goes to dev once a public release is approved.

Important

Waiting on a service change. The bootstrap now uses the request shape from a Concierge Conversation Service change that isn't merged yet: query.conversation.voice = {"action": "start"}. Stage still accepts only the old shape, so don't merge this into feature/voice until that change is on Stage. Until then, #205 and #206 stay on the previous head of this branch, and they still show the old shape.

Description

Adds the client side of the voice session bootstrap handshake, matching the iOS SDK. It has no voice transport and no UI; those come in a follow-up PR.

  • ConversationService.bootstrapVoiceSession(xdmFields, sessionId) returns a cold Flow<VoiceSessionBootstrap>. It posts a conversation event to the regional conversations route, /brand-concierge/{region}/conversations, the same route chat uses. conversation.voice = {"action": "start"} replaces message and marks the request as a voice bootstrap. The service rejects voice together with message.
    • It emits the first livekit_session credentials (livekitUrl, token) at most once, as a transport-neutral VoiceSessionBootstrap(url, token), then completes when the stream closes.
    • A stream that closes without credentials completes with no emission, and callers treat that as a failed bootstrap. This includes the error chunk the service sends when it rejects voice during an agent hand-off (VOICE_NOT_SUPPORTED_DURING_HANDOFF). A region where voice isn't enabled answers with HTTP 400, which surfaces as an HTTP error.
    • The default interface implementation returns an empty flow, so existing fakes and demo services compile unchanged.
  • Chat and voice share one endpoint builder, so the region segment is added the same way for both. Chat requests are unchanged.
  • The bootstrap body uses the same envelope as a chat turn (surfaces, identityMap, consent, and the auth token). The token from Concierge.setAuthTokenProvider goes in conversation.data ({"type": "auth", "payload": {"token": …}}), resolved the same way as for a chat turn, and is left out when there's none. The service accepts the token but doesn't pass it to the agent during voice yet.
  • The bootstrap also carries the held XDM context (updateXDMContext) passed in xdmFields, merged into xdm as in a chat turn. identityMap is reserved, as in chat. The SDK doesn't set xdm.eventType, so an eventType in the held context passes through as in a chat turn. The service drops it from the xdm it stores. The service keeps this xdm for the voice session and sends it with every voice turn. The request uses the passed sessionId, so the caller resolves the context for the same session.
  • ConversationResponseParser.parseVoiceBootstrap reads response.voice and type-checks it. Text-turn parsing is unchanged.
  • Chat turns and the bootstrap share one streaming request path (streamConversationEvents) and one envelope builder. Chat behavior, including cancellation, generation checks, and checking surfaces before resolving the auth token, is preserved. The bootstrap also checks surfaces before resolving the token.

Everything is internal. The public API is unchanged.

How Has This Been Tested?

  • ConciergeConversationServiceClientVoiceBootstrapTest (17) covers:
    • the regional endpoint (/brand-concierge/va6/conversations), method and headers, explicit session id, and request body. That includes the voice start marker (and its absence from chat bodies), the auth token as the data part and not in a header, no xdm.eventType, and the held XDM context next to the identityMap, with its eventType passed through;
    • credentials delivered, at most one emission, incomplete or other voice payloads ignored, no voice payload, and the hand-off error chunk completing without an emission;
    • HTTP error, connection failure, no surfaces (without calling the token provider), the chat region path kept, and the interface default.
  • ConversationResponseParserVoiceTest (7) covers voice payload parsing, checks that text-turn parsing is unaffected, and checks that a malformed frame's token isn't logged.
  • The full unit test suite and spotlessCheck pass.
  • Against the unmerged service change, run locally: a body built by the client, with a token, was posted to its conversations route. The service answers with livekit_session credentials, keeps the held context in the session's xdm without eventType, and doesn't store the token. It rejects the same body with message added and with data: {"type": "livekit-bootstrap"}.
  • Not tested on device with this shape, because Stage doesn't accept it yet. The earlier device test (Galaxy S25, Android 17, test app from feat: add a LiveKit voice transport to the test app #206, Stage, region va7) used the old shape.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.91304% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...le/concierge/network/ConversationResponseParser.kt 77.77% 0 Missing and 4 partials ⚠️
...erge/network/ConciergeConversationServiceClient.kt 96.51% 1 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

Adds bootstrapVoiceSession, which posts a livekit-bootstrap conversation event
to the region-less voice endpoint and emits the first livekit_session
credentials from the response stream. Chat turns and the bootstrap share the
streaming request path and the request envelope.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Voice used /brand-concierge-voice/conversations without the region, so EU
customers' bootstraps did not reach their region. The service now serves the
bootstrap from the regular /brand-concierge/{region}/conversations route when
the request carries xdm.eventType "conversation.voice" together with
conversation.data.type "livekit-bootstrap".

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nozokada
nozokada marked this pull request as ready for review November 10, 2026 03:30
nozokada and others added 3 commits November 18, 2026 15:55
Android's org.json quotes the whole input in its syntax errors, so logging
the exception message for a malformed bootstrap frame could write the
LiveKit token to the log. The parser now logs a fixed message.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The service keeps the bootstrap's xdm for the whole voice session and
replays it on every voice turn. bootstrapVoiceSession now takes the held
context snapshot next to the session ID it was resolved for and merges
it into xdm like a chat turn (identityMap stays reserved and the SDK's
eventType wins).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…th token

The voice bootstrap now marks the request with
query.conversation.voice = {"action": "start"} instead of
data = {"type": "livekit-bootstrap"} plus xdm.eventType = "conversation.voice".
The data slot now carries the auth token, as in a chat turn, and the SDK
no longer sets xdm.eventType.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@rymorale rymorale left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is one remaining area which still prints the token. other than that the PR looks good to me. feel free to merge after resolving.

SSEParser logged every raw line and every event's data at debug level,
so a successful voice bootstrap wrote the LiveKit URL and token to the
log. The bootstrap now turns payload logging off for its stream; the
lines and events are still logged without their content.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nozokada
nozokada merged commit d54845d into adobe:feature/voice Nov 25, 2026
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants