Files
rag-technical-docs-assistant/docs/evaluation/local-s2s/phase-01-linux-preparation.md
11linear11 a94b8cd3ea 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.
2026-10-16 17:09:27 -04:00

14 KiB

Phase 1 isolated Linux preparation — 2026-10-15

Status: Phase 1 accepted on the isolated Linux candidate, following the final user-run listening test and matching native diagnostics below. Phase 2 remains in_progress / not accepted. No local engine built or enabled. Earlier pending statements below are historical preparation checkpoints, superseded by the final acceptance record.

Current configuration: response cap restored to the established 2048 after user feedback. The 256-token values below describe the initial test only. No additional paid session was opened after restoration. The artificial three-intent override has also now been removed; baseline capacity is 256 intents. This restores runtime tuning, not permission for 256 paid requests. No further real test was run during this configuration correction.

The user authorized the proposed one-session OpenAI test, up to 60 seconds, three response intents and 256 output tokens per response. These are usage bounds, not an enforced monetary ceiling. Do not open extra sessions or retry paid failures under this authorization.

Isolation and current host

The Windows-era image IDs and rag-api-mini / rag-api containers are absent here. Cached Linux images were inspected and explicitly selected. Historical rollback restoration is not established by this preparation.

  • Dependency runtime: sha256:0390c6c5a4a279f22e86bbc3bf06ca9cfe1a958656dc3b0ca4f1c229db2a2763.
  • PostgreSQL: sha256:f1447071e6c8449dcf4056aa0994c81d3566ce5ee232de36b04dc25696a116dd.
  • Project rag-local-s2s-test; DB rag_local_s2s_test on candidate_db.
  • New project-only DB/original/extraction volumes; current app/migrations mounted read-only, inherited /app/data masked with tmpfs and /app/.env with /dev/null.
  • API http://127.0.0.2:8091; Angular http://127.0.0.2:4201.
  • API container 9309d1458044f3fa0a14956aa05f258dc13c186b48ec2db2e6bc85f588448a1e.
  • DB container 3281173e1fb089e2be900a19ff1f7c9b21aea552cf1ce73d03bf857c637ba73c.
  • Source base 8d348f0; no runtime source changes during this preparation.
  • Existing rag-postgres, other acceptance DB and Angular port 4200 untouched. Frontend source and its original proxy are unchanged.

Executed checks

Used docker compose with these four -f arguments, in order, from repo root:

  1. docker-compose.local-s2s-test.yml
  2. docs/evaluation/local-s2s/phase-01-openai-acceptance.override.yml
  3. docs/evaluation/local-s2s/phase-02-browser.override.yml
  4. docs/evaluation/local-s2s/phase-01-linux-acceptance.override.yml

Commands: config --quiet, then up --pull never -d candidate_db candidate_migrations candidate_api. Private config assertions verified provider, candidate DB, read-only source, loopback binding, no OpenRouter key in API and 60s/3-intent/256-token limits. OpenAI settings/key were supplied server-side without printing credentials.

The cached runtime's dependencies were inspected in a disposable read-only, network-disabled container: FastAPI 0.143.0, Pydantic 2.14.0, pydantic-settings 2.15.0, SQLAlchemy 2.0.54, psycopg 3.3.6, Alembic 1.20.0, websockets 17.2 and uvicorn 0.54.0. No app/provider connection during that check.

Migrations exited 0. An actual API DB connection returned current_database() = rag_local_s2s_test before bootstrap. Created a separate organization/admin using python -m app.bootstrap --password-stdin. Random credentials were passed privately over stdin and stored with mode 0600 in /tmp/local-s2s-test-login.txt, outside Git.

Started the existing Angular CLI without installing dependencies, from the sibling frontend checkout:

./node_modules/.bin/ng serve --host 127.0.0.2 --port 4201 --proxy-config /home/moz/Projects/raymand/projects/rag-technical-docs-assistant/docs/evaluation/local-s2s/phase-02-browser.proxy.json --no-open

Angular compiled successfully. Actual HTTP checks used trust_env=False:

Check Result
API /health/ready 200, ready / ingestion available
Angular / 200, HTML
Proxied /api/v1/auth/login 200, new test account
Proxied /api/v1/auth/me 200, correct identity
Logout with untrusted Origin 403
Logout with trusted Origin and valid CSRF 204

