Skip to content

fix(hume): reject instant_mode without a voice in update_options - #2851

Open
rosetta-livekit-bot[bot] wants to merge 1 commit into
mainfrom
port/hume-instant-mode-validation
Open

rosetta-livekit-bot[bot] wants to merge 1 commit into
mainfrom
port/hume-instant-mode-validation

Conversation

@rosetta-livekit-bot

@rosetta-livekit-bot rosetta-livekit-bot Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Testing

  • pnpm test plugins/hume
  • pnpm exec turbo run build --filter=@livekit/agents-plugin-hume...
  • pnpm --filter @livekit/agents-plugin-hume lint
  • pnpm --filter @livekit/agents-plugin-hume api:check
  • pnpm exec prettier --check "plugins/hume/src/**/*.{ts,tsx,md,json}" ".changeset/quiet-pandas-smile.md"
Source diff coverage

Source diff coverage

  • livekit-plugins/livekit-plugins-hume/livekit/plugins/hume/tts.py: adapted to plugins/hume/src/tts.ts, with explicit nullable voice type support in plugins/hume/src/models.ts and the generated update in plugins/hume/etc/agents-plugin-hume.api.md. TypeScript needs null to distinguish an explicit no-voice value from an omitted optional property; constructor defaulting and validation were brought to the source baseline so the update validation has the same state model.
  • tests/test_plugin_hume_tts.py: adapted to plugins/hume/src/tts.test.ts. Both source tests were ported: rejected updates remain atomic, and consistent joint voice/instant-mode updates succeed. No additional behavioral tests were added.
  • Not applicable: none. Every source diff file has a target counterpart and was ported.

Ported from livekit/agents#8090

Original PR description

Problem

hume.TTS refuses instant mode without a voice in the constructor, but update_options doesn't check it:

hume.TTS(api_key="...", voice=None, instant_mode=True)
# ValueError: Hume TTS: instant_mode cannot be enabled without specifying a voice

tts = hume.TTS(api_key="...", voice=None)   # instant_mode resolves to False
tts.update_options(instant_mode=True)       # accepted

tts = hume.TTS(api_key="...")               # default voice, instant_mode resolves to True
tts.update_options(voice=None)              # accepted, instant mode stays on

Both calls store a configuration Hume rejects, so the mistake only shows up later as an API error on the next synthesis.

Fix

update_options checks the options the update would produce (each given value, else the current one) before changing anything, and raises the constructor's ValueError. A rejected update leaves the options as they were. Dropping the voice still works when instant_mode=False is passed in the same call.

Tests

New tests/test_plugin_hume_tts.py (hermetic, unit marker):

  • test_update_options_rejects_instant_mode_without_a_voice: both calls above raise, and the rejected update changes no option (including speed passed alongside). Fails on main.
  • test_update_options_accepts_a_consistent_voice_and_instant_mode: clearing the voice together with instant_mode=False, and setting a voice together with instant_mode=True, still work.
uv run pytest tests/test_plugin_hume_tts.py                        # 2 passed
uv run ruff check livekit-plugins/livekit-plugins-hume tests/test_plugin_hume_tts.py
uv run ruff format --check livekit-plugins/livekit-plugins-hume tests/test_plugin_hume_tts.py
uv run mypy --platform linux -p livekit.plugins.hume               # Success: no issues found

#7472 also edits hume/tts.py (the trailing_silence check in ChunkedStream._run). The two changes are in different functions.

🤖 Generated with Claude Code

@rosetta-livekit-bot
rosetta-livekit-bot Bot requested a review from a team as a code owner October 25, 2026 06:12
@changeset-bot

changeset-bot Bot commented Oct 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9086d8f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 41 packages
Name Type
@livekit/agents-plugin-hume Patch
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-anthropic Patch
@livekit/agents-plugin-assemblyai Patch
@livekit/agents-plugin-azure Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-cerebras Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-did Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-fishaudio Patch
@livekit/agents-plugin-google Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-krisp Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-liveavatar Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-meta Patch
@livekit/agents-plugin-minimax Patch
@livekit/agents-plugin-mistral Patch
@livekit/agents-plugin-mistralai Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-perplexity Patch
@livekit/agents-plugin-phonic Patch
@livekit/agents-plugin-protoface Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-runway Patch
@livekit/agents-plugin-sarvam Patch
@livekit/agents-plugin-silero Patch
@livekit/agents-plugin-soniox Patch
@livekit/agents-plugin-speechify Patch
@livekit/agents-plugin-synthesia Patch
@livekit/agents-plugin-tavus Patch
@livekit/agents-plugins-test Patch
@livekit/agents-plugin-trugen Patch
@livekit/agents-plugin-xai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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.

0 participants