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.
483 lines
34 KiB
Markdown
483 lines
34 KiB
Markdown
# Local S2S Phase 2 implementation report
|
|
|
|
Current verdict (2026-10-16): **Phase 2 accepted for isolated development-only
|
|
normal Persian browser voice**. [Final evidence](phase-02-accepted-20261016.md)
|
|
and [machine-readable results](phase-02-accepted-20261016.json):
|
|
125 local + 258 preservation + 63 PostgreSQL tests passed; actual browser response
|
|
fully played and closed normally. Conservative cost exposure $0.420504399, below
|
|
the same $1 cap; final invoice details remain unresolved with full reserves held.
|
|
Paid engine stopped normally. No buffer/speed change or operational promotion.
|
|
Phase 3/4 remain not_started. Earlier checkpoints below are historical and are
|
|
superseded where they describe open Phase 2 gates.
|
|
|
|
Current incident follow-up: [first browser-turn initialization stall repaired](phase-02-browser-first-turn-repair-20261016.md).
|
|
User session failed after transcription. Native snapshots identified first-reply
|
|
Lingua model preload; same cache now warms before listener readiness. Three full
|
|
proxy/API/native continuous-input fixture sessions and98 focused tests pass.
|
|
Fixed image a51167d1952a; no buffer/speed/timeout change. Repair handoff carries all
|
|
prior attempts; cumulative reservation ceiling $0.995118333 of the same$1. Human
|
|
browser acceptance remains open; earlier ready checkpoints below are historical.
|
|
|
|
Current browser handoff (2026-10-16): [isolated browser is ready](phase-02-browser-ready-20261016.md).
|
|
Angular/API/login and actual proxied WebSocket session_ready/normal close passed;
|
|
no inference in connection check. Three real startup probes passed. Human microphone/
|
|
reply/transcript acceptance remains open. Same $1 authorization; reconciled prior
|
|
exposure $0.689118333, cumulative ceiling $0.901118333, startup reserve $0.748118333.
|
|
Private login file and 30-minute engine watchdog documented. No tuning/operational change.
|
|
|
|
Latest actual run (2026-10-16): [real native Persian round trip passed](phase-02-real-native-20261016.md).
|
|
Six actual requests succeeded, 2.528s reply audio, successful terminal/normal
|
|
release and clean shutdown. Cumulative reservation is $0.998 of the same $1;
|
|
final billing remains unresolved, so no further paid request. User accepted native output; browser/microphone remains open; earlier memory blocker below is historical.
|
|
No operational switch or audio tuning change.
|
|
|
|
**Current 2026-10-16 checkpoint:** [image built and basic native/SDK checks passed](phase-02-image-build-20261016.md),
|
|
plus **423 provider-free regressions passed**. Earlier unbuilt/disk-blocked
|
|
statements below are historical. Phase 2 remains in_progress: real Linux assets,
|
|
complete engine/signal conformance and actual components/Persian browser are open.
|
|
|
|
Date: 2026-10-15. Status: **in_progress; offline candidate delivered, build/live acceptance pending**.
|
|
Phase 2 is **not accepted**. Phase 1 live acceptance remains open. No operational
|
|
provider switch, paid request, dependency/model download or engine build was performed.
|
|
|
|
## Delivered
|
|
|
|
Latest image-build attempt (2026-10-15): [disk-guard result](phase-02-image-build.md)
|
|
records actual build from reviewed source/base/lock, 6.64 MB context and binary-only
|
|
dependency installation. The root/Docker disk ran below the 384 MiB guard during
|
|
installation, so the owned build was cancelled (exit 130). No final image exists.
|
|
Moving only this task's resolver cache to tmpfs freed space; after cancellation
|
|
root returned to about 1.8 GiB free. Existing services/voice tuning preserved;
|
|
no pruning, model download or provider call. More Docker-disk space is required
|
|
before retry; Phase 2 remains in_progress, not accepted.
|
|
|
|
Latest Linux dependency checkpoint (2026-10-15): [reviewed hash lock and dry-run
|
|
report](phase-02-dependency-lock.md), [machine evidence](phase-02-dependency-lock.json).
|
|
134 packages resolved for Python 3.11/Linux x86_64, exact matching CPU torch/audio
|
|
2.11.0 wheels, verified trixie base manifest, wheel-only hash-required dry run
|
|
passed. No library installed, model downloaded, image built or voice setting
|
|
changed. Earlier missing-lock/base statements are historical; real native
|
|
imports, engine conformance and Phase 2 live acceptance remain open.
|
|
|
|
Latest Linux source-only checkpoint (2026-10-15): a clean, detached, depth-one
|
|
checkout of `619e3fe4f71d1c6f35c15870d588a3638de34722` now exists at
|
|
`tmp/local-s2s-upstream-619e3fe4` in this workspace. All 17 audited file SHA-256
|
|
and Git blob identities match `upstream-pin.json`; `git fsck --no-reflogs` passed.
|
|
See [source evidence](phase-02-source-checkout.json). This supersedes earlier
|
|
statements that the full pin is absent locally. No source executed, dependencies
|
|
installed, models downloaded, submodules initialized, engine built or provider
|
|
calls made during this step. Reviewed Linux lock/build/asset/conformance/live
|
|
gates remain open; Phase 2 stays in_progress.
|
|
|
|
- `local_s2s` configuration, factory and adapter alongside OpenAI/Gemini. It is
|
|
off by default and requires explicit development/transport-test opt-in.
|
|
- Immutable profile containing upstream/extension/contract revisions, component
|
|
models/voice, final-only Persian STT, fixed PCM24k and an effective configuration
|
|
digest. Secrets and secret-derived hashes are excluded.
|
|
- Versioned engine launcher/extension reading initialized component identities
|
|
and applied native session state. A session echo alone fails readiness.
|
|
Missing model/voice/rate/credential configuration fails safely; native input,
|
|
response/tool/transcript identities and replay fingerprints are preserved.
|
|
- Bounded local HTTP gateway, no retries, bounded pipeline queues, request
|
|
deadlines, final-only STT and startup request counters. Truncated streams omit
|
|
the final HTTP chunk so consumers observe failure. Counters are not cost proof.
|
|
- Unsupported interruption/history repair closes safely until Phase 3. No
|
|
acknowledgement, transcript alignment or successful terminal is invented.
|
|
- Standalone isolated Compose, pinned-source build preparation, Docker recipe,
|
|
local-only preprovisioned VAD loading, environment examples and operator guide.
|
|
The engine receives no database credentials. Application startup checks the
|
|
candidate database/storage before lifecycle reconciliation, and rechecks the
|
|
actual database connection at reservation/stream admission.
|
|
- Stub/opt-in live smoke with multipart or JSON STT and playable WAV output.
|
|
The saved stub WAV is explicitly a synthetic 440 Hz test tone.
|
|
|
|
Main files: `app/modules/voice/local_s2s.py`, `configuration.py`, `settings.py`,
|
|
`app/infrastructure/local_s2s.py`, `voice_provider.py`, `app/main.py`,
|
|
`app/api/v1/live.py`, `app/local_s2s_smoke.py`, `services/local_s2s/`, `docker-compose.local-s2s-test.yml`,
|
|
`.env.example`, and the three new Phase 2 test files. Phase 1 and unrelated
|
|
working-tree changes were retained. No schema migration or old-profile rewrite.
|
|
|
|
## Actual checks
|
|
|
|
Commands ran from the repository root with the existing Windows virtualenv;
|
|
`-p no:cacheprovider` avoids pytest cache writes.
|
|
|
|
| Check | Result |
|
|
| --- | --- |
|
|
| Focused OpenAI/Gemini/runtime plus new local adapter/engine tests | **277 passed in 143.65 s** |
|
|
| Final Phase 2 tests after adding transcript and rejected-body coverage | **35 passed in 3.94 s** |
|
|
| Existing auth/startup/lifecycle/HTTP regression tests | **72 passed in 16.32 s** |
|
|
| Final combined local + HTTP/startup suite after actual-connection isolation guard | **107 passed in 13.90 s** |
|
|
| New PostgreSQL profile replay/revocation tests with `--require-postgres` | **2 passed in 4.66 s** |
|
|
| Expanded PostgreSQL lifecycle/transport regressions | **57 passed, 6 failed in 292.92 s**; details below |
|
|
| `docker compose -f docker-compose.local-s2s-test.yml config --quiet` | Passed; no candidate started |
|
|
| `git diff --check` | Passed (Git reports the existing CRLF policy for `.env.example`) |
|
|
| Stub smoke and independent WAV header inspection | Passed; 3 mocked stages, **0 paid requests**, mono PCM16, 24,000 Hz, 9,600 samples (0.4 s) |
|
|
| Operational image/container inspection and `/health/ready` | Original IDs/images unchanged; **ready / available** |
|
|
|
|
Focused command:
|
|
|
|
```powershell
|
|
.venv/Scripts/python -m pytest tests/unit/test_local_s2s_engine.py tests/unit/test_local_s2s_phase2.py tests/unit/test_local_s2s_boundary.py tests/unit/test_live_context_sync.py tests/unit/test_realtime_repairs.py tests/unit/test_voice_retained_search.py tests/unit/test_voice_reported_sources.py tests/unit/test_openai_output_limit.py tests/unit/test_phase2_provider_selection.py tests/unit/test_openai_persian_style.py tests/unit/test_gemini_live.py -q --tb=short -p no:cacheprovider
|
|
```
|
|
|
|
Final local command:
|
|
|
|
```powershell
|
|
.venv/Scripts/python -m pytest tests/unit/test_local_s2s_phase2.py tests/unit/test_local_s2s_engine.py -q --tb=short -p no:cacheprovider
|
|
```
|
|
|
|
Final combined command:
|
|
|
|
```powershell
|
|
.venv/Scripts/python -m pytest tests/unit/test_local_s2s_phase2.py tests/unit/test_local_s2s_engine.py tests/unit/test_phase2_auth.py tests/unit/test_phase2_remaining.py tests/unit/test_phase2_lifecycle.py tests/unit/test_phase3_acceptance_repairs.py -q --tb=short -p no:cacheprovider
|
|
```
|
|
|
|
Existing HTTP/startup command:
|
|
|
|
```powershell
|
|
.venv/Scripts/python -m pytest tests/unit/test_phase2_auth.py tests/unit/test_phase2_remaining.py tests/unit/test_phase2_lifecycle.py tests/unit/test_phase3_acceptance_repairs.py -q --tb=short -p no:cacheprovider
|
|
```
|
|
|
|
PostgreSQL tests used a **new cached-image container** `rag-local-s2s-postgres-test`,
|
|
ID `e5da8c342ed59fc48a49856bfd76010feda45e4a221f640d34aa330a5cd8a7da`,
|
|
image `sha256:7b822b0aac60967beb1ea5e576b8602c94c300a157d187f385ae3e0da199b90a`,
|
|
at `127.0.0.1:55439`, database `rag_local_s2s_test`. No operational database was used.
|
|
The test harness created/dropped disposable schemas. Commands, with
|
|
`TEST_DATABASE_URL` set privately to this isolated database:
|
|
|
|
```powershell
|
|
.venv/Scripts/python -m pytest tests/integration/test_local_s2s_phase2.py -m postgres --require-postgres -q --tb=short -p no:cacheprovider
|
|
.venv/Scripts/python -m pytest tests/integration/test_local_s2s_phase2.py tests/integration/test_phase2_postgres.py -m postgres --require-postgres -q --tb=short -p no:cacheprovider
|
|
```
|
|
|
|
The six expanded-suite failures are all
|
|
`test_actual_asgi_tool_dispatch_persistence_and_public_sources`, combinations of
|
|
`ok|no_evidence|error` and `gemini|openai`. They wait for public source events before
|
|
feeding subsequent provider responses and hit `RESPONSE_ACK_DEADLINE`. The new
|
|
local tests are green. Baseline comparison loaded immutable `HEAD` versions of settings, configuration,
|
|
Realtime, Gemini, factory, runtime and main **in memory**, using `git show HEAD:<path>`,
|
|
then ran the same six cases via `pytest.main` with `-k test_actual_asgi_tool_dispatch_persistence_and_public_sources -m postgres --require-postgres -q --tb=no -p no:cacheprovider`: **the same 6 failures, 55 deselected in 113.06 s**. No working files were reverted; no existing
|
|
assertions or timeout thresholds were weakened to hide failures. The full ordinary
|
|
suite was not rerun; its prior failures remain documented in the Phase 1 report.
|
|
|
|
## See the result now
|
|
|
|
Open [the generated WAV](../../../temp/local-s2s-phase2-stub.wav) in an audio player.
|
|
It is a **test tone, not actual Persian speech**. To generate another artifact:
|
|
|
|
```powershell
|
|
.venv/Scripts/python -m app.local_s2s_smoke --output temp/local-s2s-another-stub.wav
|
|
```
|
|
|
|
The command refuses to overwrite an existing file. Run the final local test command
|
|
above to see native setup, audio/transcript delivery, safe failure and close checks.
|
|
These are simulated provider events/HTTP responses, not a real engine/browser demo.
|
|
|
|
## Remaining gates and acceptance verdict
|
|
|
|
1. Phase 1 changed-source real OpenAI interaction/listening is still pending.
|
|
2. The real pinned engine was **not built or initialized**. Resolve/review the
|
|
Linux dependency hash lock and base-image digest, supply a preprovisioned VAD
|
|
source/asset bundle, then run actual upstream/configuration conformance.
|
|
The launcher is statically audited and fixture-tested; real dependency/API
|
|
incompatibilities remain possible. No reproducible image is claimed yet.
|
|
3. No paid-call approval was obtained: the user's clarification was not consent.
|
|
No OpenRouter key was accessed. Real STT/LLM/TTS requests, PCM-rate verification,
|
|
Persian listening and the isolated browser greeting/normal close remain open.
|
|
4. Model discovery was a free catalogue read: STT `openai/whisper-large-v3` and
|
|
LLM `openai/gpt-4.1-mini` were listed; the TTS candidate is
|
|
`google/gemini-3.8-flash-lite-tts` / `Kore`. This is not speech acceptance.
|
|
OpenAI TTS IDs were absent from the observed speech catalogue; no fallback was added.
|
|
5. The Angular source is absent from this repository. Repoint the existing client
|
|
in its own checkout, using a separate browser profile and candidate-only Origin.
|
|
This Compose profile intentionally uses a disabled embedding endpoint for a
|
|
greeting/transport demonstration; it does not certify RAG or interruption quality.
|
|
|
|
[Operator guide: build, isolated bootstrap, browser and consented live WAV steps](../../../services/local_s2s/README.md).
|
|
The application/browser PCM and public event contracts remain unchanged.
|
|
|
|
Operational identities remain those in [Phase 1](phase-01.md): running
|
|
`rag-api-mini` image `sha256:8c99722cd6d7a870ac0990e1781b3d49fc38ddf8c9a58eb9ad9f17f0a97a51d3`;
|
|
stopped original `rag-api` image
|
|
`sha256:6f9b1bc3e0eeb76e0143fb33e2773f3fe3e639fbc3c4b2c11139aaabb58ea028`.
|
|
No restart or rollback was attempted. Phase 3 must not start until Phase 2 acceptance.
|
|
|
|
The temporary acceptance database container was stopped after verification (retained, not removed).
|
|
[Phase 2 source fingerprints and expected candidate profile](phase-02-provenance.json)
|
|
record unbuilt/unverified state explicitly; they contain no provider credentials.
|
|
|
|
|
|
## Five-defect repair checkpoint (2026-10-15, extension v2)
|
|
|
|
This checkpoint supersedes the earlier candidate's offline safety claims for the
|
|
five repaired paths; earlier execution records above remain historical evidence.
|
|
**Verdict: offline repairs verified; Phase 2 remains in_progress, live acceptance
|
|
pending.** Phase 3 was not implemented and the operational deployment was not switched.
|
|
|
|
Verification used the actual source at upstream commit
|
|
`619e3fe4f71d1c6f35c15870d588a3638de34722`. Hash-checked source fixtures and the
|
|
upstream Apache license are in `tests/fixtures/local_s2s_upstream/`; their manifest
|
|
records original paths and SHA-256 values. Only source text/license was fetched.
|
|
The isolated harness compiles original upstream methods from those sources; it
|
|
isolates SDK I/O, history and ML imports. It inspects outgoing HTTPX JSON and actual
|
|
loopback HTTP framing/closure, rather than accepting fake handler attributes as
|
|
request conformance. Full SDK/ML/image execution remains a separate gate.
|
|
|
|
| Confirmed upstream behavior / defect | Scoped repair and evidence |
|
|
| --- | --- |
|
|
| Base `process()` handles STT text through Chat Completions `_request_chat_completions`; that path ignores the prior `gen_kwargs` cap. Constructor setup invokes warmup. | Install the client policy and configured setup timeout before construction. Every actual Chat Completions create receives `max_tokens`; pinned normal text, warmup and setup tests inspect JSON with nondefault limits 17/83 and 19/71. Active attestation reads the installed policy. |
|
|
| Pinned `warmup()` explicitly clones the client with `WARMUP_MAX_RETRIES=6` (the earlier harness override was 10; correction below). | Policy clones force zero retries; retryable HTTP 503 and connection failures each produce exactly one attempt. Counters count admitted failed probes. Owner construction/probe deadline is 90 seconds; per-exchange default is 30 seconds. |
|
|
| Pipeline import catches missing punkt/tagger resources and calls `nltk.download`. | Build preparation replaces those blocks with local validation. Required NLTK files and local VAD bundle have a reviewed SHA-256 manifest and expected manifest digest. Preflight checks every asset and loads original sentence/POS functions before provider construction. Missing/corrupt/malformed assets or tokenizers attempting blocked downloads produce a fixed safe category with zero provider calls. No tokenizer substitution. |
|
|
| Prior gateway timing began after header acquisition and buffered streams in 8192-byte pieces. | Owned asynchronous connection lifecycle bounds silent/partial headers, body reads, upstream headers/reads and downstream drains. Total and inactivity deadlines are independent. Small SSE/PCM chunks flow immediately; expiration/disconnect cancels upstream, closes transports and releases slots. Failed partial chunked responses omit the terminal chunk. Tests exercise actual loopback sockets, cancellation and stalled writes. |
|
|
| Upstream `ConfiguredRuntime.stop()` can raise before clearing resources; `wait()` invokes stop. The launcher bypassed upstream command signal management. | Independent bounded runtime stop, gateway shutdown, socket close and thread join always produce numeric cleanup/request counters. Owned SIGINT/SIGTERM handlers signal the stop event and restore predecessors. Tests exercise the pinned failing stop method, a hung stop/construction and termination during an in-flight mock request. Windows tests dispatch installed handlers; OS-level POSIX signal delivery remains unverified. |
|
|
|
|
Original source locations: `LLM/base_openai_compatible_language_model.py`
|
|
(`setup`, `process`), `LLM/chat_completions_language_model.py`
|
|
(`_request_chat_completions`, `warmup`), `s2s_pipeline.py` (NLTK import block),
|
|
and `configured_runtime.py` (`ConfiguredRuntime.stop`, `wait`). All paths are
|
|
under upstream `src/speech_to_speech/` at the pinned SHA.
|
|
|
|
The behavior revision is now `rag-local-s2s-phase2-v2`; private contract shape
|
|
remains `rag-local-s2s-phase2-v1`. New profiles pin v2. Existing reservations,
|
|
frozen profiles and historical v1 evidence are not rewritten. Raw event
|
|
fingerprints, authorization/replay/epoch checks, browser PCM24k/events and
|
|
fail-safe unsupported interruption remain covered by the preservation suites.
|
|
No existing OpenAI/Gemini assertions were weakened. Only the engine test client
|
|
fixture gained the effective policy fields required by v2 attestation.
|
|
|
|
Final repair regression command (31 passed in 6.82 s):
|
|
|
|
```powershell
|
|
.venv/Scripts/python -m pytest tests/unit/test_local_s2s_repairs.py -q --tb=short -p no:cacheprovider
|
|
```
|
|
|
|
Required final combined command (107 passed in 18.66 s):
|
|
|
|
```powershell
|
|
.venv/Scripts/python -m pytest tests/unit/test_local_s2s_phase2.py tests/unit/test_local_s2s_engine.py tests/unit/test_phase2_auth.py tests/unit/test_phase2_remaining.py tests/unit/test_phase2_lifecycle.py tests/unit/test_phase3_acceptance_repairs.py -q --tb=short -p no:cacheprovider
|
|
```
|
|
|
|
Required preservation command (242 passed in 34.11 s):
|
|
|
|
```powershell
|
|
.venv/Scripts/python -m pytest tests/unit/test_local_s2s_boundary.py tests/unit/test_live_context_sync.py tests/unit/test_realtime_repairs.py tests/unit/test_voice_retained_search.py tests/unit/test_voice_reported_sources.py tests/unit/test_openai_output_limit.py tests/unit/test_phase2_provider_selection.py tests/unit/test_openai_persian_style.py tests/unit/test_gemini_live.py -q -p no:cacheprovider
|
|
```
|
|
|
|
These are offline tests, with zero paid calls, model/dependency downloads, image
|
|
builds or operational changes. PostgreSQL acceptance was **not run in this repair
|
|
checkpoint**: no disposable `TEST_DATABASE_URL` was verified/used. The earlier
|
|
2-pass and 57-pass/6-baseline-failure DB records above are not a fresh acceptance
|
|
claim; existing full-suite and database baseline failures remain open.
|
|
|
|
Reviewable repair files: `services/local_s2s/{request_policy,assets,lifecycle,
|
|
components,engine,extension,prepare_build}.py`, local behavior revision,
|
|
engine-only Compose asset mounts and example settings, pinned fixtures/harness,
|
|
`test_local_s2s_repairs.py`, engine fixture and these operator/evaluation records.
|
|
Unrelated working-tree changes were preserved. No terminal events, repair receipts
|
|
or live observations were fabricated; persistent provider credentials stay server-side.
|
|
|
|
To see the repaired behavior, run the three commands above. For actual speech,
|
|
follow the [updated operator guide](../../../services/local_s2s/README.md#phase-2-repair-checkpoint-extension-v2)
|
|
after separate authorization: provision/fingerprint local NLTK and VAD assets,
|
|
review Linux dependency lock and immutable base digest, build an isolated candidate,
|
|
then verify complete real-engine/SDK conformance, component audio and isolated
|
|
Persian browser greeting, transcripts and normal close. The Phase 1 real OpenAI
|
|
interaction/listening gate also remains open. No live acceptance is claimed until
|
|
those observations exist. The prior WAV remains a simulated test tone.
|
|
|
|
|
|
Additional offline checks:
|
|
|
|
```powershell
|
|
git diff --check
|
|
docker compose -f docker-compose.local-s2s-test.yml config --quiet
|
|
.venv/Scripts/python -c "import ast, tokenize; from pathlib import Path; paths=list(Path('services/local_s2s').glob('*.py'))+[Path('tests/unit/test_local_s2s_repairs.py'),Path('tests/support/local_s2s_pinned.py')]; [ast.parse(tokenize.open(p).read(),filename=str(p)) for p in paths]; print(str(len(paths))+' Python files parsed using Python source encodings')"
|
|
```
|
|
|
|
All passed; 9 Python source files parsed. An initial inspection using
|
|
`read_text(encoding='utf-8')` failed on the engine file's UTF-8 BOM; rerunning with
|
|
Python's source encoding detection passed. This was an inspection-command issue,
|
|
not an interpreter import failure. Scoped untracked repair files were also
|
|
checked for trailing whitespace. Compose validation parsed configuration only;
|
|
it did not create/start any service or print credentials.
|
|
|
|
|
|
## Remaining-defect repair checkpoint: extension v3
|
|
|
|
**Verdict: offline regressions passed; Phase 2 remains in_progress and live
|
|
acceptance pending.** The five prior repairs remain; Phase 3 and operational
|
|
services were untouched. The [scoped patch](phase-02-remaining-repairs.patch) is
|
|
relative to this checkpoint's in-session pre-edit snapshots, so unrelated existing
|
|
working-tree changes are excluded. Files: `services/local_s2s/components.py`,
|
|
`app/modules/voice/local_s2s.py`, `services/local_s2s/prepare_build.py`, the pinned
|
|
source harness and repair tests, operator guide, this report, provenance and ledger.
|
|
No existing OpenAI/Gemini assertion was removed or relaxed.
|
|
|
|
1. **Disconnect ownership.** A concurrent downstream watcher starts after the body
|
|
and cancels the owned forwarding task on ordinary EOF/reset, including before
|
|
upstream headers and while response streaming produces nothing. Response/client
|
|
transport closure and task joining share a one-second cleanup window; expiry
|
|
aborts the downstream transport, cancels remaining cleanup and releases the slot.
|
|
Total/inactivity deadlines and incomplete chunked failure remain intact.
|
|
Real upstream and downstream TCP loopback tests assert upstream socket closure,
|
|
transport closure and slot release before a five-second request deadline, with
|
|
a 0.6-second scheduling allowance beyond the cleanup window. A stalled close
|
|
test verifies the cleanup bound itself. The old continuous-output disconnect
|
|
test remains; the earlier v2 disconnect description alone did not establish
|
|
these stalled-upstream cases.
|
|
2. **Half-close policy.** FIN cannot distinguish full close from SHUT_WR. For
|
|
ordinary requests, EOF is explicitly cancellation, even if the peer can receive.
|
|
Intentional receive-only half-close is supported with the private header
|
|
`X-Local-S2S-Half-Close: receive-response`; FIN after the complete body then keeps
|
|
response delivery alive, while reset/transport errors still cancel. A graceful
|
|
full close after that declaration is inherently indistinguishable and remains
|
|
bounded by request deadlines. This header is not forwarded upstream and is not
|
|
a browser event/API change. Loopback tests prove normal and declared half-close
|
|
success, plus undeclared half-close cancellation. Extra bytes/pipelining are
|
|
unsupported and unknown header values fail before provider admission.
|
|
3. **Inherited validation.** Renamed only `LocalS2SSettings.identifier` to
|
|
`local_component_identifier`, avoiding Pydantic's inherited validator override
|
|
by `VoiceSettings.identifier`. Through the real VoiceSettings, all four local
|
|
STT/LLM/TTS model and TTS voice fields now reject whitespace, control and non-ASCII
|
|
values. Tests preserve valid identifiers, check unchanged OpenAI/Gemini validators
|
|
and verify invalid environment configuration fails before assets/gateway/provider
|
|
construction or probes.
|
|
4. **Source provenance correction.** `WARMUP_MAX_RETRIES` is **6**, defined at
|
|
line 66 of hash-checked `base.py.source`, imported by `chat.py.source`. The v2
|
|
test harness supplied literal 10, an isolated override, and the report/guide
|
|
incorrectly identified it as upstream's value. Those descriptions are corrected;
|
|
historical execution counts/timings remain unchanged. The harness now extracts
|
|
the literal from the verified source AST, with an explicit value assertion.
|
|
Pinned warmup HTTP 503/connection-failure tests run using 6 and still assert one
|
|
attempt. Complete SDK retry/ML engine execution is not claimed.
|
|
|
|
Intentional behavior changes use `rag-local-s2s-phase2-v3` in fresh identities and
|
|
build manifests; the private shape revision remains v1. No old reservation or
|
|
frozen profile was rewritten. Native fingerprints, browser PCM24k/events,
|
|
authorization/replay/epoch checks and fail-safe unsupported interruption remain.
|
|
Persistent provider credentials stay server-side. No terminal/history receipt
|
|
was fabricated. The pinned source fixture bytes and hashes were not changed.
|
|
|
|
Final commands and outcomes:
|
|
|
|
```powershell
|
|
.venv/Scripts/python -m pytest tests/unit/test_local_s2s_repairs.py -q --tb=short -p no:cacheprovider
|
|
# 74 passed in 7.68s (31 prior repairs retained; 43 added regressions)
|
|
.venv/Scripts/python -m pytest tests/unit/test_local_s2s_phase2.py tests/unit/test_local_s2s_engine.py tests/unit/test_phase2_auth.py tests/unit/test_phase2_remaining.py tests/unit/test_phase2_lifecycle.py tests/unit/test_phase3_acceptance_repairs.py -q --tb=short -p no:cacheprovider
|
|
# 107 passed in 16.67s
|
|
.venv/Scripts/python -m pytest tests/unit/test_local_s2s_boundary.py tests/unit/test_live_context_sync.py tests/unit/test_realtime_repairs.py tests/unit/test_voice_retained_search.py tests/unit/test_voice_reported_sources.py tests/unit/test_openai_output_limit.py tests/unit/test_phase2_provider_selection.py tests/unit/test_openai_persian_style.py tests/unit/test_gemini_live.py -q -p no:cacheprovider
|
|
# 242 passed in 33.73s
|
|
docker compose -f docker-compose.local-s2s-test.yml config --quiet
|
|
# Passed: parse only; no service started or rendered secrets printed
|
|
git diff --check
|
|
# Passed
|
|
```
|
|
|
|
The initial targeted run before the final existing-provider validation cases was
|
|
70 passed in 7.35s. All requested final suites passed; no baseline failure was
|
|
hidden or assertion weakened. Historical broader ordinary/DB failures above and
|
|
in the Phase 1 report remain separate and unresolved. PostgreSQL was not run in
|
|
this checkpoint: no verified disposable TEST_DATABASE_URL was used. Any later DB
|
|
acceptance requires that verification and `--require-postgres`.
|
|
|
|
Evidence boundaries and remaining gates: original upstream methods run with an
|
|
isolated SDK/history/ML harness; HTTPX and the new loopback transport tests use real
|
|
local sockets. These are offline fixture results, not complete engine/OpenAI SDK,
|
|
provider-audio or browser acceptance. No paid calls, downloads, image builds,
|
|
operational actions or Phase 3 work occurred. Still required: Phase 1 real OpenAI
|
|
interaction/listening, reviewed Linux dependency hash lock and immutable base image
|
|
digest, provisioned/fingerprinted NLTK and VAD assets, real pinned-engine/SDK
|
|
conformance, authorized component audio, and isolated Persian browser greeting,
|
|
transcripts and normal close. See the [v3 operator guide](../../../services/local_s2s/README.md#phase-2-remaining-repairs-extension-v3).
|
|
|
|
|
|
## Acceptance preparation checkpoint (2026-10-15; v3 unchanged)
|
|
|
|
**Phase 2 remains in_progress / NOT ACCEPTED.** No runtime repair or refactor was
|
|
needed. The reviewed implementation/test fingerprints were checked unchanged
|
|
before documentation updates; the 74/107/242 baseline was not repeated. No paid
|
|
call, source/dependency/model download, image build, operational write, reservation
|
|
rewrite or Phase 3 implementation occurred. New files are acceptance preparation,
|
|
asset fingerprints and a guarded disposable-DB runner.
|
|
|
|
The [concrete acceptance checklist](phase-02-acceptance-checklist.md) records exact
|
|
commands, isolation, request ceilings proposed for approval, expected observations,
|
|
stop conditions and remaining gates. Candidate-only Phase 1 source-mount and
|
|
browser/proxy overrides were prepared and parsed; they were NOT launched. The
|
|
Phase 1 recipe uses the existing immutable API image as a dependency runtime,
|
|
mounts changed source read-only, masks inherited /app/data and uses separate test
|
|
DB/storage. It changes neither the operational container nor image. Source/runtime
|
|
compatibility still needs an actual consenting OpenAI interaction and listening.
|
|
Phase 1 stays open: server-side OpenAI key presence was verified without printing
|
|
its value; no bounded live approval or consented fixture is recorded. OpenRouter
|
|
key presence was false in both the checked host process and root server .env.
|
|
No key was copied to browser/profile/provenance.
|
|
|
|
Actual independent progress:
|
|
|
|
- Existing assets were found and fingerprinted: **201 files**, combined NLTK/Silero
|
|
manifest [phase-02-local-assets.json](phase-02-local-assets.json), SHA-256
|
|
`8d740c51b979a1d4f92c2bd259e9c6f30497679fcf7ef9e8f31e7767320c5cd8`.
|
|
The existing sibling Windows environment loaded NLTK **3.10.3** sentence/POS
|
|
resources with downloader entry points blocked. No original asset changed.
|
|
Linux VAD/JIT and complete engine validation remain unrun.
|
|
- The cached immutable base was identified as
|
|
`python:3.11-slim@sha256:0dd364ba7e10242f07755449e3a3d0e35f9efd987952737b90def6709ab0c5ce`,
|
|
Linux/amd64. No dependency lock or candidate image exists. The sibling engine
|
|
checkout is dirty at `30af00916da85efb053b539a040fd71cf392e7e2` and does NOT contain
|
|
the required pin object; `git cat-file -t <pin>` failed. Its changes were preserved.
|
|
Building/reviewing a full pinned source graph requires an authorized clean
|
|
transfer/offline source tree, followed by reviewed Linux dependency resolution.
|
|
- PostgreSQL was actually run with `--require-postgres` on the retained verified
|
|
disposable container/database at 127.0.0.1:55439, never operational port 5432.
|
|
The runner validates fixed container/image/volume and host port, non-overlap with
|
|
operational storage, and `current_database()/current_user` before tests. Secrets
|
|
stay inside the subprocess environment. Fixtures create/drop random owned schemas.
|
|
- Local DB acceptance: **2 passed in 5.18 s**, zero skips. Expanded: **57 passed,
|
|
6 failed in 236.50 s**, zero skips. All six are the same
|
|
`test_actual_asgi_tool_dispatch_persistence_and_public_sources`
|
|
`ok|no_evidence|error` x `gemini|openai` cases, with RESPONSE_ACK_DEADLINE. They
|
|
match the earlier immutable-HEAD baseline comparison recorded above; that
|
|
comparison was not rerun here. No application/test assertion changed and broad
|
|
database acceptance remains non-green. The test container returned to exited
|
|
after each run; no volumes or operational data were removed.
|
|
- Frontend source was found outside this repository at
|
|
`D:/raymand/projects/faq_chatbot_frontend`, HEAD
|
|
`815191588c59fc43434cc2454cab3a8b2f8c1648`, with a pre-existing package.json edit.
|
|
Its proxy and files were not modified. An external candidate-only proxy and
|
|
trusted Origin 127.0.0.2:4201 were prepared; no browser/microphone run occurred.
|
|
|
|
Executed acceptance commands:
|
|
|
|
```powershell
|
|
.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
|
|
docker compose -f docker-compose.local-s2s-test.yml config --quiet
|
|
docker compose -f docker-compose.local-s2s-test.yml -f docs/evaluation/local-s2s/phase-02-browser.override.yml config --quiet
|
|
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 config --quiet
|
|
git diff --check
|
|
```
|
|
|
|
Asset commands passed; all three Compose parses passed. Rendered Phase 1 config
|
|
was inspected privately: read-only current app mount, masked inherited data,
|
|
non-operational DB/volumes, selected OpenAI provider, no OpenRouter key in API,
|
|
loopback binding and candidate Origin passed assertions. No rendered secret was
|
|
printed. Final git diff/metadata checks are recorded in provenance. The guarded
|
|
runner invokes the exact earlier local/expanded pytest commands with
|
|
`-m postgres --require-postgres -q --tb=short -p no:cacheprovider` and a verified
|
|
TEST_DATABASE_URL set privately. Its expanded exit code was 1; this is not hidden.
|
|
|
|
Remaining prerequisites are exact: Phase 1 bounded OpenAI consent and actual
|
|
changed-source listening; a clean complete pinned source tree; reviewed immutable
|
|
Linux dependency lock and build authorization; Linux asset compatibility; an
|
|
executable complete-engine controlled-I/O harness with actual SDK and POSIX signal
|
|
evidence; OpenRouter key and bounded paid consent plus consented Persian speech;
|
|
then real components and an isolated browser greeting/answer/transcripts/normal
|
|
close. The AST harness, NLTK load, DB passes and Compose parses do not replace any
|
|
of those observations. Proposed live limits in the checklist are NOT permission.
|
|
No automatic approval rejection blocked this checkpoint; dependent work remains
|
|
unrun because prerequisites/authorizations are absent.
|