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
@@ -0,0 +1,100 @@
# Real native Persian round trip — 2026-10-16
**The actual native S2S round trip passed. Phase 2 remains in progress** pending
isolated backend/browser/microphone acceptance and the other open gates. This supersedes the memory-blocked checkpoint in
[preparation](phase-02-native-paid-preparation-20261016.md). The user accepted pronunciation of the separate source sample and has now
also accepted this native output on 2026-10-16.
[Machine-readable evidence](phase-02-real-native-20261016.json) records the image,
script hashes, native event counts, transcripts, budget ledger and billing checks.
The corrected candidate image is
`sha256:89c7295e521903c16b8ab72f8049b8166ceeb718ac7d531b815dd5d7613dea7b`.
No operational image, provider selection, database, frontend or audio tuning changed.
## Observed result
After an initial refusal below the unchanged 5 GiB host-headroom threshold, a
bounded one-minute wait observed sufficient memory and invoked the existing guarded
runner. The test completed with exit code **0 in 130.096 seconds**, including
imports, construction, probes and the session. Minimum observed host MemAvailable
was **5,393,440,768 bytes**. Only one container ran with 3 GiB/no-swap, two CPUs,
128 PIDs and the existing 180-second wall guard. It was removed on exit. No unrelated
service was stopped; the earlier credential-access issue is now runtime verified
fixed by matching the credential owner's UID/GID while retaining mode0600.
Actual models were Whisper large-v3, GPT-4.1 mini and Gemini3.8 Flash-Lite TTS/Kore,
all through OpenRouter. All six admitted requests returned HTTP200: three actual
constructor probes and three turn requests. The approved generated source sample
was used; no prerecorded third-party reference voice or user microphone was sent.
The response-specific test instruction requested a fixed greeting and disabled
tools. This validates transport/integration, not production policy or RAG behavior.
Actual recognized input:
> سلام، این یک آزمایش کتاه برای بررسی صدای فارسی است.
The earlier کوتاه/کتاه mismatch is still present. Actual LLM/output transcript:
> سلام صدای شما دریافت شد.
The output contains **21 native audio delta events**, **121344 PCM bytes**,
**60672 samples** and a successful `response.done` terminal. Saved WAV duration
is **2.528 seconds** at the native-declared 24 kHz mono PCM16 rate; the locally
constructed header is not an independent sample-rate measurement.
Ignored output: `.local-s2s-build/native-paid/native-real-output.wav`, SHA-256
`106d419d45eaa67e334489a2be18a78dba705da4de55914178cba46bef1f1e9e`.
Raw PCM SHA-256: `e1c422f753c4ce4c9f0d3f88d1559fc938c0e2e703ddaa7ec34e0902d99682f9`.
Setup attestation, actual model-mismatch rejection/restoration, no automatic
response before explicit create, intent/response correlation, normal session-slot
release and complete runtime stop passed. Cleanup counters were all zero; all six
gateway requests were released and no shutdown work remained. Native timing metadata
reported about15.252s end-to-end, 0.920s LLM and 1.972s TTS first audio. Input was
submitted as a synthetic clip rather than real-time browser speech, so these are
native test metadata, not measured user-perceived browser latency. Startup and
quality are not accepted solely from this one successful run.
## Cost and next step
The exclusive native ledger admitted exactly two requests per component and kept
the previous **$0.56** reservation. New reservation was **$0.438**, bringing the
cumulative reserved maximum to **$0.998**, under the existing $1 authorization.
This is a conservative reservation, **not the final bill**. No retry, model
substitution, extra utterance or subsequent paid request was performed.
Read-only billing returned HTTP200 for key metadata; shared-key usage was
$0.134551603, a $0.001118333 increase from the initial component baseline. That
shared-key delta is not independently attributed final cost. All six immediate
new generation lookups returned404. Final TTS/component charges remain unresolved;
retain the entire $0.998 reservation. Neither the paid ledgers nor the existing
shared key's $5 cap was reset or changed. The runner refuses another real execution
because its native ledger now exists.
Next: reconcile charges before any additional paid work, then complete isolated
backend/browser/microphone acceptance with a bounded budget. Human listening of
the native reply has passed. The current reservation leaves insufficient room for another full
engine startup. Do not launch ordinary candidate Compose with the key or remove a
ledger to bypass this condition. Phase 3/4 are not accepted or started here.
Validation: actual native run passed; existing provider-free budget/runner checks
passed. No broad application/PostgreSQL suite was rerun for this evaluation-only
change. Earlier baseline database and rollback gates remain disclosed.
## User acceptance and later billing follow-up
The user accepted the native reply («تاییدش میکنم») on2026-10-16. Read-only
reconciliation now returns the earlier standalone TTS $0.00078, STT $0.000308333
and LLM $0.00003, summing to **$0.001118333 for those three successful calls**.
This matches the observed shared-key usage delta but is not the bill for the newer
native turn. The initial failed WAV attempt is not included in this successful-call
sum. All six native generation records still return404; their costs and the price
of the new input→output turn remain unconfirmed. Keep reservation bookkeeping
separate from actual charges. No paid request was made during this follow-up.
The main Phase2 gate now is a normal isolated browser/API/microphone session with
transcripts, audible reply and normal close, plus completion/reconciliation of
applicable configuration/security and PostgreSQL acceptance checks. The documented
existing expanded-DB failures remain unresolved. Advanced interruption/RAG belongs
to Phase3; broad quality benchmarking and operational switch/rollback to Phase4.
No percentage or fixed completion-time claim is inferred from offline test counts.