feat(backend): deliver Phase 3 document and voice integration

Add authenticated upload, review, retry and knowledge-selection HTTP flows with bounded JSON processing and frozen OCR policy.

Preserve Gemini/OpenAI provider selection and fenced lifecycle semantics; retain FAQ preambles and uncertain vision candidates, and expose opt-in uncalibrated voice transport diagnostics.

Include frontend integration examples, aligned contracts and deterministic regressions. Validation: 1767 provider-free tests passed; all 404 PostgreSQL scenarios have passing evidence across the documented runs.
This commit is contained in:
11linear11
2026-10-09 17:43:52 -04:00
parent 9be47191d6
commit a73a496c54
67 changed files with 5988 additions and 234 deletions
@@ -287,3 +287,22 @@ resources. Storage retention/purge remains an owner decision.
Read the implementation guide for work packages, API/database contracts for
transport/persistence and the English scenario report for concrete walkthroughs.
The reference map/setup guide remain the evidence of existing component progress.
### OCR supervisor deployment policy (2026-10-09)
`INGEST_OCR_REVIEW_REQUIRED` defaults to true and is backend-only. New ingestion
jobs freeze the boolean in `processing_profile.extraction.ocr_review_required`
(the existing immutable document-owned snapshot for its one job). Workers and
retries use that snapshot; absent fields in legacy profiles mean true. Preserve
existing profile bytes/digests; do not backfill applied records. False permits
clean OCR/vision output that passes existing automatic validation without a human
extraction decision. It never waives non-OCR review, warning/integrity/coverage
checks, independent factual-corpus approval, or explicit knowledge selection.
Automatic extraction remains quality_decision=passed; mixed inspected/automatic
PDFs use partially_reviewed with annotations only for inspected locators. Neither
automatic OCR nor its portions in mixed PDFs creates a human review
annotation/audit record. Ready publication remains inactive. Retained pending or
rejected candidates still block retry; deployment changes cannot waive them.
F01 capabilities.ocr_review_required is current deployment policy; D03 reports
frozen ocr_review_required, review_state and extraction_quality_decision.
See [Phase 3 handoff](../guides/realtime-agent-phase3-handoff.md).
+60 -17
View File
@@ -1,15 +1,18 @@
# RAG Assistant — Phase 1 API Catalog
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).
Version 1.3 · 2026-10-07 · Current Live document MVP contract; planned endpoints are not claimed operational.
@@ -93,7 +96,7 @@ No body. Same identity/CSRF/expiry shape as login. Missing/expired session retur
`multipart/form-data`: required `file`; optional `title`. Required `Idempotency-Key`. The server creates one independent document and ingestion job. New document is inactive.
Current local intake validates configured PDF, UTF-8 Markdown, DOCX, JPEG and PNG with byte/signature/package/image bounds and correct MIME. D01 accepts new files without a repository filename/hash allowlist. The four examples are acceptance fixtures, not upload eligibility. Stream/spool within configured limits; do not buffer an unbounded request. These engineering defaults do not imply every layout is extractable or total corpus capacity is unlimited. D01 HTTP transport remains planned.
Current local intake validates configured PDF, UTF-8 Markdown, DOCX, JPEG and PNG with byte/signature/package/image bounds and correct MIME. D01 accepts new files without a repository filename/hash allowlist. The four examples are acceptance fixtures, not upload eligibility. Stream/spool within configured limits; do not buffer an unbounded request. These engineering defaults do not imply every layout is extractable or total corpus capacity is unlimited. D01 HTTP transport is implemented; see the Phase 3 handoff.
```json
{"document_id":"10000000-0000-4000-8000-000000000001","job_id":"40000000-0000-4000-8000-000000000001","status":"queued","is_active":false,"searchable":false}
@@ -111,7 +114,7 @@ Query: common pagination; optional `status=queued|processing|ready|failed`, `is_
{"id":"10000000-0000-4000-8000-000000000001","title":"Working Hours","filename":"working-hours.pdf","status":"ready","is_active":false,"searchable":false,"created_at":"2026-10-05T09:00:00Z","chunk_count":8,"job":{"id":"40000000-0000-4000-8000-000000000001","status":"succeeded","stage":"publish","attempt_count":1,"retry_generation":0,"can_retry":false,"error":null}}
```
`searchable = ready AND active AND not deleted AND not content-purged`. A review-required failure is failed with a safe reason and `review_required:true`; it is not a new lifecycle state. Detail may include `review_required:false` for other outcomes. D06 supplies retained review evidence only to admins. Poll while queued/processing; proposed interval 2 seconds, slow down when tab is hidden. Failed job exposes `{code,message,retryable}` without internal stack traces. `can_retry` means server allows retry of the unchanged original; corrupt input generally requires new upload. Return 404 for deleted/hidden ID.
`searchable = ready AND active AND not deleted AND not content-purged`. A review-required failure is failed with a safe reason and `review_required:true`; it is not a new lifecycle state. Detail includes `review_required`, `review_state`, frozen `ocr_review_required` and `extraction_quality_decision` (null before complete extraction). D06 supplies retained review evidence only to admins. Poll while queued/processing; proposed interval 2 seconds, slow down when tab is hidden. Failed job exposes `{code,message,retryable}` without internal stack traces. `can_retry` means server allows retry of the unchanged original; corrupt input generally requires new upload. Return 404 for deleted/hidden ID.
### D04 — Retry failed processing
@@ -215,7 +218,7 @@ Duplicate IDs: 422. Any unready item: 409 `DOCUMENT_NOT_READY`, with rejected ID
### F01 — Read
```json
{"revision":1,"assistant_name":"Organization Assistant","instruction":"Reply concisely in Persian using authorized document evidence.","capabilities":{"text":false,"voice":true,"captions":true,"supported_upload_types":["<confirmed-MIME-type>"],"max_upload_bytes":null}}
{"revision":1,"assistant_name":"Organization Assistant","instruction":"Reply concisely in Persian using authorized document evidence.","capabilities":{"text":false,"voice":true,"captions":true,"supported_upload_types":["<confirmed-MIME-type>"],"max_upload_bytes":20971520,"ocr_review_required":true}}
```
Runtime must replace illustrative capability placeholders with actual configuration; `max_upload_bytes` is a positive integer in deployed responses. Add configured `max_pdf_pages` and a bounded `supported_structure_notes` description. Voice/captions capabilities reflect validated provider support, not assumed availability; captions=true above is the intended release outcome. The browser must not advertise full text chat. No settings mutation UI is required. No model secrets or selectable model list. Non-admin may read presentation settings/capabilities.
@@ -276,15 +279,15 @@ Scope key `(conversation_id,client_request_id)`. Changed message under same key:
Path uses the original client request UUID, allowing recovery even if the POST response was lost. 200 returns T01 shape, including running/failed. 404 if no committed turn exists. If 404 after an ambiguous client timeout, retry the SAME POST/key; uniqueness handles races. Never generate a new key merely because a response was lost.
## 7. Voice contract — Gemini Live temporarily; frozen application audio/events
## 7. Voice contract — backend-selected provider; frozen application audio/events
The current provider is Gemini Live managed by the backend. Earlier OpenAI-specific
provider mechanisms below describe the retained Realtime adapter; the Gemini
The selected provider is backend-managed Gemini Live or OpenAI Realtime. The
OpenAI-specific mechanisms below describe the preserved Realtime adapter; the Gemini
adapter uses native setupComplete, voiceActivity, toolCall/toolResponse and
transcription. Missing verified input boundaries fail safely. Interruption
requiring unheard-audio context repair closes the session rather than inventing
a cancellation/truncation acknowledgement. The browser still uses 24 kHz mono
PCM16LE; Gemini input conversion to 16 kHz occurs inside the adapter. This replaces revision 1.1's provisional SDP contract before frontend implementation. HTTP creation/poll/close, application WSS audio/events and internal model tools are separate contracts. None is verified as implemented. Phase 0 freezes the application audio/event fields below; implementation remains pending. These are application names, not provider-native event names. Provider events, response/item/call IDs, session objects and credentials remain private to the adapter; tool_call_id is an application correlation ID.
PCM16LE; Gemini input conversion to 16 kHz occurs inside the adapter. This replaces revision 1.1's provisional SDP contract before frontend implementation. HTTP creation/poll/close, application WSS audio/events and internal model tools are separate contracts. Phase 0 freezes the application audio/event fields below. Technical implementation evidence and remaining live acceptance prerequisites are recorded in the Phase 2 repair report. These are application names, not provider-native event names. Provider events, response/item/call IDs, session objects and credentials remain private to the adapter; tool_call_id is an application correlation ID.
### V01 — Create session (HTTP)
@@ -557,3 +560,43 @@ safe codes never return keys or native provider errors. HTTP authentication
failures normalize to `AUTH_REQUIRED`, CSRF to `CSRF_INVALID`, hidden resources
to `NOT_FOUND`, admission throttling to `RATE_LIMITED` with Retry-After, and
unexpected dependency failures to `DEPENDENCY_UNAVAILABLE`.
### OCR supervisor deployment policy (2026-10-09)
`INGEST_OCR_REVIEW_REQUIRED` defaults to true and is backend-only. New ingestion
jobs freeze the boolean in `processing_profile.extraction.ocr_review_required`
(the existing immutable document-owned snapshot for its one job). Workers and
retries use that snapshot; absent fields in legacy profiles mean true. Preserve
existing profile bytes/digests; do not backfill applied records. False permits
clean OCR/vision output that passes existing automatic validation without a human
extraction decision. It never waives non-OCR review, warning/integrity/coverage
checks, independent factual-corpus approval, or explicit knowledge selection.
Automatic extraction remains quality_decision=passed; mixed inspected/automatic
PDFs use partially_reviewed with annotations only for inspected locators. Neither
automatic OCR nor its portions in mixed PDFs creates a human review
annotation/audit record. Ready publication remains inactive. Retained pending or
rejected candidates still block retry; deployment changes cannot waive them.
F01 capabilities.ocr_review_required is current deployment policy; D03 reports
frozen ocr_review_required, review_state and extraction_quality_decision.
See [Phase 3 handoff](../guides/realtime-agent-phase3-handoff.md).
### Phase 3/4 additive admission diagnostics (2026-10-09)
V01, by-request recovery and V03 polling expose calibration_status with values
calibrated, uncalibrated or unknown (legacy reservations without search metadata).
It is derived from the frozen server execution profile, never supplied by clients.
F01 capabilities additionally expose calibration_status and voice_transport_testing.
With explicit server VOICE_TRANSPORT_TESTING=true, missing/pending calibration
permits voice connectivity using configured embedding transport. This does not
change Section 7.2 evidence admission: search returns error/CALIBRATION_REQUIRED
without sources until measured calibration exists. Default false retains strict
admission. Origin/CSRF, ownership, epochs, deduplication and provider pinning remain.
Leading unstyled FAQ introductions appear in factual review and in each included
pair's source context. Recognition warnings or complete=false with legible blocks
produce extraction review candidates, including when frozen ocr_review_required is
false. D06/D07 and same-job D04 approval/retry semantics remain unchanged; no chunks
are published while review is pending. Approval attests to exact output, including
completeness; reject missing/inaccurate content rather than approve guesses. Fatal
format/provenance/readability failures still map to EXTRACTION_QUALITY_FAILED.
@@ -1,15 +1,18 @@
# RAG Assistant — Phase 1 Database Design
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).
Version 1.3 · 2026-10-07 · Live document MVP persistence contract; proposed forward changes are not applied migrations.
@@ -385,7 +388,7 @@ Keep source identity rows as tombstones if allowed. `available` in API is comput
UNIQUE(owner_user_id,client_request_id). Partial UNIQUE(conversation_id) WHERE status IN ('creating','connecting','connected'). Scoped and chain-consistent FKs ensure owner/auth session belong to same organization and user; live conversation is owned by that user. CHECK terminal implies closed_at set. No SDP replay field is required for the OpenAI Realtime WSS flow. Store no raw audio. Provider credentials are server configuration, never database plaintext. Application stream path derives from session ID; it is not a bearer provider credential.
API instance owns the direct OpenAI Realtime WSS connection and audio relay in memory; DB stores mapping/state, not recoverable media. After API restart, mark nonterminal sessions failed and attempt cleanup. Reconnection uses a new session. Poll returns recent tool_calls, not a fabricated transcript. Available current-session provider transcripts are relayed to the UI with completion/interruption state; durable full voice message storage is deferred. Existing text messages/turns are not silently reused for voice.
The single API process owns the selected direct Gemini Live/OpenAI Realtime WSS connection and audio relay in memory; DB stores mapping/state, not recoverable media. After API restart, mark nonterminal sessions failed and attempt cleanup. Reconnection uses a new session. Poll returns recent tool_calls, not a fabricated transcript. Available current-session provider transcripts are relayed to the UI with completion/interruption state; durable full voice message storage is deferred. Existing text messages/turns are not silently reused for voice.
### 6.2 audit_events
@@ -465,3 +468,22 @@ Text finalization/history/citation tests belong to the later text milestone.
## 10. Deliberately absent from Phase 1
No per-organization vector database, message broker tables, raw audio blobs, arbitrary tool schema registry, retention scheduler, multi-version assignment workflow or model catalogue. Full document bodies are in file storage/chunks; original files and recordings are not PostgreSQL byte arrays. Keep no production capacity or retention claim until stakeholders supply those requirements.
### OCR supervisor deployment policy (2026-10-09)
`INGEST_OCR_REVIEW_REQUIRED` defaults to true and is backend-only. New ingestion
jobs freeze the boolean in `processing_profile.extraction.ocr_review_required`
(the existing immutable document-owned snapshot for its one job). Workers and
retries use that snapshot; absent fields in legacy profiles mean true. Preserve
existing profile bytes/digests; do not backfill applied records. False permits
clean OCR/vision output that passes existing automatic validation without a human
extraction decision. It never waives non-OCR review, warning/integrity/coverage
checks, independent factual-corpus approval, or explicit knowledge selection.
Automatic extraction remains quality_decision=passed; mixed inspected/automatic
PDFs use partially_reviewed with annotations only for inspected locators. Neither
automatic OCR nor its portions in mixed PDFs creates a human review
annotation/audit record. Ready publication remains inactive. Retained pending or
rejected candidates still block retry; deployment changes cannot waive them.
F01 capabilities.ocr_review_required is current deployment policy; D03 reports
frozen ocr_review_required, review_state and extraction_quality_decision.
See [Phase 3 handoff](../guides/realtime-agent-phase3-handoff.md).
@@ -1,15 +1,18 @@
# RAG Assistant — Phase 1 Implementation Guide
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).
Version 1.3 · 2026-10-07 · Current Live document MVP implementation baseline; planned mechanisms are not completion evidence.
@@ -44,7 +47,7 @@ declared format/structure/resource limits must run without developer changes.
| Upload | New bounded PDF/DOCX/JPEG/PNG/Markdown documents; unknown future total count |
| QC | Retain exact review candidates, evidence-bound admin decisions and same-job retry; no new document state |
| Retrieval | Scoped pgvector semantic search plus exact normalized identifiers; reranker/ANN conditional on measured need |
| Voice | Direct OpenAI Realtime audio over backend WSS; shared LangChain knowledge tool |
| Voice | Backend-selected Gemini Live/OpenAI Realtime audio over WSS; shared LangChain knowledge tool |
| Evidence | Current-session provider transcripts/sources; durable owned session/tool diagnostics |
| Deferred | Full text chat/history, settings editor, rich management/delete UI, recording, seamless reconnect, CTI |
| Settings | Fixed server profiles and seeded instruction/name; retain revisions and expose read-only capabilities |
@@ -126,7 +129,7 @@ Resolve `(user_id, organization_id, role)` exclusively from the session. Check o
embedding components. Validate original checksum and actual provider identity.
A legacy profile is dispatched explicitly, never silently reinterpreted.
6. Retain exact extraction output for review/reuse, then stage every embedding.
The current PageBlockExtractor requires review for PDF pages and vision output;
The current PageBlockExtractor requires review for direct PDF pages and, by default, OCR/vision output;
this is an actual implementation gate, not an optional UI decoration.
7. Publish all chunks and ready/succeeded state in one fenced transaction.
Verify token, unexpired lease, original/profile, non-deletion, complete vectors,
@@ -144,7 +147,8 @@ be indexed. Crash recovery must not attach uncommitted or stale candidates.
D06 shows retained candidates to the admin. D07 records approval/rejection of
the exact evidence digest and required checks. New OCR output has a different
review identity and requires a new decision. Server validates/recomputes digests;
review identity and requires a new decision when the frozen supervisor gate or
independent validation requires review. Server validates/recomputes digests;
client supplied text, paths, profile identity and reviewer identity are forbidden.
Use job/document locks and current failed-candidate identity for decisions.
Decisions neither activate nor mark a document ready.
@@ -180,8 +184,9 @@ Factual preparation validates the whole retained source structure before selecti
groups. Explicit heading ancestry associates governing headings and introductory
conditions with each descendant Q&A pair; existing whole-group context stays
exclusive to that pair. Preserve conditions, negation, exceptions and their real
locators in every affected draft. Ambiguous unheaded preambles, detached prose or
unresolved relationships fail visibly instead of becoming unrestricted answers.
locators in every affected draft. Leading unheaded titles/preambles are top-level
document context and accompany each approved pair, including pairs under later
headings. Detached prose after pairs or unresolved relationships still fail visibly.
Factual review exposes that context from the same immutable complete artifact.
Reviewer identity/checks/note are bounded review metadata, not machine quality
warnings; administrator prose never changes extraction readability decisions.
@@ -227,7 +232,7 @@ If the browser times out, it queries the turn by client request ID. Retrying the
## 9. Live lifecycle
Create a fresh owned `mode=voice` conversation. Persist a session reservation before remote setup, then connect the backend to direct OpenAI Realtime WSS, install Persian instructions and `search_knowledge`, and enable provider transcription. The browser receives an application stream path, never SDP or a persistent provider credential. Authenticate/validate trusted Origin, owner/auth session and access epoch at the stream handshake.
Create a fresh owned `mode=voice` conversation. Persist a session reservation before remote setup, then connect the backend to the pinned Gemini Live/OpenAI Realtime WSS profile, install Persian instructions and `search_knowledge`, and enable provider transcription. The browser receives an application stream path, never SDP or a persistent provider credential. Authenticate/validate trusted Origin, owner/auth session and access epoch at the stream handshake.
Use the SAME search service and fixed compatible embedding profile as the internal text-query harness and any later text chat. Dispatch search_knowledge through the LangChain integration boundary; do not route native audio through the old text agent. Provider call IDs/hash deduplicate tool events; running duplicates wait, completed duplicates revalidate scope before replay, changed payloads conflict. Store recent evidence for polling. Live answers may use evidence directly; no mandatory extra text-model call. Current-session transcript/source events are specified in API Section 7; durable full voice transcripts are deferred. Persist voice tool records without a dependency on deferred text turns/messages/citations.
@@ -292,3 +297,45 @@ LangChain, existing embedding reuse and direct OpenAI Realtime are confirmed dir
Exact-output retention/review, FAQ inclusion decisions and their forward schema/
HTTP mechanisms in this revision are implementation proposals made concrete for
review, not already implemented behavior or approval of every fact in a file.
### OCR supervisor deployment policy (2026-10-09)
`INGEST_OCR_REVIEW_REQUIRED` defaults to true and is backend-only. New ingestion
jobs freeze the boolean in `processing_profile.extraction.ocr_review_required`
(the existing immutable document-owned snapshot for its one job). Workers and
retries use that snapshot; absent fields in legacy profiles mean true. Preserve
existing profile bytes/digests; do not backfill applied records. False permits
clean OCR/vision output that passes existing automatic validation without a human
extraction decision. It never waives non-OCR review, warning/integrity/coverage
checks, independent factual-corpus approval, or explicit knowledge selection.
Automatic extraction remains quality_decision=passed; mixed inspected/automatic
PDFs use partially_reviewed with annotations only for inspected locators. Neither
automatic OCR nor its portions in mixed PDFs creates a human review
annotation/audit record. Ready publication remains inactive. Retained pending or
rejected candidates still block retry; deployment changes cannot waive them.
F01 capabilities.ocr_review_required is current deployment policy; D03 reports
frozen ocr_review_required, review_state and extraction_quality_decision.
See [Phase 3 handoff](../guides/realtime-agent-phase3-handoff.md).
### Phase 3/4 recognition and transport-testing amendment (2026-10-09)
Vision complete=false and recognition warnings preserve nonempty legible candidate
blocks with their diagnostics. They force exact-output extraction review even when
the job's frozen OCR supervisor policy is false. They are not complete validated
artifacts until genuine review approves completeness and the other required checks.
Malformed/empty/truncated native output, invalid provenance/relationships, unreadable
source text and bounded input/output violations remain fatal. Warning wording alone
is not evidence of corrupt source text. Retained approved candidates resume without
repeating vision; separate factual approval and explicit knowledge selection remain.
VOICE_TRANSPORT_TESTING defaults false. Explicit true permits authenticated voice
transport testing without finalized calibration, after configured embedding adapter
construction validates credentials, identity and request limits without inference.
Uncalibrated reservations pin transport_testing and embedding identity in the existing
execution_profile JSON and expose calibration_status=uncalibrated through create,
recovery and poll. Shared canonical retrieval still returns CALIBRATION_REQUIRED
with no evidence; no arbitrary threshold or synthetic calibration is installed.
Current policy/profile must still match the reservation on stream admission; policy
changes cannot silently upgrade, downgrade or switch a reserved provider. Health
remains provider-free. Real voice/retrieval quality acceptance remains separate.
@@ -160,3 +160,22 @@ Rehearse browser upload -> review if needed -> ready -> activate -> real Persian
voice -> shared retrieval -> spoken answer/sources on target HTTPS/network.
Record actual errors/latency/provider usage and limits, not invented accuracy
percentages or unexecuted acceptance claims.
### OCR supervisor deployment policy (2026-10-09)
`INGEST_OCR_REVIEW_REQUIRED` defaults to true and is backend-only. New ingestion
jobs freeze the boolean in `processing_profile.extraction.ocr_review_required`
(the existing immutable document-owned snapshot for its one job). Workers and
retries use that snapshot; absent fields in legacy profiles mean true. Preserve
existing profile bytes/digests; do not backfill applied records. False permits
clean OCR/vision output that passes existing automatic validation without a human
extraction decision. It never waives non-OCR review, warning/integrity/coverage
checks, independent factual-corpus approval, or explicit knowledge selection.
Automatic extraction remains quality_decision=passed; mixed inspected/automatic
PDFs use partially_reviewed with annotations only for inspected locators. Neither
automatic OCR nor its portions in mixed PDFs creates a human review
annotation/audit record. Ready publication remains inactive. Retained pending or
rejected candidates still block retry; deployment changes cannot waive them.
F01 capabilities.ocr_review_required is current deployment policy; D03 reports
frozen ocr_review_required, review_state and extraction_quality_decision.
See [Phase 3 handoff](../guides/realtime-agent-phase3-handoff.md).