Exploratory /api/v1/config returned 404; this is not a verified endpoint or a product defect. Effective API settings were checked without opening a provider: OpenAI gpt-realtime-2.1 / marin, 256 tokens, 60 seconds, three intents, transport testing true. Real-provider attempts 0; no voice reservation or stream created and no speech saved. Browser control reported no available browsers. No UI, microphone or human listening acceptance is claimed.

Before handoff, enabled existing LIVE_DIAGNOSTIC_TRACE_ENABLED=1 numeric runtime traces for interruption/terminal/truncate/next-turn inspection. Recreated only candidate_api with up --pull never --no-deps -d candidate_api; readiness returned 200 again. Auth checks were performed before this diagnostic-only recreation; test account/data retained.

First browser attempt: capability configuration correction

User reported initial identity/login 401s, legacy dark-mode 404s and immediate voice-mode exit. Candidate access logs show a subsequent successful login, identity and configuration request, with no conversation/voice creation request. An authenticated configuration probe confirmed voice=false despite readiness 200. Validation-only preflight isolated missing INGEST_EMBEDDING_LIMITS as the cause (EmbeddingError); voice settings, credentials and DB profile all passed. Initial handoff had not checked voice capability, so readiness/auth checks alone were insufficient to establish that the UI could start this transport test.

Added explicit conservative byte limits only in the Linux candidate API override: 4096 bytes/input and batch, one input/batch. These describe the disabled test endpoint at loopback port 9, not supported limits of any real embedding service. No calibration bypass, runtime code, schema, old snapshot or real endpoint changed. Recreated only candidate_api, retaining the account/DB/volumes. The API container ID above reflects this correction.

Actual post-correction checks: readiness 200, proxied login 200, configuration 200 with voice=true, captions=true, voice_transport_testing=true, and calibration_status=uncalibrated; identity and valid-CSRF logout succeeded. No voice reservation, stream or provider call was made during diagnosis/checks. The failed browser start did not consume the authorized provider session. Legacy dark-mode routes remain 404; they are unrelated to the observed voice gate. Human listening and native cleanup evidence still remain pending.

Established response cap restored after the real test

One real session was observed in existing numeric traces: one cancelled terminal, two token-limited terminals, matching truncate acknowledgements at played positions 6602ms and 6581ms, and HTTP close 200 / WebSocket close. User reported audible speech and interruption but objected to the shortened responses. This is partial real evidence, not acceptance of the changed generation profile. No extra provider probe or retry was performed to inspect these logs.

The user instructed that established buffer/speed/timing settings must be preserved. Restored only OPENAI_REALTIME_MAX_OUTPUT_TOKENS from 256 to the configured 2048 in the Linux candidate override, then recreated only candidate_api. Effective settings compared before/after: model gpt-realtime-2.1, voice marin, speed 1.30, OpenAI-repair backlog 5,760,000 bytes, credit window 72,000 bytes, input transport queue 96,000 bytes / 2 seconds all unchanged. Existing test-session limits remain 60 seconds / three response intents. Readiness returned 200. No application code, buffer, speed, timeout, original reservation or operational service was changed. Additional real testing has not been executed after restoration; the earlier one-session authorization must not be silently expanded to repeated sessions.

Subsequent user-run session: response-intent test ceiling

User supplied a subsequent session's frontend failure trace after restoration. Existing candidate logs identify the exact close branch as RESPONSE_INTENT_CAPACITY, occupancy_count=3 / limit_count=3, surfaced publicly as LIVE_BUFFER_OVERFLOW. This is the explicitly configured test intent ceiling, not exhaustion of audio storage: peak backlog was 302,704 bytes versus the unchanged 5,760,000-byte limit. The third turn's generation completed successfully (terminal_completed=1, terminal_limited=0) before the capacity failure.

VoiceRuntime.create_response counts every generation intent, including a continuation after a tool result (origin=response), so three intents do not guarantee three complete spoken exchanges. Mapping the proposed small test budget to LIVE_MAX_INTENTS=3 therefore prevented this tool-using conversation from finishing. This artificial test ceiling is not evidence of an audio-buffer regression. Two prior interrupted turns have matching native truncation receipts; the session still fails normal-conversation acceptance because of the cap.

