From c60de7db2c2e2f1356f7998b722e182f322478f5 Mon Sep 17 00:00:00 2001 From: Mikei386 <44135113+Mikei386@users.noreply.github.com> Date: Tue, 27 Oct 2026 11:53:33 +0100 Subject: [PATCH] Correct Hermes TTS route to follow the published endpoint profile --- .../hermes-fleet-audit-2026-10-26/audit.py | 195 ++++++++++++++++++ .../hermes-tts-selection-2026-10-27.md | 64 ++++++ 2 files changed, 259 insertions(+) create mode 100644 docs/maintenance/hermes-fleet-audit-2026-10-26/audit.py create mode 100644 docs/maintenance/hermes-tts-selection-2026-10-27.md diff --git a/docs/maintenance/hermes-fleet-audit-2026-10-26/audit.py b/docs/maintenance/hermes-fleet-audit-2026-10-26/audit.py new file mode 100644 index 0000000..ef08692 --- /dev/null +++ b/docs/maintenance/hermes-fleet-audit-2026-10-26/audit.py @@ -0,0 +1,195 @@ +#!/usr/bin/env python3 +"""Hermes fleet configuration acceptance; no bot settings are changed. + +Outputs names, counts and pass/fail only: no prompts, chat text, keys or auth tokens. +The upstream reader may maintain its bounded known-good recovery cache. +--runtime additionally loads the existing plugin/config registries in this process; +it starts no server, agent turn, notification, browser, SSH workspace or MCP tool. +""" +import argparse +import json +import os +from pathlib import Path +import stat + +import hermes_yaml as yaml +from agent.secret_scope import build_profile_secret_scope, set_secret_scope, reset_secret_scope +from hermes_constants import set_hermes_home_override, reset_hermes_home_override, get_subprocess_home +from hermes_cli.config import load_config, validate_config_structure +from hermes_cli.config_effective import load_user_config_effective +from hermes_cli.config_providers import get_compatible_custom_providers +from hermes_cli.runtime_provider import resolve_runtime_provider +from hermes_cli.auth import read_credential_pool +from agent.shell_hooks import allowlisted_pairs + +ROOT = Path('/opt/data') +ATHENA = 'http://192.168.1.212:8120/v1' +LITELLM = 'https://litellm.scc.kit.edu/v1' +KEY = 'HERMES_CUSTOM_192_168_1_212_8120_API_KEY' +CODE = {'terminal', 'file', 'web', 'browser', 'vision', 'skills', 'todo', 'memory', + 'session_search', 'clarify', 'code_execution'} +ROLES = { + 'default': ('general', None), + 'belanna-storres': ('nas', {'HomeServer', 'syncthing'}), + 'horizon-dev': ('coding', set()), + 'jean-luc-picode': ('coding', {'gitea', 'rea'}), + 'pruefungs-vdi-dev': ('coding', set()), + 'seven-of-heim': ('smart-home', {'HomeAssistant', 'HomeServer'}), + 'solid-crafter': ('cad', {'solidcraft'}), + 'william-t-time': ('scheduled', {'HomeAssistant', 'HomeServer'}), + 'ssh-horizon-ecc7d706': ('ssh-server', set()), + 'ssh-infvhost-1-5b1589d3': ('ssh-server', set()), + 'ssh-infvhost-2-731791df': ('ssh-server', set()), + 'ssh-pool-vdi-ff978f02': ('ssh-server', set()), + 'ssh-scc-gg3653-01-76dcf38d': ('ssh-server', set()), +} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--runtime', action='store_true') + parser.add_argument('--tts-model', default='tts', choices=('tts','qwen-06b-q4-anna-cpu'), help='Expected shared TTS model; tts follows sole Athena publication.') + args = parser.parse_args() + # Upstream's config reader refreshes its bounded last-known-good cache. + # Run as the data owner so an operator's root invocation cannot create + # root-owned recovery copies the service user later cannot read. + owner = (ROOT / 'config.yaml').stat() + if os.geteuid() == 0 and owner.st_uid != 0: + os.setgroups([]) + os.setgid(owner.st_gid) + os.setuid(owner.st_uid) + if args.runtime: + from tui_gateway import server + from hermes_cli.tools_config import _get_platform_tools + checks, profiles, cwd_seen, browser_seen = [], [], {}, {} + + def check(name, ok, profile=None): + checks.append(dict(check=name, passed=bool(ok), **({'profile': profile} if profile else {}))) + + managed = ROOT / 'managed' + shared = yaml.safe_load((managed / 'config.yaml').read_text()) or {} + check('shared_config_keys', set(shared) == {'providers', 'stt', 'tts', 'voice'}) + check('shared_provider_names', set(shared.get('providers') or {}) == {'athena', 'litellm'}) + check('managed_credentials_private', stat.S_IMODE((managed / '.env').stat().st_mode) == 0o600) + check('managed_startup_env', (ROOT / 'container.env').read_text().splitlines().count( + 'HERMES_MANAGED_DIR=/opt/data/managed') == 1) + for name in ('config.yaml', '.env'): + check('running_bootstrap_' + name, (Path('/etc/hermes') / name).resolve() == managed / name) + homes = [ROOT] + sorted(p for p in (ROOT / 'profiles').iterdir() if (p / 'config.yaml').is_file()) + ids = {'default' if h == ROOT else h.name for h in homes} + check('classified_roster', ids == set(ROLES)) + for home in homes: + name = 'default' if home == ROOT else home.name + role, expected_mcp = ROLES.get(name, ('unclassified', None)) + raw = yaml.safe_load((home / 'config.yaml').read_text()) or {} + scope = build_profile_secret_scope(home) + ht = set_hermes_home_override(home) + st = set_secret_scope(scope, profile_home=str(home)) + try: + cfg = load_config() + check('manufacturer_config_validator', not validate_config_structure(cfg), name) + for file in ('config.yaml', '.env', 'auth.json', 'shell-hooks-allowlist.json'): + path = home / file + if path.is_file(): + check('private_mode_' + file, stat.S_IMODE(path.stat().st_mode) == 0o600, name) + cache = home / 'backups/config' + if cache.is_dir(): + copies = [p for p in cache.glob('config.yaml.*') if p.is_file() and not p.is_symlink()] + check('recovery_cache_owner_and_access', cache.stat().st_uid == owner.st_uid + and all(p.stat().st_uid == owner.st_uid and os.access(p, os.R_OK) for p in copies), name) + check('profile_identity', (home / 'SOUL.md').is_file() and (home / 'workspace').is_dir(), name) + check('central_speech_not_copied', 'stt' not in raw and 'tts' not in raw, name) + check('central_provider_not_copied', not any(r.get('name', '').lower() in ('athena', 'kit-litellm') + for r in get_compatible_custom_providers(raw)), name) + for provider, url, key, model in ( + ('athena', ATHENA, KEY, (cfg.get('model') or {}).get('default')), + ('litellm', LITELLM, 'LITELLM_API_KEY', 'alias.medium-local'), + ): + route = resolve_runtime_provider(requested='custom:' + provider, target_model=model) + check(provider + '_runtime_route', route.get('base_url') == url + and bool(scope.get(key)) and route.get('api_key') == scope.get(key), name) + check('openai_global_login_available', bool(read_credential_pool('openai-codex')), name) + from tools.transcription_cloud import _resolve_openai_audio_client_config as stt_route + from tools.tts_tool_openai import _resolve_openai_audio_client_config as tts_route + sk, su = stt_route() + tk, tu, managed_tts = tts_route() + check('stt_runtime_route', su == ATHENA and sk == scope.get(KEY) + and cfg['stt']['openai']['model'] == 'parakeet-redux-cpu', name) + check('tts_runtime_route', tu == ATHENA and tk == scope.get(KEY) and not managed_tts + and cfg['tts']['openai']['model'] == args.tts_model, name) + check('remote_audio_relay', cfg['voice'].get('client_direct') is False, name) + mcp = cfg.get('mcp_servers') or {} + enabled_mcp = {k for k, v in mcp.items() if isinstance(v, dict) and v.get('enabled', True)} + if expected_mcp is not None: + check('role_mcp_scope', enabled_mcp == expected_mcp, name) + if role == 'smart-home': + ha = mcp['HomeAssistant']['tools']['include'] + mua = mcp['HomeServer']['tools']['include'] + check('smart_home_positive_lists', len(ha) == 31 and len(mua) == 6 + and 'ha_auth' not in ha and 'unraid_system_shell' not in mua, name) + terminal = cfg.get('terminal') or {} + backend = terminal.get('backend', 'local') + if role == 'ssh-server': + check('ssh_backend_preserved', backend == 'ssh' and bool(terminal.get('ssh_host')), name) + else: + cwd = terminal.get('cwd') + check('local_workspace', backend == 'local' and cwd and Path(cwd).is_dir() + and Path(cwd).is_relative_to(home) and cwd not in cwd_seen, name) + cwd_seen[cwd] = name + local_home = get_subprocess_home({'HERMES_HOME': str(home), 'HOME': '/opt/data/home', + 'TERMINAL_HOME_MODE': terminal.get('home_mode', 'auto')}) + check('isolated_terminal_home', local_home == str(home / 'home'), name) + browser = str((home / 'bot-desktop/browser-profile').resolve()) + check('isolated_browser_path', browser not in browser_seen, name) + browser_seen[browser] = name + check('headed_screen_policy', cfg.get('browser', {}).get('headed') is True + and cfg.get('bot_desktop', {}).get('auto_start') is True, name) + rc = home / 'bot-desktop/xdg/xfce4/helpers.rc' + check('browser_launcher_mapping', rc.is_file() + and 'WebBrowser=hermes-screen-browser' in rc.read_text().splitlines(), name) + hooks = cfg.get('hooks') or {} + pairs = {(event, item.get('command')) for event, items in hooks.items() + if isinstance(items, list) for item in items if isinstance(item, dict)} + check('all_configured_hooks_approved', pairs <= allowlisted_pairs(), name) + check('notification_scope_intent', bool(pairs) == (name in ('default', 'william-t-time')), name) + for plugin in (cfg.get('plugins') or {}).get('enabled', []): + if plugin == 'athena-pulse': + check('pulse_directory_entrypoint', (home / 'plugins/athena-pulse/__init__.py').is_file(), name) + record = dict(profile=name, role=role, backend=backend, + enabled_mcp=sorted(enabled_mcp), approved_hook_count=len(pairs), + auto_tts=cfg.get('voice', {}).get('auto_tts'), + memory_files={n: (home / 'memories' / n).is_file() for n in ('MEMORY.md', 'USER.md')}) + if args.runtime: + gui = set(server._load_enabled_toolsets('desktop') or []) + cli = set(_get_platform_tools(cfg, 'cli')) + api = set(_get_platform_tools(cfg, 'api_server')) + record.update(gui_toolsets=sorted(gui), cli_toolsets=sorted(cli), api_toolsets=sorted(api)) + if name in ('horizon-dev', 'pruefungs-vdi-dev'): + check('coding_canonical_platform_keys', set(cfg['platform_toolsets']) == {'cli', 'api_server'}, name) + check('coding_exact_cli_api_toolsets', cli == CODE and api == CODE, name) + check('coding_gui_toolsets', gui <= CODE | {'catalog', 'project', 'desktop_ui'} and CODE <= gui, name) + if name == 'jean-luc-picode': + check('picode_tool_scope', cli == CODE | {'gitea', 'rea'}, name) + if name == 'seven-of-heim': + check('seven_tool_scope', cli == CODE | {'HomeAssistant', 'HomeServer'}, name) + profiles.append(record) + finally: + reset_secret_scope(st) + reset_hermes_home_override(ht) + result = dict(schema=1, profiles=profiles, checks=checks, total_checks=len(checks), + passed=sum(c['passed'] for c in checks), failed=[c for c in checks if not c['passed']], + runtime_registries_checked=args.runtime, + limitations=['No inference or audio generation.', 'No notification sent.', + 'No SSH target host contacted.', 'No MCP tool executed.', + 'No Mac GUI or full restart/restore acceptance.', + 'No active session or production transcript was read.']) + # Importing the gateway redirects Python's sys.stdout to its log stream. + # Keep the explicitly documented JSON stdout contract usable by operators. + output = (json.dumps(result, ensure_ascii=False, indent=2) + '\n').encode() + with os.fdopen(os.dup(1), 'wb') as stream: + stream.write(output) + raise SystemExit(bool(result['failed'])) + + +if __name__ == '__main__': + main() diff --git a/docs/maintenance/hermes-tts-selection-2026-10-27.md b/docs/maintenance/hermes-tts-selection-2026-10-27.md new file mode 100644 index 0000000..6607f6b --- /dev/null +++ b/docs/maintenance/hermes-tts-selection-2026-10-27.md @@ -0,0 +1,64 @@ +# Hermes TTS endpoint selection correction — 27 October 2026 + +Michael reported stutter/crackles on both Hermes Mac and Conduit, including +repeated explicit read-aloud of an existing reply without LLM generation. +Initial attribution to a model-independent playback fault was premature. + +## Verified mismatch + +- Athena had both Qwen Q4 and Articulino published simultaneously. +- The shared Hermes managed configuration still explicitly named + `qwen-06b-q4-anna-cpu`. Both streaming OpenAI and ordinary OpenAI TTS resolve + that shared model setting; publishing another profile alone cannot change it. +- Articulino's job directory contained only the known setup UI test. The three + newest completed Qwen jobs each produced 6.96 seconds audio in 7.4964, + 8.2939 and 8.1083 seconds respectively (RTF 1.077–1.192, without queue time). + These records contain metadata only; no private text/audio was collected. +- The claim that no Hermes setting needed changing was incorrect. These read- + aloud trials therefore do not yet establish Articulino-vs-Qwen equivalence + or isolate the fault to Hermes playback. They are consistent with Qwen + synthesis underrunning playback; the complete cause remains unproven. + +## Corrected centrally + +The existing shared `/opt/data/managed/config.yaml` now uses +`tts.openai.model: tts`. Changed through Hermes `atomic_config_replace`, as the +existing data owner; independent parsed readback proved that this is the only +changed setting, and file owner/group/mode were preserved. Existing keys, +endpoint, voice, provider, STT, personal read-aloud preferences and relay +selection are unchanged. No credential copied, no package installed and no +Hermes, container, host or Mac app restart/patch. + +Athena's regular authenticated profile checkbox was used to disable Qwen Q4; +Articulino remains published. Exactly one audio profile now satisfies `tts`. +Changing that single publication in future switches the shared Hermes route. + +Hermes' official managed loader caches by file signature and checks that +signature on read. Its audio WebSocket resolves the active profile's TTS config +at socket start. A fresh read-aloud/conversation is required; an already-open +speech socket may retain its previously resolved provider. No new desktop +feature or web-only plugin was introduced. The configuration is on the NAS +Hermes gateway; the model runs on Athena CPU. Existing native remote Mac and +Conduit surfaces continue to use their existing speech path. + +## Verification and limits + +- All 13 profiles pass the real configuration/runtime TTS-route audit with the + expected model `tts`, same Athena endpoint and same internally resolved key. +- The complete read-only audit reports 271/272 passes. Its independent + `default` config-file mode check fails; no permission change was bundled + into this speech-routing correction. Do not report the whole audit as green. +- Existing audit now accepts `--tts-model` (default `tts`); the former pinned + Qwen expectation remains available explicitly for historical comparisons. +- No generated-text turn, production transcript collection, MCP action or + notification was initiated by the fleet check. +- A new Conduit read-aloud comparison has been requested after the corrected + routing. Its perceptual outcome and actual Articulino job still need matching; + do not declare the crackles fixed or a Mac-specific bug proven. + +The official [voice-mode documentation](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/voice-mode.md) +explains the gateway relay and optional desktop client-direct mode. The actual +shared setting remains `voice.client_direct: false`; no change to routing hops +was made. A separate macOS haptics/CoreAudio interruption report +[issue 68894](https://github.com/NousResearch/hermes-agent/issues/68894) is not +sufficient evidence for this cross-client symptom and was not used as a fix.