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,83 @@
|
||||
# Isolated browser handoff — 2026-10-16
|
||||
|
||||
Superseded by [first-turn repair and renewed real handoff](phase-02-browser-first-turn-repair-20261016.md).
|
||||
The initial human test failed; use the repaired engine and carried-forward budget,
|
||||
not the old startup/ledger. URL and private test-account file remain the same.
|
||||
|
||||
The candidate is running at **http://127.0.0.2:4201/login**. Use a fresh/private
|
||||
browser window. Test-account username/password are only in the ignored private
|
||||
file `.local-s2s-build/browser-login.txt` (mode0600). No original account was reset.
|
||||
|
||||
1. Open the page and log in using that file.
|
||||
2. Start voice mode and allow microphone access.
|
||||
3. Say one short greeting, e.g. «سلام، حالت چطوره؟», then remain silent while the
|
||||
reply plays. Verify your transcript and the assistant's text/audio.
|
||||
4. End voice mode normally. Report whether the full reply played and whether
|
||||
any error appeared. This is the Phase2 normal-session acceptance, not a test
|
||||
of interruption or document retrieval.
|
||||
|
||||
The engine watchdog stops **only the candidate engine** after30minutes from its
|
||||
launch, or earlier if host MemAvailable drops below2500MiB. Sessions have the
|
||||
isolated test's60-second limit. If this handoff has expired, request continuation;
|
||||
do not restart the engine directly or delete a paid ledger. It would repeat paid
|
||||
constructor probes. Frontend and API remain independently running.
|
||||
|
||||
## Actual preparation and checks
|
||||
|
||||
- Existing sibling Angular checkout compiled successfully in19.580s and serves
|
||||
the existing separate proxy. No frontend source or original proxy was edited;
|
||||
its development-server heap is capped at1GiB. No dependencies were installed.
|
||||
- Existing isolated candidate DB/storage reused; migrations exited0. API readiness,
|
||||
frontend HTML, proxied login and identity all returned200; valid Origin/CSRF
|
||||
logout returned204. A new disposable ordinary user was provisioned through the
|
||||
existing trusted maintenance CLI; previous accounts remain intact.
|
||||
- Corrected immutable image89c7295e5219 runs API and engine. The standalone
|
||||
[Linux override](phase-02-browser-linux.override.yml) mounts no operational.env
|
||||
and supplies the OpenRouter credential only as a private engine file. Engine
|
||||
process UID/GID matches that file's owner; its0600 mode is unchanged.
|
||||
- Engine constructor made exactly three real HTTP200 probes (STT/LLM/TTS) and
|
||||
reached startup in21.303s. The [watchdog](watch-browser-engine.py) enforces a
|
||||
>5GiB pre-start gate,3GiB/no-swap engine cap, two CPUs and memory-floor stop.
|
||||
- The [actual connection check](check-browser-connection.py) used proxied login,
|
||||
created an owned conversation/voice session, connected through Angular's
|
||||
WebSocket proxy to the API and received **session_ready** from the real engine.
|
||||
Explicit close persisted **closed / user_requested**. Component admissions were
|
||||
**3 before and3 after**: no audio/inference was sent during that check.
|
||||
- [Budget regressions](check-browser-budget.py), script parse checks, Compose
|
||||
validation and `git diff --check` passed. An initial YAML flow-sequence typo in
|
||||
tmpfs options prevented container creation before any paid request; quoting the
|
||||
mount fixed it. No broad app/PostgreSQL suite was rerun for this preparation.
|
||||
|
||||
## Budget: same original $1 authorization
|
||||
|
||||
Only the three individually billed, successful older component reservations were
|
||||
released. Their actual total is$0.001118333. The first failed WAV retains$0.25;
|
||||
all six unbilled native attempts retain$0.438. Thus previous reserved-plus-billed
|
||||
exposure is **$0.689118333**, not zero and not a reset of either old ledger.
|
||||
|
||||
[The browser-only transport](browser-budget.py) validates models, voice, mono
|
||||
PCM16 input duration<=10s and LLM input/output. It persists admission before
|
||||
network I/O, counts failures, allows no retry and refuses an existing browser
|
||||
ledger on restart. New ceilings: four TTS attempts at$0.035, three STT at$0.004,
|
||||
three LLM at$0.02. Total new maximum$0.212; cumulative ceiling **$0.901118333**.
|
||||
After the three startup probes, cumulative reservation is **$0.748118333**. These
|
||||
figures are reservations, not actual invoices or the shared key's provider cap.
|
||||
|
||||
For this evaluation only, each Google TTS endpoint receives
|
||||
`provider.options[endpoint_tag].maxOutputTokens=2048`. Full prompt maxima and this
|
||||
output cap at both published routes together bound one TTS attempt at$0.032768,
|
||||
below$0.035. This does not change buffer sizes or speech speed. The isolated
|
||||
LLM's128-token cap is unchanged from the preceding native evaluation; actual
|
||||
provider-bound LLM requests use price caps/no fallback and <=16384 input JSON
|
||||
UTF8 bytes. The operational OpenAI2048-token/speed1.30/audio profile is untouched.
|
||||
|
||||
Official basis: [OpenRouter TTS provider options](https://openrouter.ai/docs/guides/overview/multimodal/tts)
|
||||
forward remaining Google options as generation config; provider routing `only`
|
||||
is explicitly unsupported for speech, so it is not used as a cost guarantee.
|
||||
[Google GenerationConfig](https://ai.google.dev/api/generate-content#v1beta.GenerationConfig)
|
||||
defines `maxOutputTokens`. Both currently listed tags are covered; price/tag drift
|
||||
fails preparation. Per-endpoint prices are captured in ignored browser evidence.
|
||||
|
||||
Phase2 is still **in_progress** until human browser/microphone acceptance and
|
||||
applicable final checks. Earlier accepted WAV listening is retained. RAG and
|
||||
advanced interruption are Phase3. No operational switch, buffer or speed change.
|
||||
Reference in New Issue
Block a user