#6677: fix(tts): always load fresh config for voice selection
agents
Cluster:
Security Enhancements for TTS
## Problem
The TTS tool was caching config at tool creation time, causing voice/provider changes to be ignored until gateway restart.
When users changed the TTS voice via config (e.g. from `alloy` to `fable`), the change wouldn't take effect because the tool kept using the stale config object passed during initialization.
## Solution
Changed `tts-tool.ts` to call `loadConfig()` on each invocation instead of using the cached `opts?.config`.
This ensures runtime config changes (voice selection, provider changes via `/tts` command or config updates) are picked up immediately.
## Testing
- Verified voice changes take effect immediately after config update
- Confirmed OpenAI TTS uses correct voice from config
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR changes the TTS agent tool to call `loadConfig()` on each `execute` invocation instead of using the config captured at tool creation time, so runtime updates (voice/provider selection) are picked up without restarting the gateway.
Change is localized to `src/agents/tools/tts-tool.ts`, and it feeds the freshly loaded config into the existing `textToSpeech` pipeline while keeping channel selection behavior the same.
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge with low risk; behavior change is straightforward and localized.
- The change removes reliance on a captured config object and instead uses the existing `loadConfig()` API (which already has internal caching/invalidations). Primary concern is interface drift: `opts.config` is now effectively ignored, which may surprise callers/tests, but runtime TTS behavior should improve as intended.
- src/agents/tools/tts-tool.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#22086: fix(tts): honor explicit config provider and model/voice settings
by AIflow-Labs · 2026-02-20
80.3%
#23071: fix(tts): make config auto=off a hard-disable that overrides user p...
by hydro13 · 2026-02-22
77.2%
#22618: feat(tts): add OpenAI TTS speed parameter support
by useramuser · 2026-02-21
77.0%
#7965: feat(tts): add Speechify as TTS provider
by chaerla · 2026-02-03
76.9%
#16089: fix(tts): clarify directive syntax in prompts and strip malformed tags
by kmixter · 2026-02-14
75.9%
#5499: fix(voice-call): wait for session creation before sending config up...
by lailoo · 2026-01-31
75.9%
#21110: fix(tts): deliver audio via structured mediaUrl instead of MEDIA: t...
by hydro13 · 2026-02-19
75.7%
#19489: fix(voice-call): add echo suppression for TTS playback
by kalichkin · 2026-02-17
75.4%
#19439: fix(tts): pass audioAsVoice flag through tool result pipeline
by brandonwise · 2026-02-17
75.3%
#8317: fix(tts): add dynamic timeout and retry logic for ElevenLabs TTS
by camtang26 · 2026-02-03
75.0%