fix(aws): nest endpointingSensitivity under turnDetectionConfiguration for Nova Sonic 2#6201
Open
St-Luciferr wants to merge 2 commits into
Open
fix(aws): nest endpointingSensitivity under turnDetectionConfiguration for Nova Sonic 2#6201St-Luciferr wants to merge 2 commits into
St-Luciferr wants to merge 2 commits into
Conversation
…n for Nova Sonic 2
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Nova Sonic 2 (
amazon.nova-2-sonic-v1:0) rejects thesessionStartevent withValidationException: Invalid input requestbecause the plugin emits theturn-detection setting as a flat
endpointingSensitivityfield — the legacyNova 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 interruptionand session shutdown.Changes
TurnDetectionConfigurationmodel and aturnDetectionConfigurationfield on
SessionStart.SonicEventBuilderserialization model-aware: Nova Sonic 2 → nestedturnDetectionConfiguration; Nova Sonic 1 (amazon.nova-sonic-v1:0) → legacyflat
endpointingSensitivity(no regression). Detection uses a substringmatch (
"nova-2-sonic" in model) so cross-region inference-profile ids suchas
us.amazon.nova-2-sonic-v1:0are handled correctly.SonicEventBuilderconstruction 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.
sessionStartevent withexclude_none=Trueso only therelevant field is emitted.
Behavior notes
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 nowactually applies.
Testing
livekit-plugins/livekit-plugins-aws/tests/test_nova_sonic_turn_detection.py:turnDetectionConfiguration.endpointingSensitivity,no flat field.
endpointingSensitivity, no nested field.us.amazon.nova-2-sonic-v1:0) → nested form.make checkpasses (ruff format, ruff lint, mypy).closes Nova Sonic 2 sessionStart rejected: endpointingSensitivity must be nested under turnDetectionConfiguration #6200