No fresh provider calls, buffer/speed/timeout changes or intent-cap expansion were performed during diagnosis. Any next test must explicitly account for tool continuations in its bounded usage; do not enlarge the audio buffers to mask this response-intent ceiling. Historical statement above that no post-restoration test had run describes that earlier checkpoint only.

Artificial intent override removed

Following the user's request to proceed, removed only LIVE_MAX_INTENTS=3 from the Linux override, restoring the actual configured/default capacity of 256. Checked the real candidate DB before recreation: one closed and one failed session, none active. Two initial read-only inspection queries used an incorrect table/column name and failed; the corrected live_sessions.status query passed. No schema or data change was used to bypass those errors.

Recreated only candidate_api and verified readiness 200 and actual effective settings: 256 intents, 2048 output tokens, speed 1.30, backlog 5,760,000 bytes, credit 72,000 bytes, transport queue 96,000 bytes / 2 seconds, session expiry 60 seconds. No buffer/speed/timeout or operational service changed. No provider request, reservation, live smoke or new listening acceptance performed. A future bounded test must count tool continuations separately from spoken exchanges.

These are preparation checks, not a fresh provider-free/PostgreSQL suite run.

Human test and remaining gate

Final Phase 1 listening and native cleanup acceptance

Date: 2026-10-15. User reported a real greeting, two interruptions, a final spoken answer and no error. Correlated candidate session: 66aae0b7-3abb-4e93-b25a-c4be0fc98c3d. No new provider probe was initiated to verify it; existing numeric diagnostics and the isolated DB row were inspected. No audio or user speech text was retained in this report.

Turn Observed terminal Native repair receipt First next-turn audio
1 cancelled at 6450ms truncate acknowledged at 7423ms, played 1045ms turn 2 at 8515ms
2 completed at 10420ms, interrupted while audio remained unplayed truncate acknowledged at 11943ms, played 1610ms turn 3 at 13009ms
3 completed at 15558ms no further interruption required normal close

Times are elapsed from backend runtime trace start, not browser elapsedMs. Both active-generation interruption and completed-but-unplayed interruption have matching native acknowledgements before subsequent output. This is OpenAI native repair evidence; it does not prove any local engine history mutation.

Session-specific diagnostics: 0 warning diagnostics, 0 limited terminals, 0 error events. Peak output backlog 342,088 bytes, below the established 5,760,000-byte capacity. Actual HTTP close returned 200; persisted status closed, close_reason user_requested, error_code null. Frozen stored profile verified: OpenAI gpt-realtime-2.1 / marin, speed 1.30, max_output_tokens 2048, backlog 5,760,000 bytes and input/output mono PCM24k. The earlier successful offline boundary/preservation coverage remains separate from this real evidence.

Verdict: Phase 1 accepted for the provider-boundary/OpenAI preservation scope. The missing real listening gate is now closed. No fresh full-suite or DB-suite pass is claimed; previously recorded baseline/timing failures remain disclosed. Historical Windows rollback images are absent here; restoration remains unproved and must not be inferred from the cached Linux dependency runtime. The complete pinned engine source, reviewed Linux dependency lock, asset compatibility, engine/SDK/POSIX conformance and Phase 2 real components/browser remain open. Build/download authorization and bounded later provider usage are independent; this successful session does not authorize unbounded calls or a provider switch.

Historical human test instructions

Open http://127.0.0.2:4201/login in a fresh browser profile, use the login file, allow the microphone, and start one voice session. Say a short Persian greeting, interrupt the answer once, ask one short follow-up, and close normally. Stay within three responses and 60 seconds. Do not reconnect after a failure. No real document content is needed; candidate embedding inference is disabled.

Observe speech, both transcripts, interruption stop, next answer and normal close. Inspect correlated native stop/truncate acknowledgement and next-turn release before accepting Phase 1; a human report alone does not prove repair. Report provider/model errors without silently changing the baseline model. Phase 2 engine/SDK/POSIX/component/browser gates and rollback remain unverified.

Stop only the owned API/DB after the test, retaining volumes:

docker stop rag-local-s2s-test-candidate_api-1 rag-local-s2s-test-candidate_db-1

Stop the port-4201 Angular process separately; retain port 4200. Do not use compose down, remove volumes or prune images.