Skip to content

fix: prevent voice preferences from being spoken - #8

Merged
AndyH0ng merged 1 commit into
mainfrom
fix/tts-voice-prompt-leak
Aug 25, 2026
Merged

AndyH0ng merged 1 commit into
mainfrom
fix/tts-voice-prompt-leak

Conversation

@AndyH0ng

@AndyH0ng AndyH0ng commented Aug 25, 2026 •

Copy link
Copy Markdown
Member

변경 사항

  • 사용자 입력만 Realtime 모델의 user message로 전달
  • CALM/BRIGHT/CLEAR를 cedar/coral/marin 실제 voice ID로 매핑
  • SLOW/NORMAL/FAST를 0.85/1.0/1.15 SDK speed 옵션으로 적용
  • 음성·속도 조합별 Realtime 세션을 캐시해 voice 불변 제약 대응
  • 알 수 없는 설정값은 기본 음성과 속도로 fallback

검증

  • uv run pytest (5 passed, 1 skipped)

Summary by CodeRabbit

  • New Features

    • Added support for selecting voice and speech speed for read-aloud sessions.
    • Reuses active speech sessions when the same voice and speed are selected.
    • Provides safe default voice and speed settings for unsupported preferences.
  • Bug Fixes

    • Improved speech-session cleanup when the application closes.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c6aa23c3-7fd0-421b-b93f-c1cbe7d7f095

📥 Commits

Reviewing files that changed from the base of the PR and between 5127474 and a48550e.

📒 Files selected for processing (3)
  • agent/agent.py
  • agent/logic.py
  • agent/tests/test_logic.py

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

RoomState now maps speech preferences to provider settings, caches realtime sessions by voice and speed, sends raw chat text to the selected session, and closes all cached resources during shutdown. Tests cover configured and unknown preference values.

Changes

Speech session configuration

Layer / File(s) Summary
Speech configuration mapping
agent/logic.py, agent/agent.py, agent/tests/test_logic.py
speech_config maps voice and speed preferences to provider values. Unknown preferences use "cedar" and 1.0. Tests validate configured and default mappings.
Cached realtime session lifecycle
agent/agent.py
RoomState creates sessions on demand, caches them by voice and speed, applies instructions during creation, sends raw chat text, and closes all cached sessions and models during shutdown.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to a4855

This PR updates voice and speed preference handling and falls back for unknown settings; no actionable merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant RoomState
  participant speech_config
  participant RealtimeSession
  RoomState->>speech_config: Resolve voice and speed attributes
  speech_config-->>RoomState: Return voice and speed tuple
  RoomState->>RealtimeSession: Create or reuse cached session
  RoomState->>RealtimeSession: Send raw chat text and generate reply
Loading

Suggested reviewers: perasite

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: preventing voice preferences from being spoken.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/tts-voice-prompt-leak

Comment @coderabbitai help to get the list of available commands.

@AndyH0ng
AndyH0ng merged commit 7f62245 into main Aug 25, 2026
4 of 5 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.

1 participant