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:
@@ -0,0 +1,91 @@
|
||||
# Bounded real native session preparation — 2026-10-16
|
||||
|
||||
Superseded continuation: [real native round trip passed](phase-02-real-native-20261016.md).
|
||||
The native paid ledger now exists; do not rerun the command below. Current cumulative
|
||||
reservation is $0.998. Memory/credential blockers below are historical.
|
||||
|
||||
Phase 2 remains **in_progress**. The user accepted pronunciation of the existing
|
||||
5.16-second Persian sample («تلفظ خوب و قابل قبول بود»). This acceptance applies
|
||||
only to that sample; the recorded کوتاه/کتاه recognition mismatch remains.
|
||||
|
||||
## Implemented
|
||||
|
||||
The existing [native session harness](image-session-smoke.py) now has an explicit
|
||||
`real` mode. It uses the actual native pipeline, assets, adapter setup attestation,
|
||||
input transcription, manual response, correlated audio/transcript terminal and
|
||||
normal session release. Input is the already approved generated sample, checked
|
||||
against its previous SHA-256; the earlier prerecorded reference voice is not sent
|
||||
to real providers. A response-specific greeting instruction keeps this a transport
|
||||
evaluation, not production policy or RAG acceptance. Output, if successful, is
|
||||
saved as ignored `.local-s2s-build/native-paid/native-real-output.wav`.
|
||||
|
||||
[The evaluation-only transport](native-budget-transport.py) reserves before every
|
||||
provider request, including initialization warmups. It validates model, voice,
|
||||
format, request body size and STT duration, forces bounded LLM tokens and provider
|
||||
prices, and uses no client retry. The exclusive ledger cannot be overwritten by
|
||||
running again. The source is mounted only into this evaluation; operational engine
|
||||
code, configuration, frontend, audio speed and buffer limits are unchanged.
|
||||
|
||||
Fresh public endpoint metadata was retrieved directly from OpenRouter before
|
||||
preparation. Each new TTS attempt reserves $0.205, exceeding the full token maxima
|
||||
at both published routes combined ($0.2048). Each STT attempt reserves $0.004,
|
||||
exceeding a full minute across all three listed routes while allowing at most ten
|
||||
seconds of mono PCM16 input. Each LLM attempt reserves $0.01, bounding its input,
|
||||
128 output tokens, route price and fallback policy. At most **two attempts per
|
||||
component** cover one construction probe and one turn. Extra sentences, extra
|
||||
transcription work or any SDK repeat are denied before another paid request.
|
||||
|
||||
The old **$0.56 reservation is retained in full**. The maximum additional reserve
|
||||
is `2 × (0.205 + 0.004 + 0.01) = $0.438`; cumulative maximum is **$0.998** under the
|
||||
user's existing $1 authorization. These are conservative reservations, not actual
|
||||
charges or a provider-enforced account cap. The existing shared key cap remains $5.
|
||||
Do not delete either paid ledger, automatically rerun the test after admission,
|
||||
or start an unguarded Compose engine with the same credential.
|
||||
|
||||
[The owned-container runner](run-image-session-smoke.py) preserves one container,
|
||||
3 GiB memory, no swap, two CPUs, >5 GiB host MemAvailable before start, a 2500 MiB
|
||||
runtime floor and 180-second wall deadline. It now records pre-start refusal,
|
||||
propagates child failure and cleans up its owned container on interruption.
|
||||
Credential access uses the file owner's UID/GID while preserving mode 0600.
|
||||
No database, unrelated container or operational application is stopped or changed.
|
||||
|
||||
## Actual validation and remaining gate
|
||||
|
||||
- Provider-free [budget regression checks](check-native-budget.py) passed normally
|
||||
and with optimized Python: failed-attempt reservation retention, admission count,
|
||||
cumulative overflow, exclusive ledger, input/model limits and LLM price routing.
|
||||
Budget rejection uses explicit conditions, independent of Python assertions.
|
||||
- Provider-free [runner checks](check-native-runner.py) passed: insufficient memory
|
||||
prevents container launch, low headroom stops the owned container and nonzero
|
||||
child status cannot be reported as success.
|
||||
- Extended native harness **normal fixture** mode passed in the actual corrected
|
||||
image in **27.011 s**, minimum available host memory **5,147,222,016 bytes**.
|
||||
This is fixture evidence, not real-provider session acceptance.
|
||||
- The first `real` invocation failed on the private credential's filesystem access
|
||||
before gateway construction or any paid request. Its logs were archived. The
|
||||
UID/GID correction preserves private permissions; it has not yet passed a real
|
||||
run. An intervening approval-service usage-limit failure did not execute a run.
|
||||
- On resumption there was no owned evaluation container and no native paid ledger.
|
||||
The next launch was refused before Docker startup: MemAvailable was about
|
||||
**4871 MiB**, below the unchanged **5120 MiB** pre-start requirement. No new paid
|
||||
request was made. Final TTS billing remains unresolved; a read-only follow-up
|
||||
confirmed the earlier LLM charge ($0.00003), while speech generation lookups
|
||||
still returned 404. The key's usage delta alone does not finalize speech billing.
|
||||
|
||||
Once host headroom is restored, continue from the repository root using:
|
||||
|
||||
```sh
|
||||
.venv/bin/python docs/evaluation/local-s2s/run-image-session-smoke.py real
|
||||
```
|
||||
|
||||
This command intentionally refuses an existing native paid ledger. Reconcile any
|
||||
admitted attempts before a subsequent run; do not remove the ledger to bypass it.
|
||||
The generated output then needs listening, followed by separately bounded isolated
|
||||
browser/microphone acceptance. This preparation does not start the browser/API
|
||||
stack, switch providers or accept Phase 2. If the full reserve is consumed, browser
|
||||
requests need reconciled released reservations or renewed user authorization.
|
||||
|
||||
Final headroom recheck: **5,155,991,552 bytes** (about 4917 MiB), still below
|
||||
5 GiB. The runner recorded `insufficient_host_headroom_before_start` and exited
|
||||
nonzero without launching Docker. Budget, runner, links, fingerprints and secret
|
||||
scan passed; `git diff --check` passed. No native paid ledger was created.
|
||||
Reference in New Issue
Block a user