feat(voice): make beep notification volume configurable in config.yaml - #195
feat(voice): make beep notification volume configurable in config.yaml#195hashbender wants to merge 1 commit into
Conversation
|
Review Complete Files Reviewed: 4 By Severity:
This PR removes the prompt_caching.enabled config key from defaults and docs while the runtime still supports it as a kill switch, creating a documentation-code inconsistency that hides a needed escape hatch from users. Files Reviewed (4 files) |
There was a problem hiding this comment.
Risk: 🟡 Medium (45/100) — 1 medium finding · 149 LOC across 4 files
Summary
1 finding (medium severity) flagged in hermes_cli/config.py.
Key Issue: Incomplete migration of prompt_caching.enabled kill switch
The PR removes the enabled: True key from DEFAULT_CONFIG["prompt_caching"] in hermes_cli/config.py (line 1395-1397) and updates the website docs to claim "No knob exists to disable this — caching is always-on." However:
agent/agent_runtime_helpers.py:1446-1459still contains a "Global kill switch" block that reads_pc_cfg.get("enabled")and returnsFalse, Falsewhen explicitly set toFalse.agent/agent_init.py:524confirms with a comment thatprompt_caching.enabled=falseis honored.- Tests in
tests/run_agent/test_anthropic_prompt_cache_policy.py:335-409still verify the kill switch works.
Impact: Users behind strict Anthropic-compatible proxies that inject their own cache_control markers need this escape hatch to avoid exceeding Anthropic's 4-breakpoint limit (which causes HTTP 400 errors). The runtime supports it; the docs now falsely deny its existence.
| "prompt_caching": { | ||
| "enabled": True, | ||
| "cache_ttl": "5m", | ||
| }, |
There was a problem hiding this comment.
🟡 prompt_caching.enabled kill switch removed from config defaults and docs but still honored by runtime (bug)
The PR removes enabled: True from DEFAULT_CONFIG["prompt_caching"] in hermes_cli/config.py (line 1395-1397) and updates website/docs/user-guide/configuration.md to state "No knob exists to disable this — caching is always-on." However, agent/agent_runtime_helpers.py:1446-1459 still contains a "Global kill switch" block that reads _pc_cfg.get("enabled") and returns False, False when explicitly set to False — meaning the escape hatch remains alive and functional for any user who already has or discovers the key. The comment at agent/agent_init.py:524 confirms prompt_caching.enabled=false is honored. Tests in tests/run_agent/test_anthropic_prompt_cache_policy.py:335-409 still verify this kill switch works across native Anthropic, OpenRouter, and third-party proxy endpoints.
Impact: users behind strict Anthropic-compatible proxies that inject their own cache_control markers server-side need to disable client-side markers to avoid exceeding Anthropic's 4-breakpoint limit (which causes HTTP 400 errors). The docs now falsely claim no knob exists, hiding the workaround from affected users while the runtime code continues to support it.
Sources: sweep (swp-001), holistic (holi-001), domain-llm-prompt-caching (dom-001).
💡 Suggestion: Choose one consistent path: (A) Restore the enabled key to DEFAULT_CONFIG and fix the docs to acknowledge the escape hatch (recommended — preserves backward compatibility for users who depend on this); or (B) Fully remove the kill-switch code in agent_runtime_helpers.py and the corresponding test class.
📋 Prompt for AI Agents
In hermes_cli/config.py around line 1395, restore the enabled key to the prompt_caching section alongside cache_ttl:
"prompt_caching": {
"enabled": True,
"cache_ttl": "5m",
},
In website/docs/user-guide/configuration.md around line 910, replace 'No knob exists to disable this — caching is always-on' with accurate documentation of the escape hatch: 'Caching is always-on by default. Set enabled: false only as an escape hatch for strict Anthropic-compatible proxies that inject their own cache_control markers server-side — stacking those on top of Hermes' breakpoints can exceed Anthropic's 4-breakpoint limit and return HTTP 400.'
Summary
tools.voice_mode:play_beep()hardcoded the tone amplitude at0.3(NousResearch#55908), so the CLI voice-mode record start/stop beeps were too quiet on low-volume systems / headphones. Users couldn't adjust it without editing source. This PR addsvoice.beep_volumetoconfig.yamlwith a0.3default, preserving existing behavior for unconfigured installs.Changes
tools/voice_mode.pyplay_beep()— replaces the literal0.3with a dynamic value read from config._get_beep_volume()next toplay_beep()(same module, audio-cue section):0.3when the key is absent — byte-for-byte identical to current behavior.hermes_cli.config.load_config(), the same pattern already used bycli.py:_voice_beeps_enabled()(L10986-10995) andhermes_cli/voice.py:_beeps_enabled()(L247-257).load_configinside the function (parity with the two existing call sites) so a broken~/.hermes/config.yamlcan never break module import.0.0–1.0; falls back to default on out-of-range, NaN, non-numeric, bool, orload_configexception. The bool guard mirrors the long-standingisinstance(_threshold, (int, float)) and not isinstance(_threshold, bool)pattern atcli.py:10764-10765forsilence_threshold.hermes_cli/config.py—_DEFAULT_CONFIG_SCHEMAvoice:section default, adjacent tobeep_enabled(L2024):tests/tools/test_voice_mode.py— 2 new test classes:TestGetBeepVolume(12 cases): default-when-missing, default-when-section-missing, custom value, boundary0.0/1.0, out-of-range high/low, numeric string coercion, non-numeric fallback, bool fallback, NaN fallback, exception fallback, wrong-type-voice-section fallback.TestPlayBeepVolumeWiring(1 case):inspect.getsourceguard against re-introducing a hardcoded0.3literal at the amplitude line — regression guard for the original symptom.website/docs/user-guide/configuration.mdvoice:reference block (L1580) with an inline comment matching the other entries' style. Locale translations (zh-Hans, etc.) are intentionally untouched — handled by the regular i18n sync pipeline.How to Test
User Migration
No action required. Users who haven't configured
voice.beep_volumekeep the existing0.3amplitude byte-for-byte. To make the beep louder:Out-of-range values silently use the default — a typo cannot brick the voice loop.
Checklist
ruff check— PASS, 0 warningsRisk & Impact
None. No behavior change without an opt-in
voice.beep_volumekey in config. All fallback paths degrade to the existing0.3default. A bad config value can't break the voice loop.Type: ✨ New feature
Closes: NousResearch#55908
Mirror-of: NousResearch#56116
NousResearch#56116