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:
@@ -1,5 +1,185 @@
|
||||
# Development notes
|
||||
|
||||
## 2026-10-16 — User-authorized Phase 4 preparation and frontend provider choice
|
||||
|
||||
- Prepare Phase 4 while Phase 3 live/factual gates remain pending. The frontend
|
||||
selects an allowed provider per new session; server-owned credentials, models,
|
||||
tuning and canonical retrieval remain unchanged. No automatic fallback.
|
||||
- Add optional V01/F01 provider, authenticated configuration-only provider metadata,
|
||||
explicit-provider replay/race conflict and row-pinned stream settings. Preserve
|
||||
old default-only clients and profiles; no schema migration.
|
||||
- Close and verify terminal state before changing UI selection. Unknown closure
|
||||
keeps the previous provider and ids. Start a fresh session on the next click.
|
||||
- Add an offline paired latency/cost scorecard, unmeasured template, fault matrix,
|
||||
isolated image/override and operational restoration runbook. No new paid call,
|
||||
provider switch, dependency or audio buffer/speed change.
|
||||
- See [Phase 4 evidence](evaluation/local-s2s/phase-04.md) for tests and remaining
|
||||
real gates. No quality/savings/rollback acceptance is inferred from fixtures.
|
||||
|
||||
## 2026-10-16 — Phase 2 isolated normal browser voice accepted
|
||||
|
||||
- Required real component/native/Persian browser/normal-close evidence is complete.
|
||||
Finish provider-free acceptance: 125 local, 258 OpenAI preservation and 63 real
|
||||
isolated PostgreSQL tests pass. See [final evidence](evaluation/local-s2s/phase-02-accepted-20261016.md).
|
||||
- Correct two stale test assumptions to the existing contract: source citations
|
||||
require report_used_sources, and adjacent unsent transcript deltas may coalesce.
|
||||
Preserve database/text/replay assertions; do not alter runtime or deadlines.
|
||||
- Add phase-02-final-postgres.py: new test-owned resource-limited tmpfs PostgreSQL
|
||||
container, default durability settings, no persistent mounts/provider keys,
|
||||
explicit --require-postgres and automatic owned-container cleanup. This replaces
|
||||
slow disk-backed execution without touching candidate or operational data.
|
||||
- Read-only generation billing confirms $0.003504399; retain $0.417 for every
|
||||
unresolved attempt, giving conservative exposure $0.420504399. Keep original
|
||||
exclusive ledgers unchanged and do not restart paid inference. Delayed invoice
|
||||
details remain a disclosed accounting follow-up; bounded-cost compliance is met.
|
||||
- Stop the owned paid-engine watchdog normally; preserve candidate DB, images,
|
||||
frontend, operational OpenAI and tuned buffer/speed configuration. Phase 3/4
|
||||
remain not_started; no interruption/RAG acceptance or provider promotion.
|
||||
|
||||
## 2026-10-16 — First browser reply: native lazy language preload
|
||||
|
||||
- Actual human greeting reached transcript but provider-send stalled. Reproduce
|
||||
through the real proxy/API using fixture HTTP, preserving paid ledgers.
|
||||
- Native thread dumps locate lazy all-language Lingua preload at the first spoken
|
||||
reply. Prime the same cache during engine construction, before listener startup;
|
||||
preserve all detection behavior, buffers, speed, PCM and existing deadlines.
|
||||
- Three full-path continuous-input fixture sessions and98 focused tests pass.
|
||||
Native backend-selection experiment did not fix the issue and was discarded.
|
||||
- Build separate COPY-only image a51167d1952a. Repair ledger retains previous
|
||||
$0.807118333 and enforces cumulative$0.995118333; no retries/old-ledger reset.
|
||||
Human browser acceptance remains open. See [evidence](evaluation/local-s2s/phase-02-browser-first-turn-repair-20261016.md).
|
||||
|
||||
## 2026-10-16 — Browser candidate running with bounded handoff
|
||||
|
||||
- Start existing isolated DB/migrations/API with corrected immutable image and
|
||||
Angular with the separate proxy. New disposable user; private local credentials.
|
||||
- Add evaluation-only browser transport, Compose override and engine watchdog.
|
||||
Reconcile only three billed older calls; retain failed and unbilled reservations.
|
||||
Cumulative ceiling $0.901118333 under the original $1; no key-cap change.
|
||||
- Apply documented Google maxOutputTokens2048 in both endpoint options only to
|
||||
this evaluation, not operational speech speed/buffers. LLM remains128 test tokens.
|
||||
- Three real probes passed; actual cookie/Origin/CSRF API and proxied native
|
||||
session_ready/closed user_requested passed with no inference. Human mic test
|
||||
remains pending. Watchdog limits engine memory and stops it after30minutes.
|
||||
- Budget regression/Compose/parse/diff checks pass. No frontend source or public
|
||||
API contract change. See [handoff](evaluation/local-s2s/phase-02-browser-ready-20261016.md).
|
||||
|
||||
## 2026-10-16 — Native output listening accepted; earlier billing reconciled
|
||||
|
||||
- Record user acceptance of the 2.528s native reply. Browser/API/microphone
|
||||
acceptance and applicable failed DB checks remain open; no Phase2 acceptance.
|
||||
- Read-only billing now confirms the earlier three successful standalone calls:
|
||||
$0.00078 TTS + $0.000308333 STT + $0.00003 LLM = $0.001118333. Exclude
|
||||
the first failed WAV attempt and distinguish these from the newer native turn.
|
||||
- New native generation records still return404. No inference or operational
|
||||
changes; reservation accounting is not actual cost. See updated real-native
|
||||
and real-components evidence.
|
||||
|
||||
## 2026-10-16 — Real native round trip passes within original $1 authorization
|
||||
|
||||
- Host memory recovered without lowering any guard; one owned container completed
|
||||
actual STT/LLM/TTS probes and a native audio turn, successful terminal, correlation,
|
||||
slot release and clean shutdown. Six real HTTP200 requests, 130.096s total.
|
||||
- Save the 2.528s Persian reply for human listening. Recognized input retains the
|
||||
earlier کتاه/کوتاه mismatch; browser/microphone and broad quality are not proved.
|
||||
- Preserve both paid ledgers: cumulative reserve $0.998, not actual cost. Immediate
|
||||
billing lookups remain404; no further paid request or automatic startup.
|
||||
- No operational configuration, audio tuning, frontend or database changed.
|
||||
See [actual evidence](evaluation/local-s2s/phase-02-real-native-20261016.md).
|
||||
|
||||
## 2026-10-16 — Bounded real native session preparation
|
||||
|
||||
- Record user acceptance of pronunciation for the single generated Persian sample.
|
||||
- Extend the existing native harness with a real-provider mode and an evaluation-only
|
||||
persistent admission guard. Retain the prior $0.56; two attempts per component
|
||||
reserve at most $0.438 more, for a $0.998 cumulative ceiling under the same $1.
|
||||
- Keep private credential mode0600; run its test container as its owner. Harden
|
||||
the existing runner to report pre-start refusal, propagate failure and stop its
|
||||
owned container on interruption. No dependency, operational or tuning change.
|
||||
- Budget and runner regressions pass; actual native fixture passes in27.011s.
|
||||
Real execution remains unaccepted: initial credential preflight failed before
|
||||
admission, then host memory was below the unchanged5GiB startup requirement.
|
||||
See [evidence](evaluation/local-s2s/phase-02-native-paid-preparation-20261016.md).
|
||||
|
||||
## 2026-10-16 — Authorized real Persian component evaluation, $1 total limit
|
||||
|
||||
- Add a standalone exclusive-ledger runner for fixed real TTS/STT/LLM requests,
|
||||
conservative pre-admission reservations, no automatic retries and bounded data.
|
||||
Keep the supplied credential ignored and private; existing key cap/settings stay.
|
||||
- One WAV HTTP400 stopped the first sequence; explicitly announced PCM correction
|
||||
then produced 5.16s of real Persian audio, a Whisper transcript and GPT-4.1 mini
|
||||
reply. Four attempts retain $0.56 of the authorized $1 budget. Reported STT+LLM
|
||||
cost is $0.000338333333333; TTS/final billing remains unverified, not free.
|
||||
- Record کتاه/کوتاه transcript difference and pending human listening. No broad
|
||||
quality/RAG/browser acceptance, heavy engine startup, audio tuning or operational
|
||||
change. Files: evaluation runner/evidence and current index/ledger/README.
|
||||
See [actual results](evaluation/local-s2s/phase-02-real-components-20261016.md).
|
||||
|
||||
## 2026-10-16 — Native local S2S session conformance and memory-safe continuation
|
||||
|
||||
- Add an actual native WebSocket/session/audio runner using real assets/handlers/
|
||||
SDK and fixture-only upstream HTTP. Normal audio/close, setup mismatch and intent
|
||||
correlation, SIGINT/SIGTERM during provider work and failed-provider terminal
|
||||
checks passed. No real provider quality/listening claim. 110 focused tests pass.
|
||||
- Repair shutdown order: cancel gateway/provider I/O before joining workers;
|
||||
cancel accepted writers/tasks before Server.wait_closed (also fixes Python 3.13
|
||||
client-wait semantics). Existing deadlines, queue capacity and voice tuning stay.
|
||||
- Prior concurrent native runs coincided with systemd-oomd killing VS Code due to
|
||||
memory pressure. Continue sequentially with a 3GiB/no-swap limit, two CPU cap,
|
||||
host headroom checks and automatic owned-container stop. Record cold-start and
|
||||
one-core timeout failures; do not change product timeouts to excuse them.
|
||||
- Files: local lifecycle/components, one regression, native evaluation/guarded
|
||||
runner and evidence/index/progress docs. Separate image 89c7295e5219 preserves
|
||||
older candidates and operational selection. No downloads or paid calls.
|
||||
See [actual evidence](evaluation/local-s2s/phase-02-native-session-20261016.md).
|
||||
|
||||
## 2026-10-16 — Preserve Queue type compatibility during engine construction
|
||||
|
||||
- Replace only the launcher's Queue lambda with a subclass of the existing
|
||||
FailClosedQueue bound to its owner stop event. This retains generic annotations
|
||||
while preserving 256 slots, FIFO and fail-closed overflow. No audio or contract
|
||||
changes; existing v3 behavior/profile identity remains compatible.
|
||||
- Enhance the real-image construction regression to verify typed queue creation,
|
||||
capacity, overflow/stop and draining. 109 focused tests pass. The corrected
|
||||
image constructs all real handlers with local assets and exactly three fixture
|
||||
warmups, then cleans up successfully. Native server/sessions remain untested.
|
||||
- Files: `services/local_s2s/engine.py`, construction evaluation script, repair
|
||||
evidence and current index/ledger/README. A separate offline image layer keeps
|
||||
the original image intact. No downloads, paid calls or operational changes.
|
||||
See [actual evidence](evaluation/local-s2s/phase-02-queue-repair-20261016.md).
|
||||
|
||||
## 2026-10-16 — Authorized NLTK/Silero resource acquisition
|
||||
|
||||
- Download the previously missing tagger and minimal Silero JIT hub bundle from
|
||||
fixed official revisions, under explicit user authorization. All 14 retained
|
||||
resource hashes match prior evidence. Preserve resources in ignored build
|
||||
storage and record the Linux subset manifest and acquisition provenance.
|
||||
- Actual immutable-image NLTK sentence/POS loading and Silero JIT inference on
|
||||
8/16 kHz silence pass with no networking. Complete engine construction then
|
||||
exposes Queue[Any] versus launcher-lambda incompatibility. Report the defect;
|
||||
no runtime fix, capacity/speed change, paid call or operational action here.
|
||||
- Files: asset manifest, evaluation scripts/report/JSON, local README, reference
|
||||
map and progress ledger. Next repair must preserve queue capacity and stop
|
||||
behavior while retaining type compatibility. See
|
||||
[evidence](evaluation/local-s2s/phase-02-linux-assets-20261016.md).
|
||||
|
||||
## 2026-10-16 — Local S2S resource inventory and Linux signal subset
|
||||
|
||||
- Retain the built image and application runtime unchanged. Reuse four existing
|
||||
local punkt files whose hashes match the earlier asset manifest; stage copies
|
||||
only under ignored build inputs. Image NLTK sentence loading passed, while full
|
||||
preflight correctly rejects the absent POS tagger. Required Silero source/JIT
|
||||
files were not found; the cached ONNX model is not substituted.
|
||||
- Add a standalone evaluation script using existing lifecycle/gateway code,
|
||||
fixture runtime/provider I/O, real local HTTP and OS SIGINT/SIGTERM. All four
|
||||
cases passed, including runtime-stop failure. This demonstrates the isolated
|
||||
lifecycle subset, not complete engine/native-worker shutdown or Persian audio.
|
||||
- Files: evaluation script/report/JSON, progress ledger, reference map and local
|
||||
service README. No new dependency, image rebuild, runtime edit, voice tuning,
|
||||
database access, paid call or download. Next requires transfer or authorized
|
||||
acquisition of missing real resources. See
|
||||
[actual evidence](evaluation/local-s2s/phase-02-offline-preflight-20261016.md).
|
||||
|
||||
## 2026-10-12 — Live repair diagnostics and bounded Gemini cleanup
|
||||
|
||||
- Extend the existing numeric diagnostics with opt-in audio/cancellation timing;
|
||||
@@ -157,6 +337,85 @@
|
||||
Unrelated .aws must not be staged. This checkpoint changes documentation only.
|
||||
|
||||
|
||||
## Local S2S image retry and native checks — 2026-10-16
|
||||
|
||||
After the user freed disk, retried the exact reviewed source/base/lock with no
|
||||
runtime or recipe changes. Image `rag-local-s2s-candidate:phase2`, ID
|
||||
`sha256:5c80c77c54da4641318e69cdb8fff092391cd746e491fa8029280c2999ce27d1`,
|
||||
built successfully (775.34s; size 2,349,831,100 bytes). Native package check, 15
|
||||
imports, six real-handler/SDK controlled-I/O cases and two startup refusal guards
|
||||
passed under network-disabled read-only containers. Existing focused regressions:
|
||||
423 passed in 69.65s, zero skips. No paid calls, voice tuning, service restart or
|
||||
DB acceptance. Real local assets/full engine/POSIX/provider-browser gates remain.
|
||||
Full upstream includes unused CUDA-tagged qwentts wheel; CPU torch/audio alone
|
||||
do not certify that all installed binaries are CPU-only. Evidence and smoke source
|
||||
in `docs/evaluation/local-s2s/phase-02-image-build-20261016.*` / `image-sdk-smoke.py`.
|
||||
|
||||
## Historical Local S2S preparation notes — 2026-10-15
|
||||
|
||||
Phase 2 actual image-build attempt: user authorized the reviewed build. Added
|
||||
binary-only dependency installation and excluded resolver cache/scratch artifacts
|
||||
from Docker context (actual 6.64 MB). Moved only task-owned resolver cache to tmpfs
|
||||
to preserve it and free about 780 MiB. A 384 MiB root-disk guard cancelled the
|
||||
build during package installation; exit 130, no final image. Root returned to
|
||||
about 1.8 GiB free; existing services remained running. No unrelated deletion,
|
||||
pruning, model download, provider call or voice tuning. Evidence and retry-space
|
||||
prerequisite in `docs/evaluation/local-s2s/phase-02-image-build.*`.
|
||||
|
||||
Phase 2 dependency follow-up: generated full Python 3.11/Linux manylinux_2_40
|
||||
134-package hash lock and matching CPU torch/torchaudio 2.11.0 exact wheel
|
||||
constraints, preserving upstream dependencies. Verified trixie amd64 base manifest;
|
||||
wheel-only installation dry run passed. Kept PyPI as sole general index to avoid
|
||||
CPU-index shadowing. Tracked lock/inputs, license/size metadata and exact commands
|
||||
in `services/local_s2s/` and `docs/evaluation/local-s2s/phase-02-dependency-lock.*`.
|
||||
Resolver cached metadata/wheel artifacts (including CPU torch); no library
|
||||
installation, source build, model download, provider call or voice/service changes.
|
||||
Native engine/image/asset acceptance remains pending.
|
||||
|
||||
Phase 2 source-only follow-up: fetched the user-authorized full pinned upstream
|
||||
commit into ignored `tmp/local-s2s-upstream-619e3fe4`; clean detached checkout,
|
||||
all 17 audited SHA-256/blob fingerprints match, Git fsck passed. Evidence:
|
||||
`docs/evaluation/local-s2s/phase-02-source-checkout.json`. Existing checkouts and
|
||||
services preserved. No execution/install/build/model download or provider call.
|
||||
Reviewed Linux dependency lock is the next gate; Phase 2 remains in progress.
|
||||
|
||||
Final acceptance: user reports successful Persian speech, two interruptions and
|
||||
no error. Correlated native diagnostics cover active and completed-unplayed
|
||||
generation repair; both matching acknowledgements precede the next turn's audio.
|
||||
Isolated persisted session is closed/user_requested with no error. Stored speed
|
||||
1.30, 2048-token cap, PCM24k and 5,760,000-byte backlog verified. Phase 1 accepted
|
||||
for provider-boundary/OpenAI preservation; plan/ledger/report/reference map updated.
|
||||
No new call or runtime tuning. Phase 2 build/live checks and rollback stay open.
|
||||
|
||||
Removed the artificial candidate `LIVE_MAX_INTENTS=3` override after tracing a
|
||||
user-run close to RESPONSE_INTENT_CAPACITY. Baseline capacity 256 restored;
|
||||
actual 2048-token cap, speed 1.30 and inspected buffer values unchanged. Candidate
|
||||
had no active sessions before recreation; readiness 200 afterward. No new paid
|
||||
call; restoring runtime capacity does not authorize extra paid requests.
|
||||
|
||||
User feedback after real speech: preserve established voice tuning. Restored
|
||||
candidate response cap from 256 to configured 2048 only. Verified speed 1.30,
|
||||
OpenAI-repair backlog 5,760,000 bytes, credit 72,000 bytes and queue 96,000
|
||||
bytes / 2 seconds unchanged; readiness 200. No extra paid call. Historical
|
||||
256-token preparation evidence below is superseded for current generation cap.
|
||||
|
||||
Follow-up: initial readiness/auth checks missed `capabilities.voice=false`.
|
||||
The first UI attempt stopped before reservation because the validation-only
|
||||
embedding factory requires explicit request limits. Added conservative UTF-8
|
||||
byte limits solely to the disabled candidate embedding endpoint configuration.
|
||||
Recreated only candidate API; authenticated configuration now advertises
|
||||
voice/captions=true with transport testing and uncalibrated status. No provider
|
||||
calls or runtime/schema changes; real speech acceptance remains pending.
|
||||
|
||||
Prepared a candidate-only Linux Compose override and started isolated DB/API
|
||||
plus Angular on 127.0.0.2:4201 using cached images and read-only current source.
|
||||
Historical Windows image IDs are unavailable here; selected Linux identities and
|
||||
actual checks are in `docs/evaluation/local-s2s/phase-01-linux-preparation.md`.
|
||||
Session/intent/token limits are 60s/3/256. Migration, DB identity, bootstrap,
|
||||
readiness and proxied auth/Origin/CSRF checks passed. No provider session was
|
||||
opened; listening/native repair acceptance remains pending. No runtime code,
|
||||
frontend source, applied migration or operational service was changed.
|
||||
|
||||
## Frontend commit checkpoint — 2026-10-12
|
||||
|
||||
Supersedes the earlier uncommitted-frontend status: at the user's explicit
|
||||
|
||||
Reference in New Issue
Block a user