Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

docs(wake): AP-25 becomes a probe-gated rule; deep-dive addendum with 2026-07-05 numbers

Ruben Lütke19813bece87f
diff --git a/AGENTS.md b/AGENTS.md
index 4785ece131..637e446f1e 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -303,7 +303,7 @@ land as `state="draft"` and are never auto-activated (AP-15).
| AP-22 | Configure a tier (router/ack/STT/TTS/worker/critic/fallback) whose primary AND fallback resolve to the SAME provider family, or build a fallback chain from hardcoded provider NAMES | Single-provider brick: one missing key / 429 / 402 / outage kills the whole tier even with a healthy DIFFERENT provider present. Resolve every tier through one key-aware chain that skips the dead/keyless provider, crosses families, and degrades honestly only when NO family is reachable — recoverable in-app |
| AP-23 | Build or TEST a feature only against the maintainer's config / keys / provider / OS and claim it done | The whole API-Keys surface silently bricked for every other downloader + on a headless VPS (credentials couldn't be SAVED, ENV keys read as "not configured", channels/plugins/OAuth 500'd). Verify the three non-maintainer paths in §3 |
| AP-24 | Call a shared native inference engine (ctranslate2/faster-whisper, an ONNX/torch session) concurrently from two callers, OR "recover" a hung inference with only a timeout that re-polls the SAME wedged engine | `WhisperModel.transcribe` is NOT thread-safe: the wake poll loop + VAD probe sharing one provider hung it forever; a hung `to_thread` can't be cancelled, so a timeout only BOUNDS, never RECOVERS. Fix: a non-blocking per-instance inference lock (2nd call → skip) + a `recover()` that rebuilds a FRESH model after N failures (BUG-036) |
-| AP-25 | Run the always-on wake/keyword Whisper on the **GPU** via CTranslate2/faster-whisper, or auto-upgrade a custom-phrase (`stt_match`) wake to `large-v3-turbo/cuda` | On the maintainer's Blackwell GPU (RTX 5070 Ti / sm_120) CTranslate2 `model.transcribe` **HANGS every inference** (8 s timeout → self-heal rebuilds the model → the cold rebuild hangs again → wake **permanently DEAF**). Same hang on `base`/`cpu` when ctranslate2's auto thread-pool deadlocks vs PyTorch's OpenMP in the shared process. Keep the wake on `base`/`cpu` with a FIXED `cpu_threads`; `[stt].wake_high_accuracy` GPU turbo is **OFF by default**, opt-in ONLY on a GPU verified not to hang. Truly instant+accurate custom-word wake needs a trained neural KWS model (openWakeWord `custom_onnx`), NOT transcription. See `docs/local-wakeword/WAKE-RELIABILITY-DEEPDIVE.md` |
+| AP-25 | Run the always-on wake/keyword Whisper on the **GPU** via CTranslate2/faster-whisper on the basis of CUDA *presence* alone, or hand-pin the upgrade to a hardware name | CUDA presence and CUDA *usability* diverge: on the maintainer's Blackwell GPU (RTX 5070 Ti / sm_120) CTranslate2 `model.transcribe` once **HUNG every inference** under the then-current runtime (8 s timeout → self-heal rebuilds the model → the cold rebuild hangs again → wake **permanently DEAF**), while `get_cuda_device_count()` was happily > 0; the same class hit `base`/`cpu` when ctranslate2's auto thread-pool deadlocked vs PyTorch's OpenMP in the shared process. Re-measured 2026-07-05 on the SAME GPU (ctranslate2 4.7.1 + torch 2.11-cu128): 40/40 turbo/cuda inferences under in-process torch-OpenMP load, zero hangs, p50 117 ms — the hang was **constellation-specific, not "Blackwell forever"**. Rule: gate the GPU wake upgrade on the automated out-of-process **inference probe** (`jarvis.plugins.stt._wake_gpu_inference_verified`: one real turbo/cuda transcribe in a killable subprocess, stdout-marker verdict — never the exit code, CUDA teardown can die after correct work — cached per ctranslate2 version in `data/wake_gpu_probe.json`), keep the probe OFF the boot path (only non-`fast_first` builds, i.e. the background hot-swap), keep a FIXED `cpu_threads` on the CPU floor, and keep the live backstop (a wedge on the swapped-in GPU model swaps back to the retained base/cpu fallback + `mark_wake_gpu_bad()`). `[stt].wake_high_accuracy=false` stays the hard opt-out. Truly instant+accurate custom-word wake still needs a trained neural KWS model (openWakeWord `custom_onnx`), NOT transcription. See `docs/local-wakeword/WAKE-RELIABILITY-DEEPDIVE.md` |
| AP-26 | Put a feature's init/import on the startup critical path (before `APP_INTERACTIVE` / `VOICE_USABLE`) — sync load in `_run_backend`, the `WebServer` ctor, `_start_speech_and_orb`, or a module-level heavy import | Boot creep: every feature "only adds a second" until boot takes 30+ s (TTU forensic: one wake change added a 114.7 s cascade). New subsystems hook into `_heavy_backend_bg`, a deferred registry scan, or a post-ready task; heavy imports stay lazy or use a `warmup_prefetch` daemon; routes answer 503/None while warming. **Enforced by the pre-push BOOT BUDGET gate** (`scripts/ci/check_boot_budget.py`: window ≤ 8 s, voice-usable + app-interactive ≤ 20 s). Doctrine: `docs/diagnostics/BOOT-TTU-NOTES.md` |
| AP-27 | Suppress `stt_match` wake ghosts by tightening TRANSCRIPT CONTENT — require the bias-echo confirm's unbiased pass to reproduce the wake word, raise phrase-matcher strictness on the confirm, or add any second content check that must contain the phrase | Kills recognition ENTIRELY: "fires on silence" flips to "never fires". A bias-primed local Whisper (`initial_prompt=<phrase>`, needed for proper-noun recall) HALLUCINATES the phrase on silence AND GARBLES it on speech (`'Mythos'`→`'Mütos'`/`'Hey, Mut!'`, `'Fable'`→`'Farbe'`); the unprimed base model can't spell a hard custom wake — so NO transcript-content rule separates ghost from wake without rejecting genuine wakes. The ONLY word-agnostic discriminator is raw audio ENERGY. Fix: suppress silence at the match site via the RMS gate (`RollingWhisperWake._match_min_rms`, ghost ≤ 0.0043 vs quiet-mic recall 0.009); keep the bias-echo confirm PERMISSIVE (heard any real speech → genuine, fail-open) and SKIP it on a loud window (`_ECHO_CONFIRM_SKIP_RMS`, latency). Guard: `tests/unit/speech/test_rolling_whisper_wake_silence_ghost.py::test_loud_wake_fires_even_when_unbiased_pass_garbles_the_hard_word` | <!-- i18n-allow: forensic quotes of the German STT-garble tokens under test -->
| AP-28 | Gate a pre-push / CI check on `isinstance` against the *installed* copy of a third-party lib that CI installs **unpinned** (newest), then trust "green on my machine" | Version-skew brick: the lib's next release changes internals and the gate CRASHES or false-fails in CI while green locally. Typer 0.26 vendored its own Click (`typer._click`), so `typer.main.get_command`'s root group + params stopped being `isinstance` of the *external* `click.Group`/`Argument`/`Option` → the CLI-drift gate `AssertionError`'d on every push though green on local Typer 0.21 (fix 621f837a). Discriminate by CAPABILITY, never concrete type (`.commands`, Click's stable `param_type_name`). **Before anything goes PUBLIC: CI must be GREEN and every red cause understood + fixed — reproduce against the SAME unpinned versions CI installs, not your local pins.** |
diff --git a/CLAUDE.md b/CLAUDE.md
index 4785ece131..637e446f1e 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -303,7 +303,7 @@ land as `state="draft"` and are never auto-activated (AP-15).
| AP-22 | Configure a tier (router/ack/STT/TTS/worker/critic/fallback) whose primary AND fallback resolve to the SAME provider family, or build a fallback chain from hardcoded provider NAMES | Single-provider brick: one missing key / 429 / 402 / outage kills the whole tier even with a healthy DIFFERENT provider present. Resolve every tier through one key-aware chain that skips the dead/keyless provider, crosses families, and degrades honestly only when NO family is reachable — recoverable in-app |
| AP-23 | Build or TEST a feature only against the maintainer's config / keys / provider / OS and claim it done | The whole API-Keys surface silently bricked for every other downloader + on a headless VPS (credentials couldn't be SAVED, ENV keys read as "not configured", channels/plugins/OAuth 500'd). Verify the three non-maintainer paths in §3 |
| AP-24 | Call a shared native inference engine (ctranslate2/faster-whisper, an ONNX/torch session) concurrently from two callers, OR "recover" a hung inference with only a timeout that re-polls the SAME wedged engine | `WhisperModel.transcribe` is NOT thread-safe: the wake poll loop + VAD probe sharing one provider hung it forever; a hung `to_thread` can't be cancelled, so a timeout only BOUNDS, never RECOVERS. Fix: a non-blocking per-instance inference lock (2nd call → skip) + a `recover()` that rebuilds a FRESH model after N failures (BUG-036) |
-| AP-25 | Run the always-on wake/keyword Whisper on the **GPU** via CTranslate2/faster-whisper, or auto-upgrade a custom-phrase (`stt_match`) wake to `large-v3-turbo/cuda` | On the maintainer's Blackwell GPU (RTX 5070 Ti / sm_120) CTranslate2 `model.transcribe` **HANGS every inference** (8 s timeout → self-heal rebuilds the model → the cold rebuild hangs again → wake **permanently DEAF**). Same hang on `base`/`cpu` when ctranslate2's auto thread-pool deadlocks vs PyTorch's OpenMP in the shared process. Keep the wake on `base`/`cpu` with a FIXED `cpu_threads`; `[stt].wake_high_accuracy` GPU turbo is **OFF by default**, opt-in ONLY on a GPU verified not to hang. Truly instant+accurate custom-word wake needs a trained neural KWS model (openWakeWord `custom_onnx`), NOT transcription. See `docs/local-wakeword/WAKE-RELIABILITY-DEEPDIVE.md` |
+| AP-25 | Run the always-on wake/keyword Whisper on the **GPU** via CTranslate2/faster-whisper on the basis of CUDA *presence* alone, or hand-pin the upgrade to a hardware name | CUDA presence and CUDA *usability* diverge: on the maintainer's Blackwell GPU (RTX 5070 Ti / sm_120) CTranslate2 `model.transcribe` once **HUNG every inference** under the then-current runtime (8 s timeout → self-heal rebuilds the model → the cold rebuild hangs again → wake **permanently DEAF**), while `get_cuda_device_count()` was happily > 0; the same class hit `base`/`cpu` when ctranslate2's auto thread-pool deadlocked vs PyTorch's OpenMP in the shared process. Re-measured 2026-07-05 on the SAME GPU (ctranslate2 4.7.1 + torch 2.11-cu128): 40/40 turbo/cuda inferences under in-process torch-OpenMP load, zero hangs, p50 117 ms — the hang was **constellation-specific, not "Blackwell forever"**. Rule: gate the GPU wake upgrade on the automated out-of-process **inference probe** (`jarvis.plugins.stt._wake_gpu_inference_verified`: one real turbo/cuda transcribe in a killable subprocess, stdout-marker verdict — never the exit code, CUDA teardown can die after correct work — cached per ctranslate2 version in `data/wake_gpu_probe.json`), keep the probe OFF the boot path (only non-`fast_first` builds, i.e. the background hot-swap), keep a FIXED `cpu_threads` on the CPU floor, and keep the live backstop (a wedge on the swapped-in GPU model swaps back to the retained base/cpu fallback + `mark_wake_gpu_bad()`). `[stt].wake_high_accuracy=false` stays the hard opt-out. Truly instant+accurate custom-word wake still needs a trained neural KWS model (openWakeWord `custom_onnx`), NOT transcription. See `docs/local-wakeword/WAKE-RELIABILITY-DEEPDIVE.md` |
| AP-26 | Put a feature's init/import on the startup critical path (before `APP_INTERACTIVE` / `VOICE_USABLE`) — sync load in `_run_backend`, the `WebServer` ctor, `_start_speech_and_orb`, or a module-level heavy import | Boot creep: every feature "only adds a second" until boot takes 30+ s (TTU forensic: one wake change added a 114.7 s cascade). New subsystems hook into `_heavy_backend_bg`, a deferred registry scan, or a post-ready task; heavy imports stay lazy or use a `warmup_prefetch` daemon; routes answer 503/None while warming. **Enforced by the pre-push BOOT BUDGET gate** (`scripts/ci/check_boot_budget.py`: window ≤ 8 s, voice-usable + app-interactive ≤ 20 s). Doctrine: `docs/diagnostics/BOOT-TTU-NOTES.md` |
| AP-27 | Suppress `stt_match` wake ghosts by tightening TRANSCRIPT CONTENT — require the bias-echo confirm's unbiased pass to reproduce the wake word, raise phrase-matcher strictness on the confirm, or add any second content check that must contain the phrase | Kills recognition ENTIRELY: "fires on silence" flips to "never fires". A bias-primed local Whisper (`initial_prompt=<phrase>`, needed for proper-noun recall) HALLUCINATES the phrase on silence AND GARBLES it on speech (`'Mythos'`→`'Mütos'`/`'Hey, Mut!'`, `'Fable'`→`'Farbe'`); the unprimed base model can't spell a hard custom wake — so NO transcript-content rule separates ghost from wake without rejecting genuine wakes. The ONLY word-agnostic discriminator is raw audio ENERGY. Fix: suppress silence at the match site via the RMS gate (`RollingWhisperWake._match_min_rms`, ghost ≤ 0.0043 vs quiet-mic recall 0.009); keep the bias-echo confirm PERMISSIVE (heard any real speech → genuine, fail-open) and SKIP it on a loud window (`_ECHO_CONFIRM_SKIP_RMS`, latency). Guard: `tests/unit/speech/test_rolling_whisper_wake_silence_ghost.py::test_loud_wake_fires_even_when_unbiased_pass_garbles_the_hard_word` | <!-- i18n-allow: forensic quotes of the German STT-garble tokens under test -->
| AP-28 | Gate a pre-push / CI check on `isinstance` against the *installed* copy of a third-party lib that CI installs **unpinned** (newest), then trust "green on my machine" | Version-skew brick: the lib's next release changes internals and the gate CRASHES or false-fails in CI while green locally. Typer 0.26 vendored its own Click (`typer._click`), so `typer.main.get_command`'s root group + params stopped being `isinstance` of the *external* `click.Group`/`Argument`/`Option` → the CLI-drift gate `AssertionError`'d on every push though green on local Typer 0.21 (fix 621f837a). Discriminate by CAPABILITY, never concrete type (`.commands`, Click's stable `param_type_name`). **Before anything goes PUBLIC: CI must be GREEN and every red cause understood + fixed — reproduce against the SAME unpinned versions CI installs, not your local pins.** |
diff --git a/docs/local-wakeword/WAKE-RELIABILITY-DEEPDIVE.md b/docs/local-wakeword/WAKE-RELIABILITY-DEEPDIVE.md
index 19a363154b..d9fd0ecaf6 100644
--- a/docs/local-wakeword/WAKE-RELIABILITY-DEEPDIVE.md
+++ b/docs/local-wakeword/WAKE-RELIABILITY-DEEPDIVE.md
@@ -108,3 +108,62 @@ window for latency (`_ECHO_CONFIRM_SKIP_RMS`; a loud wake fires ~0.6 s vs
~1.1 s). The recall guard `test_loud_wake_fires_even_when_unbiased_pass_garbles_the_hard_word`
must stay green. The clean endgame remains a trained neural KWS model
(`custom_onnx`) that does not transcribe at all.
+
+## The GPU turbo returns, probe-gated (2026-07-05, AP-25 revisited)
+
+The 2026-06-30 GPU fix above was later disabled globally
+(`wake_high_accuracy=False`) after the AP-25 Blackwell hang — which silently
+put EVERY host back on the weak `base/cpu` model and re-created the
+machine-/word-dependent wake quality this document opened with (live log
+2026-07-05: heartbeat with 288 transcriptions and 0 matches in 26 min for
+"Hey Nova"; accepted wakes read `'Hey Hey Nova'` — the user literally
+repeating the phrase).
+
+Re-measured on the SAME Blackwell GPU (RTX 5070 Ti / sm_120, ctranslate2
+4.7.1 + torch 2.11-cu128), all in one session:
+
+- Standalone turbo/cuda: load 8.4 s, inference 0.58 s cold / 0.11–0.12 s warm.
+- Torch-coexistence (3 in-process torch-OpenMP burner threads — the live app
+ constellation): **40/40 inferences, zero hangs**, p50 117 ms, max 336 ms.
+- `wake_bench --mode window`: warm median 121 ms / p95 860 ms (turbo/cuda)
+ vs 767 ms / p95 2853 ms (base/cpu t2).
+- `wake_bench --mode stream` (13 real captured wake streams, end-to-end
+ through `RollingWhisperWake.detect()`): **11/13 first-try hits,
+ word-end→trigger median 225 ms / p95 462 ms** (turbo/cuda) vs 8/13 and
+ 1097 ms / p95 4021 ms (base/cpu t2). Zero wedge-recovers on both.
+
+So the hang was **constellation-specific** (the then-current runtime combo),
+not a property of the architecture. The blanket default-off is replaced by a
+**capability probe** (AP-21): `build_wake_whisper`'s CUDA branches now also
+require `_wake_gpu_inference_verified()` — one real turbo/cuda transcribe in
+a killable subprocess (BUG-036: an in-process hang could never be cancelled),
+verdict = the `WAKE_GPU_PROBE_OK` stdout marker (never the exit code — the
+CUDA teardown can abort AFTER correct work, observed exit 127/0xC0000409),
+cached in `data/wake_gpu_probe.json` keyed by the ctranslate2 version so a
+runtime upgrade re-probes exactly once. The probe runs only on
+non-`fast_first` builds — i.e. inside the background hot-swap, never on the
+boot/hear-ready path (AP-26) and never on the live settings switch
+(`set_wake_plan` builds `fast_first`). Two hard-won details:
+
+1. **Import-order trap:** on hosts without a system CUDA toolkit,
+ `cublas64_12.dll` ships only inside `torch\lib` and becomes loadable when
+ torch's import registers its DLL directory. The live app always has torch
+ (Silero VAD) loaded long before the hot-swap; the probe mirrors that by
+ importing torch first (best effort). Probing without torch would fail with
+ "Library cublas64_12.dll is not found" on a host where the live upgrade
+ works fine — and would test the wrong coexistence constellation anyway.
+2. **Live backstop:** the hot-swap keeps the proven base/cpu provider
+ attached to the turbo instance (`_wake_gpu_fallback`). If the GPU model
+ ever wedges live, `_recover_wedged` swaps straight back (the fallback kept
+ its loaded model — instant) and persists the bad verdict via
+ `mark_wake_gpu_bad()`, so no later build re-runs the hanging inference.
+ Rebuilding the same CUDA model — the old behaviour — was the AP-25 deaf
+ cycle.
+
+`wake_high_accuracy` defaults to True again; False is the hard opt-out.
+CPU-only hosts, headless Linux and macOS are byte-identical to before (the
+probe is short-circuited behind `cuda_available`). Guards:
+`tests/unit/plugins/stt/test_wake_gpu_probe.py`,
+`tests/unit/plugins/stt/test_wake_whisper_build.py`,
+`tests/unit/speech/test_rolling_whisper_wake_gpu_backstop.py`.
+Bench: `scripts/wake_bench.py --device cuda`.