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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
chore: auto-save WIP via Claude stop-hook safety net (2026-07-02 18:33)
Ruben Lütke80445f961958
diff --git a/AGENTS.md b/AGENTS.mdindex cb93abe054..9a0eb08929 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -148,6 +148,7 @@ Four tiers: `safe` / `monitor` / `ask` / `block`, priority **blacklist > whiteli| 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 + the 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 NVIDIA Blackwell GPU (RTX 5070 Ti / sm_120) CTranslate2 `model.transcribe` **HANGS on every inference** (8 s timeout → self-heal drops+rebuilds the model → the cold rebuild hangs again → a vicious cycle that leaves the wake **permanently DEAF**). The same hang also appears on `base`/`cpu` when ctranslate2's auto thread-pool deadlocks against PyTorch's OpenMP in the shared process. Keep the wake on `base`/`cpu` with a FIXED `cpu_threads` (bounds ctranslate2 vs torch); `[stt].wake_high_accuracy` GPU turbo is **OFF by default** and 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 (2026-06-30 live-log forensic; see `docs/local-wakeword/WAKE-RELIABILITY-DEEPDIVE.md`) || AP-26 | Put a new feature's init/import on the startup critical path (before `APP_INTERACTIVE` / `VOICE_USABLE`) — a synchronous 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 the app takes 30+ s to become usable (TTU forensic 2026-07-02: one wake change put a 114.7 s load cascade on boot). New subsystems hook into `_heavy_backend_bg`, a deferred registry scan, or a post-ready task; heavy imports stay lazy or get a `warmup_prefetch` daemon thread; routes answer a graceful 503/None while their subsystem warms. **Enforced fail-closed by the pre-push BOOT BUDGET gate** (`scripts/ci/check_boot_budget.py`: one real cold boot; window ≤ 8 s, voice-usable + app-interactive ≤ 20 s). Doctrine + how-to: `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 the phrase-matcher strictness on the confirm, or add any second content check that must contain the phrase | Kills recognition ENTIRELY, so "fires on silence" flips into "never fires". A bias-primed local Whisper (`initial_prompt=<phrase>`, needed for proper-noun recall) HALLUCINATES the phrase on silence AND GARBLES it on real speech (`'Mythos'`→`'Mütos'`/`'Hey, Mut!'`, `'Fable'`→`'Farbe'`); the unprimed base model literally cannot spell a hard custom wake — that is the whole reason the bias exists — so NO transcript-content rule separates ghost from wake without rejecting every genuine wake (live 2026-07-02: an unbiased-corroboration check made the wake "stop working at all"). The ONLY word-agnostic discriminator is raw audio ENERGY. Fix: suppress silence at the match site with the RMS gate (`RollingWhisperWake._match_min_rms`, ghost cluster ≤ 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 clearly-loud window (`_ECHO_CONFIRM_SKIP_RMS`, latency). Recall guard: `tests/unit/speech/test_rolling_whisper_wake_silence_ghost.py::test_loud_wake_fires_even_when_unbiased_pass_garbles_the_hard_word` |---@@ -163,6 +164,7 @@ Detail in [`docs/BUGS.md`](docs/BUGS.md). Recognize the signal, apply the defens6. **Watchdog stale cross-unit counter** (BUG-032): a stall watchdog reads a process-global counter never reset per unit → fires spuriously between units. Defense: reset the counter at unit start; re-arm the "not started" guard per unit.7. **Loop on an unexpected teardown error** (AP-20): a socket loop `continue`s on a non-`WebSocketDisconnect` error → spins on a dead socket. Defense: treat any read error as terminal — `break`.8. **Wedged un-cancellable native inference** (BUG-036): a shared ctranslate2/faster-whisper model called concurrently hangs unrecoverably; every later transcribe re-polls the dead engine forever. Defense: serialize with a non-blocking lock; self-heal by rebuilding a fresh model (AP-24).+9. **Hallucinating-ASR wake precision/recall trap** (AP-27, BUG-037): the `stt_match` wake transcribes with a bias prompt; the primed model INVENTS the phrase on silence and GARBLES it on speech, so **"fires on silence" and "stops working" share ONE root** and any transcript-content ghost filter that tightens the wake also rejects real wakes. Signal: a "ghost fix" lands and the wake stops triggering for a hard custom word (`Mythos`→`Mütos`), or vice-versa. Defense: gate silence on raw ENERGY (word-agnostic RMS at the match site), NEVER on transcript content; keep the confirm permissive + skip it when loud (latency); the recall guard test must stay green. Truly-instant + zero-ghost custom wake needs a neural KWS model, not transcription (AP-25).---diff --git a/CLAUDE.md b/CLAUDE.mdindex cb93abe054..9a0eb08929 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -148,6 +148,7 @@ Four tiers: `safe` / `monitor` / `ask` / `block`, priority **blacklist > whiteli| 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 + the 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 NVIDIA Blackwell GPU (RTX 5070 Ti / sm_120) CTranslate2 `model.transcribe` **HANGS on every inference** (8 s timeout → self-heal drops+rebuilds the model → the cold rebuild hangs again → a vicious cycle that leaves the wake **permanently DEAF**). The same hang also appears on `base`/`cpu` when ctranslate2's auto thread-pool deadlocks against PyTorch's OpenMP in the shared process. Keep the wake on `base`/`cpu` with a FIXED `cpu_threads` (bounds ctranslate2 vs torch); `[stt].wake_high_accuracy` GPU turbo is **OFF by default** and 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 (2026-06-30 live-log forensic; see `docs/local-wakeword/WAKE-RELIABILITY-DEEPDIVE.md`) || AP-26 | Put a new feature's init/import on the startup critical path (before `APP_INTERACTIVE` / `VOICE_USABLE`) — a synchronous 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 the app takes 30+ s to become usable (TTU forensic 2026-07-02: one wake change put a 114.7 s load cascade on boot). New subsystems hook into `_heavy_backend_bg`, a deferred registry scan, or a post-ready task; heavy imports stay lazy or get a `warmup_prefetch` daemon thread; routes answer a graceful 503/None while their subsystem warms. **Enforced fail-closed by the pre-push BOOT BUDGET gate** (`scripts/ci/check_boot_budget.py`: one real cold boot; window ≤ 8 s, voice-usable + app-interactive ≤ 20 s). Doctrine + how-to: `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 the phrase-matcher strictness on the confirm, or add any second content check that must contain the phrase | Kills recognition ENTIRELY, so "fires on silence" flips into "never fires". A bias-primed local Whisper (`initial_prompt=<phrase>`, needed for proper-noun recall) HALLUCINATES the phrase on silence AND GARBLES it on real speech (`'Mythos'`→`'Mütos'`/`'Hey, Mut!'`, `'Fable'`→`'Farbe'`); the unprimed base model literally cannot spell a hard custom wake — that is the whole reason the bias exists — so NO transcript-content rule separates ghost from wake without rejecting every genuine wake (live 2026-07-02: an unbiased-corroboration check made the wake "stop working at all"). The ONLY word-agnostic discriminator is raw audio ENERGY. Fix: suppress silence at the match site with the RMS gate (`RollingWhisperWake._match_min_rms`, ghost cluster ≤ 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 clearly-loud window (`_ECHO_CONFIRM_SKIP_RMS`, latency). Recall guard: `tests/unit/speech/test_rolling_whisper_wake_silence_ghost.py::test_loud_wake_fires_even_when_unbiased_pass_garbles_the_hard_word` |---@@ -163,6 +164,7 @@ Detail in [`docs/BUGS.md`](docs/BUGS.md). Recognize the signal, apply the defens6. **Watchdog stale cross-unit counter** (BUG-032): a stall watchdog reads a process-global counter never reset per unit → fires spuriously between units. Defense: reset the counter at unit start; re-arm the "not started" guard per unit.7. **Loop on an unexpected teardown error** (AP-20): a socket loop `continue`s on a non-`WebSocketDisconnect` error → spins on a dead socket. Defense: treat any read error as terminal — `break`.8. **Wedged un-cancellable native inference** (BUG-036): a shared ctranslate2/faster-whisper model called concurrently hangs unrecoverably; every later transcribe re-polls the dead engine forever. Defense: serialize with a non-blocking lock; self-heal by rebuilding a fresh model (AP-24).+9. **Hallucinating-ASR wake precision/recall trap** (AP-27, BUG-037): the `stt_match` wake transcribes with a bias prompt; the primed model INVENTS the phrase on silence and GARBLES it on speech, so **"fires on silence" and "stops working" share ONE root** and any transcript-content ghost filter that tightens the wake also rejects real wakes. Signal: a "ghost fix" lands and the wake stops triggering for a hard custom word (`Mythos`→`Mütos`), or vice-versa. Defense: gate silence on raw ENERGY (word-agnostic RMS at the match site), NEVER on transcript content; keep the confirm permissive + skip it when loud (latency); the recall guard test must stay green. Truly-instant + zero-ghost custom wake needs a neural KWS model, not transcription (AP-25).---diff --git a/docs/BUGS.md b/docs/BUGS.mdindex abd4bf4536..5d9251fe05 100644--- a/docs/BUGS.md+++ b/docs/BUGS.md@@ -2708,3 +2708,60 @@ wedged engine is a permanent-dead-state in disguise.** Signal: `transcribed` /timeout; a restart that does not help (the un-killable threads can even starveother thread pools, including the Restart button). Production restart after thisfix: required (a HARD kill for an already-wedged old process).++## BUG-037: Custom wake — "fires on silence" and "stops working" are ONE bug (transcript-content ghost filtering) (HIGH, 2026-07-02)++**Symptom, seen as three separate complaints across one session:**+1. Jarvis spawns with nobody speaking — even in complete silence.+2. After a "ghost fix", the wake word (`Hey Fable`, then `Hey Mythos`) stops+ triggering **entirely**, even when spoken loudly and clearly.+3. It takes ~2 s to spawn after the word is said.++**Root cause — one mechanism behind all three.** The `stt_match` wake path+(`RollingWhisperWake`) is a *transcription* detector: it runs a local Whisper+over a rolling window and matches the transcript against the phrase. To lift+recall of a hard proper-noun wake it primes the decoder with+`initial_prompt=<phrase>` (`jarvis/plugins/stt` `build_wake_whisper`). That+bias is a double-edged sword:+- **On silence / steady noise** the primed decoder HALLUCINATES the phrase+ verbatim (live log: `rms=0.0036 text='Hey Fable'`, below idle hiss) → ghost+ activation (#1).+- **On real speech** the *unprimed* base model cannot spell the word — `Mythos`+ → `Mütos` / `Hey, Mut!`, `Fable` → `Farbe`. That is exactly why the bias+ exists.++So any ghost fix that tightens **transcript content** — e.g. requiring the+bias-echo confirm's unbiased second pass to reproduce the wake word — rejects+**every** genuine wake (#2). Live 2026-07-02: an unbiased-corroboration check+suppressed 7/7 real `Hey Mythos` utterances at rms 0.03–0.09 while the user+spoke clearly. "Fires on silence" and "never fires" are the SAME root pulled in+opposite directions; no transcript-content rule separates ghost from wake.++**The only word-agnostic discriminator is raw audio ENERGY.** A genuine wake+carries a speech burst; a silence hallucination sits at the noise floor.++**Fix (AP-27).**+- Silence: a match-site RMS gate (`RollingWhisperWake._match_min_rms = 0.006`) —+ observed ghost cluster ≤ 0.0043, quiet-mic recall contract 0.009, idle hiss+ ~0.0046. Suppresses silence hallucinations word-agnostically, zero cost.+- Recognition: keep the bias-echo confirm **permissive** ("unprimed ear heard+ any real speech → genuine", fail-**open**). Never require the wake word in+ the confirm.+- Latency (#3): each 1.8 s-window transcription is ~0.54 s on base/cpu, and an+ exact-phrase candidate paid a SECOND full transcription (0.56 s) for the+ confirm. SKIP the confirm when the matched window is clearly LOUD+ (`_ECHO_CONFIRM_SKIP_RMS = 0.02`) — a real-volume window is genuine speech,+ silence is already handled by the energy gate. Poll 0.2 → 0.12. Measured:+ loud wake fires ~0.6 s vs ~1.1 s. The Sensitivity slider (a no-op on this+ path — it only fed the openWakeWord threshold) now drives the poll interval+ (`sensitivity_to_poll_interval`).++**Guards.** `tests/unit/speech/test_rolling_whisper_wake_silence_ghost.py`:+`test_loud_wake_fires_even_when_unbiased_pass_garbles_the_hard_word` (recall —+must stay green forever), the silence-suppression tests (energy gate), and the+loud-skip latency test. Signal to recognize the regression next time: a wake+"ghost fix" that makes a hard custom word stop triggering — you tightened+content; revert to the energy gate.++**Endgame.** Truly instant + zero-ghost custom wake needs a trained neural KWS+model (openWakeWord `custom_onnx`), which does not transcribe (AP-25).diff --git a/docs/local-wakeword/WAKE-RELIABILITY-DEEPDIVE.md b/docs/local-wakeword/WAKE-RELIABILITY-DEEPDIVE.mdindex 914b472cc2..4d7a0bab29 100644--- a/docs/local-wakeword/WAKE-RELIABILITY-DEEPDIVE.md+++ b/docs/local-wakeword/WAKE-RELIABILITY-DEEPDIVE.md@@ -91,3 +91,20 @@ The code is committed but the running app must **restart** to pick it up(Settings → restart, or `POST /api/settings/restart-app`). After restart, theGPU turbo model hot-swaps in a few seconds after boot; then say "Hey Nico" once.If a custom voice ever over-triggers, set `[stt].wake_high_accuracy = false`.++## The transcript-content trap (2026-07-02, BUG-037 / AP-27)++The `stt_match` wake primes Whisper with `initial_prompt=<phrase>` for recall.+Consequence: the primed model **invents** the phrase on silence (ghost) and the+unprimed model **garbles** it on speech (`Mythos`→`Mütos`, `Fable`→`Farbe`). So+any ghost fix that gates on *transcript content* — most tempting, "make the+unbiased confirm pass also say the word" — rejects every genuine wake. "Fires+on silence" and "never fires" are the same bug from opposite ends.++**Rule:** gate silence on raw audio **energy** (word-agnostic match-site RMS+gate, `RollingWhisperWake._match_min_rms`), never on transcript content. Keep+the bias-echo confirm permissive (fail-open) and skip it on a clearly-loud+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.