Extract the provider boundary while retaining OpenAI/Gemini contracts. Add an opt-in isolated Local S2S adapter, pinned engine extension, bounded component gateway and frozen effective configuration profiles. Enforce request token limits, zero retries, local asset validation, connection deadlines, disconnect ownership, bounded cleanup and signals. Include regression coverage, pinned source fixtures, operator guidance, asset fingerprints and guarded disposable PostgreSQL acceptance tooling. Preserve immutable fixture bytes across Git line-ending conversion. Validation recorded in the reports: - 74 repair, 107 combined and 242 preservation checks passed. - Fresh PostgreSQL local checks: 2 passed. - Expanded PostgreSQL: 57 passed, 6 documented baseline failures. - Compose configurations, staged whitespace and fixture hashes passed. Phase 1 live listening and Phase 2 complete engine/SDK/POSIX, real component audio and Persian browser acceptance remain pending. No operational switch, paid call, model download or Phase 3 implementation is included.
18 KiB
Local S2S Phase 2 acceptance checklist
Checkpoint: 2026-10-15, source HEAD 872e5f25cbe2870d3fc3c66c8a4ab9c697d3d894
plus the preserved working tree. Engine pin 619e3fe4f71d1c6f35c15870d588a3638de34722,
patch rag-local-s2s-phase2-v3, private shape v1. Not accepted.
Commands below run from the backend repository root unless stated. Examples under
conditional sections are NOT execution records or authorization. Do not run a
later gate when an earlier mandatory gate is open.
Authorization and current evidence
| Gate | Actual state | Required next prerequisite |
|---|---|---|
| Offline preparation / isolated DB checks | Authorized by this task; executed below | Preserve unrelated files and operational identities |
| Phase 1 changed-source OpenAI listening | Not run; server configuration has a key, but no bounded live consent/fixture | Explicit bounded OpenAI run and consenting speaker/listener |
| Immutable base | Cached Linux amd64 Python digest inspected | Keep exact digest; no mutable base substitution |
| Pinned source | Full pin absent locally; sibling checkout is 30af00916da85efb053b539a040fd71cf392e7e2 and dirty |
Authorized source transfer or supplied clean offline checkout of exact pin |
| Assets | 201 existing files fingerprinted; NLTK 3.10.3 sentence/POS load passed with downloads blocked in sibling Windows venv | Review bundle and validate again in actual Linux engine; no new model download |
| Linux lock / image | Neither exists | Source, reviewed Linux CPU dependency hash lock, explicit dependency/build authorization; Phase 1 acceptance before Phase 2 build |
| Complete engine/SDK controlled I/O / POSIX | Not run; complete engine conformance harness remains to be completed against the full pinned checkout | Actual pinned source and locked Linux SDK/engine environment; no external network |
| Paid OpenRouter components | No approval, key or consented fixture supplied for this run | Engine offline conformance first, then bounded approval and approved speech/key |
| Existing browser | Located sibling Angular checkout; no source edits or browser run | Isolated candidate and fresh browser identity, trusted Origin, listener and consent |
| PostgreSQL | 2 local passed; expanded 57 passed / 6 existing failures | Broad acceptance remains non-green; do not relax assertions |
The earlier proposed 6 OpenRouter requests / 2,000 tokens / 30 seconds was not approved (the reply expressed lack of understanding). It is not an authorization. The reviewed 74/107/242 offline baseline remains historical, not a fresh rerun in this preparation checkpoint. No runtime implementation changed, so those repairs were not repeated. No paid request, dependency/model/source download, image build, operational write or Phase 3 work occurred.
Isolation and immediate stop rules
- Operational
rag-api-miniID4130f6de6e2a94e66befcb334badb6790fd22a1cdb1ab1a7d8ccfd6e0cd45043remains running on imagesha256:8c99722cd6d7a870ac0990e1781b3d49fc38ddf8c9a58eb9ad9f17f0a97a51d3. Originalrag-apiID65c9fa765c150467bde2d6336b09fb46d5ffe451d1117eb1ab93a7bacff1037dremains stopped on imagesha256:6f9b1bc3e0eeb76e0143fb33e2773f3fe3e639fbc3c4b2c11139aaabb58ea028. - Acceptance DB runner targets ONLY the recorded container at 127.0.0.1:55439,
database/user
rag_local_s2s_test/local_s2s_test, and its independent volume. It checks container/image/port/volume, checks server identity, creates/drops fixture-owned random schemas, uses --require-postgres and restores stopped state. Operationalrag-postgresport 5432 and its volume are never test targets. - Browser/engine stack uses only
docker-compose.local-s2s-test.yml, projectrag-local-s2s-test, separate candidate DB/storage volumes and loopback API 127.0.0.2:8091. Engine gets no DB credential; provider key stays server-side. Frontend Origin is 127.0.0.2:4201 with an entirely fresh browser profile and test account. Ports alone do not isolate cookies or databases. - Stop on any identity/origin/profile/rate mismatch, unauthorized provider/model, failed probe, missing terminal, incomplete audio, unavailable budget metering, download attempt, counter discrepancy, teardown survivor, or gate not satisfied. No retries or silent fallback. Keep partial streams incomplete; never invent commit/repair/history/terminal receipts. Preserve frozen reservations.
- Stop only owned candidate services. Never compose down, remove volumes, prune, retag/rebuild operational images, start an API against the operational DB, or change the existing frontend proxy. Retain raw native IDs/fingerprints privately; publish numeric/redacted observations, not keys or unconsented audio.
Preparation executed: exact commands and observations
docker inspect --format '{{.Name}}|{{.Id}}|{{.Image}}|{{.State.Status}}' rag-api-mini rag-api
docker image inspect python:3.11-slim --format '{{json .RepoDigests}}|{{.Os}}|{{.Architecture}}|{{.Id}}'
git -C D:/raymand/projects/speech-to-speech-test rev-parse HEAD
git -C D:/raymand/projects/speech-to-speech-test status --short
git -C D:/raymand/projects/speech-to-speech-test cat-file -t 619e3fe4f71d1c6f35c15870d588a3638de34722
Recorded operational IDs/images matched. Cached base is
python:3.11-slim@sha256:0dd364ba7e10242f07755449e3a3d0e35f9efd987952737b90def6709ab0c5ce
(linux/amd64). cat-file failed: required commit object absent. Sibling changes
were preserved; no checkout/fetch was attempted. Only hash-checked partial source
fixtures exist here; these are not a complete source tree.
.venv/Scripts/python -m services.local_s2s.assets --nltk-root "$env:APPDATA/nltk_data" --vad-root D:/raymand/projects/speech-to-speech-test/.cache/torch/hub/snakers4_silero-vad_master --output docs/evaluation/local-s2s/phase-02-local-assets.json
D:/raymand/projects/speech-to-speech-test/.venv/Scripts/python.exe -c "import json,os,nltk; from pathlib import Path; from services.local_s2s.assets import validate_assets,configure_nltk; root=Path(os.environ['APPDATA'])/'nltk_data'; vad=Path('D:/raymand/projects/speech-to-speech-test/.cache/torch/hub/snakers4_silero-vad_master'); digest=validate_assets(root,vad,'docs/evaluation/local-s2s/phase-02-local-assets.json'); configure_nltk(nltk,root); print(json.dumps({'manifest_sha256':digest,'nltk_version':nltk.__version__,'sentence_and_pos_load':'passed','runtime_downloads':'blocked','environment':'existing Windows sibling virtualenv; not Linux engine'}))"
.venv/Scripts/python docs/evaluation/local-s2s/acceptance-postgres.py --suite local
.venv/Scripts/python docs/evaluation/local-s2s/acceptance-postgres.py --suite expanded
Manifest SHA-256 8d740c51b979a1d4f92c2bd259e9c6f30497679fcf7ef9e8f31e7767320c5cd8,
201 files. Original assets unchanged; manifest refuses overwrite. NLTK 3.10.3
sentence/POS validation passed with download functions blocked. This validates
existing Windows resources, not Linux torch/JIT or complete engine compatibility.
Local DB: 2 passed in 5.18 s. Expanded: 57 passed, 6 failed in 236.50 s;
all six are test_actual_asgi_tool_dispatch_persistence_and_public_sources,
ok|no_evidence|error x gemini|openai, failing on RESPONSE_ACK_DEADLINE. They
match the earlier immutable-HEAD comparison in phase-02.md. That comparison was
not rerun here; no runtime changes were made. All assertions remain intact.
Runner restored the test container to exited after each suite. Expanded suite is
not acceptance-green; no broad DB pass is claimed.
Phase 1 gate: prepared source-only candidate, NOT launched
No engine build is needed to test the changed API source: the prepared
phase-01-openai-acceptance.override.yml reuses the cached immutable API image
read-only as a dependency runtime, mounts current app/migrations read-only, masks
inherited /app/data with tmpfs, and uses only candidate volumes/DB. This does not
alter or retag that image or touch its operational container. Validate source
compatibility before proceeding. Preserve a source SHA-256 manifest at run time;
freeze edits during the observed session and record actual effective OpenAI profile.
After explicit bounded OpenAI consent and verification of test DB/storage:
docker compose -f docker-compose.local-s2s-test.yml -f docs/evaluation/local-s2s/phase-01-openai-acceptance.override.yml -f docs/evaluation/local-s2s/phase-02-browser.override.yml up --pull never -d candidate_db candidate_migrations candidate_api
docker compose -f docker-compose.local-s2s-test.yml -f docs/evaluation/local-s2s/phase-01-openai-acceptance.override.yml -f docs/evaluation/local-s2s/phase-02-browser.override.yml exec -it candidate_api python -m app.bootstrap --organization-name Local-S2S-Test --username local-s2s-admin --assistant-name Local-S2S-Test --instruction "Answer briefly in Persian"
Use a new test password; do not copy an operational account. Listen to one short OpenAI greeting, interrupt once, verify the next answer and normal close on the changed source. Record audible output, native stop/repair correlation, actual transcripts and human listening observations. Readiness/replay/test tone do not close this gate. Source-mount recipe is prepared, not runtime-tested or accepted. Do not run the engine service in this Phase 1 session. Stop candidate_api before changing the candidate provider; do not rewrite the old OpenAI reservation.
Immutable build gate: conditional commands, NOT run
Acquire a clean checkout of the exact pin through an explicitly authorized source transfer (or supply it offline). Never repurpose the dirty sibling checkout. With the clean checkout and reviewed cached base:
.venv/Scripts/python services/local_s2s/prepare_build.py --checkout <clean-pinned-checkout> --base-image python:3.11-slim@sha256:0dd364ba7e10242f07755449e3a3d0e35f9efd987952737b90def6709ab0c5ce
In an authorized Linux resolver environment, pin the resolver version, review CPU PyTorch and all transitive packages/licenses, and produce a complete hash lock:
uv pip compile .local-s2s-build/requirements.in --python-version 3.11 --python-platform x86_64-unknown-linux-gnu --generate-hashes -o .local-s2s-build/requirements.lock
Record requirements.in, lock and prepared-source hashes, resolver/Python/platform, base digest and v3 build manifest. No lock or resolved dependency graph exists yet; full review cannot be performed on hashes of four source fixtures. Ensure controlled acceptance test dependencies are separately hash-locked; pytest availability in the runtime image is not assumed. Revalidate NLTK/VAD manifests after transfer.
Only after Phase 1 acceptance plus explicit dependency-download/image-build approval:
docker build --pull=false -f services/local_s2s/Dockerfile --build-arg ENGINE_BASE_IMAGE=python:3.11-slim@sha256:0dd364ba7e10242f07755449e3a3d0e35f9efd987952737b90def6709ab0c5ce -t rag-local-s2s-candidate:phase2 .
docker image inspect rag-local-s2s-candidate:phase2 --format '{{.Id}}|{{json .RepoDigests}}'
No new weights are authorized; use only reviewed fingerprinted local VAD assets. An image ID/digest and lock SHA must be actual outputs before provenance is filled.
Complete engine/SDK controlled-I/O gate: NOT run
Use the complete pinned checkout and actual locked SDK, handler construction, configured runtime, real local VAD and original NLTK. Replace only provider I/O with controlled responses and isolate external networking. A full-engine conformance runner does not yet exist here; completing it against that exact source is a remaining prerequisite, not a fictitious executable command. Do not substitute the AST/RecordingSDK harness as full-engine evidence. As a preliminary subset, with hash-locked pytest and assets available inside the isolated Linux environment:
python -m pytest /opt/speech-to-speech/tests/openai_realtime/test_realtime_protocol_contract.py /opt/speech-to-speech/tests/openai_realtime/test_response_input_identity.py -q -p no:cacheprovider
These paths were audited at the pin; that command has NOT been executed here and upstream fixtures alone do not close the full-engine gate. The complete runner must exercise and save observations for every row below before live activation:
| Trigger | Required actual observation |
|---|---|
| Constructor warmups, normal transcribed input, nondefault 17/83 token caps | Actual SDK outbound JSON caps, warmup attempts/counters; retryable HTTP and connect failure exactly once |
| Missing/corrupt local assets with downloader blocked | Fixed safe failure and zero provider operations |
| Session update and authoritative state | Models, voice, 24k rates, v3 profile and configured limits match initialized handlers/applied state; mismatch rejected |
| Input append/commit and manual create | Native input/item/turn correlation; no automatic response before explicit create; transcript alone is not commitment |
| Successful response, audio, transcripts | Native response/item/intent correlation and unchanged raw fingerprints; actual PCM and user/assistant completion semantics |
| Provider failure, empty/partial/trickled stream, peer close before headers/while silent | Accurate failure/incomplete framing; no invented terminal; zero retries, deadline limits, upstream cancellation/socket closure and slot release within v3 bounds |
| SIGINT and SIGTERM during in-flight request on Linux | Actual OS signal delivery to owned process, runtime stop, independent gateway/socket closure, joins and numeric final counters within bounded grace |
| Unsupported interruption | Safe close; no fabricated repair or continuation |
For each independently started, owned offline conformance container, actual
signal commands are docker kill --signal=SIGINT <owned-conformance-container>
and docker kill --signal=SIGTERM <owned-conformance-container>, followed by
docker wait <owned-conformance-container>. Start a fresh process for each signal.
Never target operational containers. Record complete runner command, mounts,
network isolation and SDK versions when the runner becomes executable.
Real components and browser: conditional, NOT authorized or run
Proposed ceilings for approval (not a grant): Phase 1 one OpenAI Realtime session, 60 seconds wall time, at most three responses, 256 output tokens per response; Phase 2 at most 12 OpenRouter HTTP attempts TOTAL including constructor warmups, component smoke and browser, at most 2,000 aggregate LLM output tokens and 30 seconds aggregate synthesized speech, 180 seconds live wall time. Input clips <=10 seconds. Require a monetary ceiling and approved model/voice IDs before paid execution. Actual startup counts must first come from complete controlled-I/O evidence. Count in-flight attempts against the limit. If these aggregate bounds cannot be metered and enforced, do not start. Split runs into separately budgeted stages; never assume startup probes are free or add retries when a stage fails. Record provider usage and request IDs privately; missing usage prevents a cost acceptance claim.
Supply a consented mono PCM16LE 24k Persian WAV and consent to retain the output; no consented fixture was supplied here. Configure key only in server environment, models/voice and the reviewed manifest paths/SHA. Existing component smoke executes three sequential calls, zero retries, 128-token LLM cap, per-stage 30s and total90s; its WAV header labels the requested rate and does not independently prove that the provider's raw PCM really has that rate. Verify provider format/rate metadata and actual audio with an independent listener/analyzer; ambiguous raw PCM fails the gate.
.venv/Scripts/python -m app.local_s2s_smoke --live --input <consented-mono24k-PCM16.wav> --output <fresh-output.wav> --save-evaluation-audio
Stop on missing/incompatible STT/LLM/TTS or incomplete/oversized output; do not try a replacement model. Record every attempted stage, even if smoke exits before its success counters; use provider records for partial failures.
For the isolated engine/browser, after all gates and explicit live approval:
$env:LOCAL_S2S_NLTK_SOURCE = "$env:APPDATA/nltk_data"
$env:LOCAL_S2S_VAD_SOURCE = 'D:/raymand/projects/speech-to-speech-test/.cache/torch/hub/snakers4_silero-vad_master'
$env:LOCAL_S2S_ASSET_MANIFEST_SOURCE = (Resolve-Path docs/evaluation/local-s2s/phase-02-local-assets.json).Path
$env:LOCAL_S2S_ASSET_MANIFEST_SHA256 = '8d740c51b979a1d4f92c2bd259e9c6f30497679fcf7ef9e8f31e7767320c5cd8'
# Enable flags only under the approved budget; secrets remain in the server environment.
$env:LOCAL_S2S_ENABLE_CANDIDATE = 'true'
$env:LOCAL_S2S_ALLOW_PAID_STARTUP = 'true'
docker compose -f docker-compose.local-s2s-test.yml -f docs/evaluation/local-s2s/phase-02-browser.override.yml up --pull never -d candidate_db candidate_migrations local-s2s-engine candidate_api
Frontend checkout found at D:/raymand/projects/faq_chatbot_frontend, HEAD
815191588c59fc43434cc2454cab3a8b2f8c1648, with pre-existing package.json edit.
Its original proxy targets a LAN service; do not edit/use that proxy for acceptance.
Existing ng.cmd is available, so this conditional launch requires no npm download:
Push-Location D:/raymand/projects/faq_chatbot_frontend
.\node_modules\.bin\ng.cmd serve --host 127.0.0.2 --port 4201 --proxy-config D:/raymand/projects/rag-technical-docs-assistant/docs/evaluation/local-s2s/phase-02-browser.proxy.json
Pop-Location
Use a new browser profile at http://127.0.0.2:4201, log into the disposable account, send one consenting Persian greeting, listen to the answer, verify user/assistant transcripts and normal close. Confirm request destinations and cookie/Origin/CSRF checks belong to this candidate only. Record actual sample counts/rate and native IDs privately with a human observation, not just readiness or a WAV header. If testing interruption, acceptance is only the documented safe close; no Phase 3 barge-in/history repair is claimed. Use source/profile snapshots for each session. Stop the owned candidate after observations (retain data):
docker compose -f docker-compose.local-s2s-test.yml stop
No operational switch is part of this checklist. Acceptance can be marked only when Phase 1 live evidence, complete engine/SDK/POSIX evidence, real components and isolated Persian browser greeting/transcripts/normal close all exist.