docs(acceptance): record Phase 4 evidence and remaining gates

Publish reproducible per-scenario operational and bounded intake results, correlation identifiers, timing observations, provider-call counts and startup/recovery guidance.

Record retrieval, human-review, calibration, actual frontend and HTTPS/WSS prerequisites separately. Preserve historical evidence and explicitly keep Phase 4 incomplete.
This commit is contained in:
11linear11
2026-10-09 17:44:13 -04:00
parent 42f5b9e854
commit b06eaf59f4
5 changed files with 911 additions and 13 deletions
+205 -11
View File
@@ -1,15 +1,18 @@
# Phase 1 agent reference map
Current voice decision (2026-10-09): **Gemini Live is temporarily the sole voice
provider because an OpenAI Realtime voice key is unavailable.** The validated
backend Gemini model/voice configuration is shared by reservation, stream and
operator smoke. No OpenAI voice key is required. Extraction/embedding providers,
frozen profiles, measured calibration and canonical search are unchanged.
The provider-independent browser audio/events, direct document/chunk identities
and durable owner/replay/revocation rules remain authoritative. Historical
OpenAI checkpoints below remain historical. Gemini interruption closes safely
where native sample-level context truncation cannot be verified; seamless
barge-in is not certified. See [Phase 2 repair report](guides/realtime-agent-phase2-repair.md).
Current voice configuration (2026-10-09): **VOICE_PROVIDER=gemini|openai selects
one backend adapter. Gemini remains the temporary default because an OpenAI
Realtime voice key is unavailable.** Reservation, authenticated stream and
operator smoke share the selected model/voice/profile. Only the selected voice
key is required; there is no fallback or frontend provider selector. Legacy
PROVIDER and existing GEMINI_* settings remain supported; conflicting provider
aliases fail configuration. Dedicated OPENAI_REALTIME_* settings do not change
embedding credentials. Browser PCM16LE remains mono 24 kHz in both directions.
Pinned reservations cannot switch providers on connection or replay. Gemini
interruption requiring unverified context truncation closes safely; OpenAI keeps
its existing native cancellation/truncation contract. Canonical search, original
documents, frozen profiles and owner/replay/revocation rules remain unchanged.
See [Phase 2 repair report](guides/realtime-agent-phase2-repair.md).
Use this index to select the governing contract and inspect the real implementation before changing, testing, or reviewing behavior. Paths are relative to this file. Current voice contract amended 2026-10-08 by Realtime Phase 0; English revision 1.3 remains the broader scope baseline. Historical component evidence below is preserved; the English revision 1.3 documentation checkpoint reran no application/provider/database tests; current repair acceptance is recorded at the end. Use the latest applicable recorded acceptance, not earlier unavailable-database reports. Dated component records below describe their historical checkpoint; absence-of-worker statements there are superseded by the current Phase 5/6 inventory and repair evidence.
@@ -71,7 +74,7 @@ Ingestion foundation now exists: [manifest](../pyproject.toml), [settings/types/
| `git status --short` | Executed for working-tree inspection |
| `git diff --check` | Executed for tracked whitespace validation; untracked new files need separate inspection |
| `rg --files --hidden -g '!.git/**'` | Executed for file discovery |
| `uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload` | README example and entry point verified statically; runtime not verified |
| `python -m app.server --host 0.0.0.0 --port 8000` | Supported single-process entrypoint; selected legacy parser verified by real loopback boundary/fragment/compression/queue tests |
| `python -m app.services.agent.exec` | README example and CLI entry point verified statically; provider smoke harness, not automated regression tests; not run |
Prototype runtime prerequisites remain unverified: configured credentials, approved corpus, writable vector storage, and provider/model access. Importing the application creates settings/retrieval singletons and can load embeddings/index documents. Do not use imports as a supposedly network-free smoke test. README installation now uses pyproject.toml extras. Foundation imports are independent of those prototype prerequisites. Verified foundation commands are listed below; current worker commands and acceptance are in the Phase 5 section at the end of this map.
@@ -1871,3 +1874,194 @@ Regression sources add `tests/unit/test_phase2_remaining.py` and executable
acceptance uses a local transport bridge; Node executes the delivered client and
worklet. Exact results and unrun real-provider/browser prerequisites are in the
repair record. No selected-model multi-turn or frontend readiness claim is made.
## Phase 2 provider selection and transport repair (2026-10-09)
Current locations: [selected provider factory](../app/infrastructure/voice_provider.py),
[voice settings](../app/modules/voice/configuration.py),
[authority classification](../app/modules/voice/authority.py),
[supported single-process server](../app/server.py),
[pre-payload WebSocket parser](../app/infrastructure/voice_websocket.py).
API and operator smoke share construction; unchanged Gemini/OpenAI adapters keep
their separate native capabilities. Browser PCM remains 24 kHz; reservations pin
provider/model/voice/profile and cannot switch on replay/connection. Legacy
PROVIDER/GEMINI_* remain supported; conflicting provider aliases fail. Dedicated
OPENAI_REALTIME_* keys do not change embedding configuration.
See the [current repair checkpoint](guides/realtime-agent-phase2-repair.md#provider-selection-and-transport-repair-2026-10-09)
for finding/fix/test mapping, exact checks and preservation evidence, and the
[frontend guide](guides/frontend-voice-integration-example.md) for configuration,
startup, retained creation attempts, dual playback bounds and the 10-second
uncommitted idle-input limitation. Real loopback tests execute the explicitly
selected installed parser; generic Uvicorn defaults are not supported admission.
Exactly one API process owns media guards; ingestion runs separately. Fake tests
are not real provider/Persian speech/browser hardware or frontend readiness proof.
Verified final commands: `.venv/bin/python -m pytest -m "not postgres" -q -p no:cacheprovider --tb=short`
— **1679 passed**, two existing Windows path skips; `.venv/bin/python -m pytest -m postgres --require-postgres -q -p no:cacheprovider --tb=short`
— **372 passed**, zero skips, using only the isolated task-created test database.
Affected PostgreSQL cases: **61 passed**. Missing TEST_DATABASE_URL produced the
required prerequisite failure. Executable JS, syntax/compile, diff and baseline
preservation checks passed. See the report for exact durations, failed/interrupted
runs, isolated-database settings and remaining external prerequisites.
## Current Phase 3 HTTP and OCR policy inventory (2026-10-09)
D01-D04/D06 preview/D07, K01/K02 and read-only F01 are now implemented in
[document routes](../app/api/v1/documents.py) and
[knowledge/configuration routes](../app/api/v1/knowledge.py). These use existing
intake/review/worker/selection services, with bounded streaming
[multipart admission](../app/api/v1/uploads.py) and safe scoped
[polling queries](../app/infrastructure/document_queries.py). This supersedes
prior pending-HTTP statements above. The standalone frontend developer handoff is
[Phase 3 integration](guides/realtime-agent-phase3-handoff.md), with executable
DocumentClient and a same-origin Vite proxy example. Existing VoiceClient/worklet,
Gemini/OpenAI selection, canonical search and migrations 0001–0005 are preserved.
`INGEST_OCR_REVIEW_REQUIRED=true` is a deployment default frozen in new job
profiles; false admits only automatically validated OCR. Legacy profiles retain
mandatory review without rewriting their digests. Non-OCR and factual approval
remain separate. Mixed automatic/inspected PDFs report partially_reviewed;
only actually inspected locators receive human annotations. Publication remains
ready and inactive until K02. F01 reports configured safe policy/capabilities,
while document polling reports the frozen policy and actual retained review state.
The two remaining Phase 2 findings are repaired: cancellation propagates out of
receive-capacity waits, and the parser preserves its native UTF-8 rejection for
durable LIVE_PROTOCOL_ERROR classification even when Uvicorn would report 1006.
See the [Phase 2 checkpoint](guides/realtime-agent-phase2-repair.md) and
[Phase 3 validation record](guides/realtime-agent-phase3-handoff.md) for exact
checks, actual failures/corrections and remaining real-provider/browser prerequisites.
Final Phase 3 checks: **1724 provider-free passed**, two existing Windows path
skips; **162 affected PostgreSQL passed**, zero skips; **323 affected unit passed**;
**22 final HTTP acceptance cases passed** and **2 explicit two-provider redaction
cases passed**. Prior broader PostgreSQL checkpoint: **393 passed**, zero skips;
see the handoff for its timing relative to the final mixed-PDF refinement.
Missing TEST_DATABASE_URL produced the required failure. Compose, Node execution/
syntax, AST/TOML, diff and preservation checks passed. **200 task-start files remain
byte-identical**, 26 intended existing files changed, 11 added, none removed.
The isolated task-owned test container was removed after zero-schema/table checks.
## Four verified Phase 3 findings repair (2026-10-09)
The ingestion regression source `tests/unit/test_phase3_repairs.py` is restored
byte-for-byte from `9be4719` (55 cases). HTTP admission/filename/proxy regressions
now live in `tests/unit/test_phase3_http_repairs.py`. K02 uses the existing bounded
blocking pool; D07's DTO-derived finite body budget is 60,151,072 bytes with
pre-extension capacity checks. D04 nonempty bodies remain 422 VALIDATION_ERROR.
See the [current handoff repair record](guides/realtime-agent-phase3-handoff.md)
for exact finding-to-test mappings, executed results and open validation failures.
Earlier Phase 3 counts above are historical and do not establish restored coverage.
## Phase 3 JSON responsiveness and acceptance follow-up (2026-10-09)
Large D07/K02 JSON handling now uses two admitted requests, 64 KiB cooperative
spooling and local child-process UTF-8/JSON/DTO validation in
`app/infrastructure/json_processing.py`, with bounded result frames and owned
cancellation/cleanup. D07 also bounds retained normalized DTOs to two review
transactions. Existing finite byte budgets and safe error/correlation mappings
remain. `app/modules/knowledge/langchain_tool.py::prepare_search_tools` runs
through the existing blocking pool during API startup, before readiness, to move
observed cold framework loading outside first-tool waits; document-only optional
framework behavior remains supported. No dependency or external service added.
New regressions: `tests/unit/test_json_processing.py` (actual large escaped JSON
responsiveness and lifetime/admission checks),
`tests/unit/test_phase3_acceptance_repairs.py` (startup order/off-loop preparation
and optional framework). Existing correlation, HTTP, all 55 restored ingestion
and isolated PostgreSQL acceptance sources remain intact. See the
[current handoff record](guides/realtime-agent-phase3-handoff.md) for measured
GIL comparisons, diagnostic stacks/wait locations, exact completed commands and
remaining unresolved historical parser-stall cause. Real providers, Persian
speech, browser hardware and production deployment remain unverified.
Final follow-up acceptance: **92 focused unit passed**, **1753 provider-free
passed** (two existing Windows-path skips; 397 PostgreSQL cases deselected),
**25 affected isolated PostgreSQL passed**, zero acceptance skips. Missing
TEST_DATABASE_URL failed as required. Actual 26.8/59.5 MB escaped JSON heartbeat
maximum gaps: **14.03/11.64 ms**, versus **215.07/336.19 ms** in a thread.
Seven scoped baseline files changed, **231 stayed byte-identical**, three added.
The historical parser-stall cause remains explicitly unresolved; no real-provider,
Persian speech or browser hardware claim is made. Exact commands/results,
intermediate failures and database cleanup are in the handoff.
## Realtime MVP Phase 4 acceptance checkpoint (2026-10-09)
The [Phase 4 acceptance report](guides/realtime-agent-phase4-acceptance.md)
records current baseline verification, per-scenario outcomes, JSON heartbeat
observations, guarded provider-free health correlation IDs, isolated database
checks, spending prerequisites and startup/recovery commands. This is the
Realtime MVP phase, separate from the older scoped-search Phase 4 report.
Current checks: **92 focused passed**, **1753 provider-free passed** (two existing
Windows-path skips), **397 isolated PostgreSQL passed**, zero acceptance skips.
Actual large-JSON maximum heartbeat gaps were **13.06/16.21 ms**. Health made
zero provider calls; missing TEST_DATABASE_URL failed explicitly. Disposable
database cleanup/removal and dependency/Compose/whitespace checks passed.
The developer confirms the actual frontend is still in development. Funded
Gemini and OpenAI acceptance, independent held-out retrieval quality, real UI/
hardware and HTTPS/WSS deployment remain `not_run` with exact prerequisites.
The configured calibration remains pending with null cutoff. No completion,
provider quality or operational readiness claim follows from technical tests.
Existing provider adapters/selection, frozen OCR/factual policies, shared
retrieval, protected inputs and applied migrations were retained.
## Phase 4 executed operational follow-up (2026-10-09)
The latest [acceptance report](guides/realtime-agent-phase4-acceptance.md) and
[startup/recovery guide](guides/phase4-backend-operations.md) supersede the
technical-only operational checkpoint above. Actual built Docker API/worker,
accounts and HTTP, publication/selection, provider-free health, persistent service
recreation, interrupted-worker lease recovery, synthetic review/retry and graceful
shutdown passed **eight scenarios** with zero real-provider calls. Correlations,
timing definitions and observations are in
[operational evidence](calibration/realtime-phase4-operations.json).
Final suites: **1755 provider-free passed** (two existing Windows-path skips),
**397 isolated PostgreSQL passed**, zero database acceptance skips. Missing database
configuration failed explicitly. Task containers/networks were removed; unrelated
containers and named acceptance volumes were preserved.
The user's bounded permission for four originals/APIs resulted in **one** real
OpenRouter vision HTTP attempt; all native Gemini/OpenAI voice, calibration,
evaluation and paid embedding call counts remained zero. Actual bindings and
failures are in [bounded intake evidence](calibration/realtime-phase4-bounded-intake.json).
The original DOCX failed ambiguous factual association; the infographic failed
extraction quality; both PDFs remain queued without paid extraction. No human
approval or unseen label was manufactured. Real embedding request limits and
container endpoint reachability, approved calibration/review/labels and finalized
retrieval gate remain non-UI prerequisites. Gemini Live preflight returned 503
CALIBRATION_REQUIRED; OpenAI additionally lacks its dedicated key. Actual frontend
and hardware, provider quality, and public HTTPS/WSS remain separately not_run.
Phase 4 is incomplete. Docker dependency/startup configuration and demonstrated
worker SIGTERM cleanup were repaired; protected inputs and frozen contracts remain.
## Ingestion and voice transport admission amendment (2026-10-09)
The [scoped repair report](guides/ingestion-voice-admission-repair.md) supersedes
prior claims that initial FAQ preambles or recognition diagnostics must terminate
intake, and documents the explicit `VOICE_TRANSPORT_TESTING` policy (default false).
Initial unheaded source introductions accompany all approved FAQ pairs; detached
post-pair prose still fails. Gemini/OpenRouter incomplete recognition and warnings
retain legible candidates and require exact human extraction review even with a
frozen false OCR policy. Fatal native format/provenance/readability remains enforced.
Independent factual approval, same-job retry and explicit selection remain intact.
Explicit transport testing admits owned voice reservations/streams without measured
cutoff and exposes frozen calibration_status in create/recovery/poll and F01.
Shared search still admits no uncalibrated evidence: CALIBRATION_REQUIRED remains its
canonical result. Provider selection/adapters, authorization before provider opening,
replay identities, epochs and stream profile matching remain. No migrations or
external dependencies added. Actual provider quality/UI/hardware/public HTTPS/WSS
remain separately unverified. Full commands, outcomes, intermediate obsolete contract
assertions and protected-input checks are recorded in the scoped report.
Executed scoped repair checks: **124 focused unit passed**, **1767 full provider-free
passed** (two existing Windows-path skips), **7 new PostgreSQL repair scenarios
passed**. Initial full database run: 401 passed and two superseded warning-only
assertion failures; strengthened corrupt-text cases passed. Final database recheck:
**402 passed**, zero skips, with only the two unchanged large-review cases already
passed in the initial full run deselected. All 404 current database scenarios have
passing executed evidence across these runs. Protected inputs/migrations and the
restored 55-case source remained byte-identical. Exact timings, reproduction,
intermediate failures, JUnit path and cleanup are in the scoped repair report.