feat(voice): implement local S2S retained history and provider selection

Add pinned CPU engine dependencies, retained interrupted-response history, provider admission, offline evaluation and isolated browser tooling.

Record Phase 2 acceptance and Phase 3/4 preparation, bounded paid-test accounting and interruption incident findings. Human interruption acceptance, paired OpenAI evaluation and rollback remain pending.
This commit is contained in:
11linear11
2026-10-16 17:09:27 -04:00
parent 8d348f0ba1
commit a94b8cd3ea
111 changed files with 14764 additions and 58 deletions
+114 -3
View File
@@ -1,11 +1,122 @@
# Phase 2 local engine (development only)
This stack is isolated from operational OpenAI. Phase 1 live acceptance is still
pending. Do not activate this candidate until that prerequisite is accepted and
a bounded live run is authorized. Offline tests do not prove real Persian voice.
Current preparation (2026-10-16): [Phase 4 frontend/provider selection and paired evaluation tooling](../../docs/evaluation/local-s2s/phase-04.md).
Phase 3 retains interrupted answers as explicitly unheard drafts per the user's
revised policy; real barge-in/RAG/factual acceptance remains pending. Phase 4 is
prepared for isolated testing, not deployed or accepted. No new paid request,
audio tuning or operational switch. Earlier checkpoints below are historical.
Current verdict (2026-10-16): **Phase 2 accepted for isolated development-only
normal Persian browser voice**. [Final evidence](../../docs/evaluation/local-s2s/phase-02-accepted-20261016.md)
and [machine-readable results](../../docs/evaluation/local-s2s/phase-02-accepted-20261016.json):
125 local + 258 preservation + 63 PostgreSQL tests passed; actual browser response
fully played and closed normally. Conservative cost exposure $0.420504399, below
the same $1 cap; final invoice details remain unresolved with full reserves held.
Paid engine stopped normally. No buffer/speed change or operational promotion.
Phase 3/4 remain not_started. Earlier checkpoints below are historical and are
superseded where they describe open Phase 2 gates.
Current incident follow-up: [first browser-turn initialization stall repaired](../../docs/evaluation/local-s2s/phase-02-browser-first-turn-repair-20261016.md).
User session failed after transcription. Native snapshots identified first-reply
Lingua model preload; same cache now warms before listener readiness. Three full
proxy/API/native continuous-input fixture sessions and98 focused tests pass.
Fixed image a51167d1952a; no buffer/speed/timeout change. Repair handoff carries all
prior attempts; cumulative reservation ceiling $0.995118333 of the same$1. Human
browser acceptance remains open; earlier ready checkpoints below are historical.
Current browser handoff (2026-10-16): [isolated browser is ready](../../docs/evaluation/local-s2s/phase-02-browser-ready-20261016.md).
Angular/API/login and actual proxied WebSocket session_ready/normal close passed;
no inference in connection check. Three real startup probes passed. Human microphone/
reply/transcript acceptance remains open. Same $1 authorization; reconciled prior
exposure $0.689118333, cumulative ceiling $0.901118333, startup reserve $0.748118333.
Private login file and 30-minute engine watchdog documented. No tuning/operational change.
Latest actual run (2026-10-16): [real native Persian round trip passed](../../docs/evaluation/local-s2s/phase-02-real-native-20261016.md).
Six actual requests succeeded, 2.528s reply audio, successful terminal/normal
release and clean shutdown. Cumulative reservation is $0.998 of the same $1;
final billing remains unresolved, so no further paid request. User accepted native output; browser/microphone remains open; earlier memory blocker below is historical.
No operational switch or audio tuning change.
Latest preparation (2026-10-16): [bounded real native session](../../docs/evaluation/local-s2s/phase-02-native-paid-preparation-20261016.md).
Single-sample pronunciation accepted by the user. Cumulative reservation ceiling
is $0.998 including the retained $0.56; no new paid request. Real launch awaits
>5GiB host headroom. Budget/runner checks and actual native fixture pass; browser
and real session acceptance remain open. Audio tuning and operations unchanged.
This stack is isolated from operational OpenAI. Phase 1 live acceptance passed
on the isolated Linux candidate; see the current evidence below. Local engine
conformance/assets and bounded live authorization remain separate activation gates.
Offline tests do not prove real local_s2s Persian voice.
## Offline result now
Real component follow-up **2026-10-16**: [authorized $1 component evidence](../../docs/evaluation/local-s2s/phase-02-real-components-20261016.md).
Actual PCM TTS/Kore, Whisper STT and GPT-4.1 mini succeeded after an initial WAV
HTTP400. Generated Persian audio is 5.16s; human listening is pending. Four attempts,
$0.56 retained reservation; STT+LLM reported about $0.00033833, TTS/final billing not
yet verified. Do not bypass the exclusive paid ledger to rerun. Real browser/native
integration remains open; no engine startup, tuning or operational change occurred.
Native session **2026-10-16**: [actual session/audio/signals and memory incident](../../docs/evaluation/local-s2s/phase-02-native-session-20261016.md).
Candidate `phase2-session-fix-v2`, immutable ID
`sha256:89c7295e521903c16b8ab72f8049b8166ceeb718ac7d531b815dd5d7613dea7b`,
passed normal native PCM/transcript/intent/close, setup mismatch, OS-signal and
fixture-provider failure checks. 110 focused tests pass. Gateway/client shutdown
now precedes dependent waits. Run the report's guarded sequential runner; earlier
parallel 4GiB tests coincided with an actual IDE OOM kill. Audio limits/tuning and
existing deadlines are unchanged. Cold/one-core failures remain disclosed; real
component/Persian browser acceptance remains pending. No paid calls or downloads.
Queue repair **2026-10-16**: [corrected candidate evidence](../../docs/evaluation/local-s2s/phase-02-queue-repair-20261016.md).
The type-compatible subclass resolves Queue[Any] construction without changing
the 256-item bound or overflow stop. Separate image `phase2-queue-fix`, ID
`sha256:6ad4a6a418ef3122923724760b9b2fa8e55cd7db10189614492f5e2b1dc23a74`,
passed actual asset-backed construction, three fixture warmups, typed queue/FIFO/
overflow and cleanup checks. 109 targeted tests passed. The original image/tag
and Compose defaults are preserved; native-session/audio/POSIX gates remain open.
Authorized asset acquisition **2026-10-16**: [actual evidence and constructor failure](../../docs/evaluation/local-s2s/phase-02-linux-assets-20261016.md).
The required resources now exist under `.local-s2s-build/assets-linux/`; the
14-file Linux manifest is `docs/evaluation/local-s2s/phase-02-linux-assets.json`,
SHA-256 `869eb6be1f444ecded8908b9339078cc5845df367207a63ed28173c4974dca26`.
Actual NLTK POS and Silero JIT/silence checks pass in the image. Full construction
fails because the Queue lambda cannot serve upstream Queue[Any] annotations.
No runtime fix applied during downloading; resolve this before real startup.
Follow-up **2026-10-16**: [asset inventory and Linux signal subset](../../docs/evaluation/local-s2s/phase-02-offline-preflight-20261016.md).
Four actual SIGINT/SIGTERM checks passed against lifecycle/gateway with fixture
runtime/provider I/O. Existing punkt data loaded inside the image; NLTK POS tagger
and Silero source/JIT resources are still missing. This does not close full-engine
or native-worker signal acceptance. The report includes the repeatable offline
command; no runtime edits, downloads or paid calls occurred.
Latest **2026-10-16** result: image `rag-local-s2s-candidate:phase2` built
successfully, ID `sha256:5c80c77c54da4641318e69cdb8fff092391cd746e491fa8029280c2999ce27d1`.
15 native imports, six actual-handler/SDK controlled-I/O scenarios, two startup
guards and 423 provider-free regression checks passed. See
`docs/evaluation/local-s2s/phase-02-image-build-20261016.md` for exact evidence and
limitations, including the unused CUDA-tagged upstream TTS wheel. Earlier missing
build/native-import statements below are historical. Do not start paid engine
initialization as a health check; real NLTK/VAD resources and full-engine tests
remain prerequisites. No operational provider or voice tuning changed.
Latest Linux preparation: Phase 1 OpenAI preservation acceptance is recorded in
`docs/evaluation/local-s2s/phase-01-linux-preparation.md`. A full **134-package**
Python 3.11/Linux CPU hash lock and wheel-only dry run are now available; see
`docs/evaluation/local-s2s/phase-02-dependency-lock.md` and the adjacent
`requirements-linux-cpu.in`, `cpu-constraints.txt`, `requirements-linux-cpu.lock`.
This supersedes the older missing-lock/base/source statements below. Engine
build/import/conformance/live acceptance remain open. Use the report's verified
trixie amd64 base digest, not the earlier Windows digest. The CPU constraints pin
two exact official wheel URLs; other packages resolve only from PyPI.
For a fresh build workspace, run the existing preparation helper with the report's
base digest; compare its generated `requirements.in` with
`requirements-linux-cpu.in`, then copy the reviewed `requirements-linux-cpu.lock`
to `.local-s2s-build/requirements.lock`. Preserve an existing prepared workspace;
do not overwrite it or re-resolve silently during a build. Actual image build and
provider startup are not authorized by dependency resolution alone.
From the repository root:
```powershell