Skip to content

fix(aws): nest endpointingSensitivity under turnDetectionConfiguration for Nova Sonic 2#6201

Open
St-Luciferr wants to merge 2 commits into
livekit:mainfrom
St-Luciferr:fix/nova-sonic-2-turn-detection
Open

fix(aws): nest endpointingSensitivity under turnDetectionConfiguration for Nova Sonic 2#6201
St-Luciferr wants to merge 2 commits into
livekit:mainfrom
St-Luciferr:fix/nova-sonic-2-turn-detection

Conversation

@St-Luciferr

Copy link
Copy Markdown

Summary

Nova Sonic 2 (amazon.nova-2-sonic-v1:0) rejects the sessionStart event with
ValidationException: Invalid input request because the plugin emits the
turn-detection setting as a flat endpointingSensitivity field — the legacy
Nova Sonic 1 shape. Nova 2 requires it nested under turnDetectionConfiguration
(AWS docs).
This breaks every Nova Sonic 2 session at startup and cascades into
speech not done in time after interruption and session shutdown.

Changes

  • Add a TurnDetectionConfiguration model and a turnDetectionConfiguration
    field on SessionStart.
  • Make SonicEventBuilder serialization model-aware: Nova Sonic 2 → nested
    turnDetectionConfiguration; Nova Sonic 1 (amazon.nova-sonic-v1:0) → legacy
    flat endpointingSensitivity (no regression). Detection uses a substring
    match ("nova-2-sonic" in model) so cross-region inference-profile ids such
    as us.amazon.nova-2-sonic-v1:0 are handled correctly.
  • Thread the model id into both SonicEventBuilder construction sites,
    including the session reconnect/restart path — otherwise a reconnected
    Nova Sonic 1 session would fall back to the default model id and wrongly emit
    the nested form.
  • Serialize the sessionStart event with exclude_none=True so only the
    relevant field is emitted.

Behavior notes

  • The plugin's serialization was unchanged across recent releases (verified back
    through 1.3.x), so this is an AWS-side validation tightening, not a recent
    plugin regression. On Nova Sonic 2 the flat field was previously silently
    ignored
    , so turn_detection=... was effectively a no-op there — it now
    actually applies.

Testing

@St-Luciferr St-Luciferr requested a review from a team as a code owner June 24, 2026 09:01
@CLAassistant

CLAassistant commented Jun 24, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

devin-ai-integration[bot]

This comment was marked as resolved.

…sensitivity

Nova Sonic's endpointingSensitivity only accepts HIGH | MEDIUM | LOW
(MEDIUM default) — the API has no "disable turn detection" mode, and the
sole caller always passes a non-None TURN_DETECTION value. Tighten the
SonicEventBuilder signatures from `TURN_DETECTION | None` to
`TURN_DETECTION` so the type reflects the API contract, and simplify the
Nova 2 branch to `if self._nova_sonic_2:`.

Also add the mandatory `pytest.mark.unit` category marker to the
turn-detection regression test.
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.

Nova Sonic 2 sessionStart rejected: endpointingSensitivity must be nested under turnDetectionConfiguration

2 participants