feat(voice): add bounded Realtime knowledge runtime

Connect OpenAI Realtime to the existing async StructuredTool and shared
SearchToolRunner with backend-owned authority and per-turn source references.
Add an operator-only smoke harness with persisted actor and provider opt-in.

Enforce confirmed readiness delivery, strict function identity, canonical
results and once-only continuations. Bound and pace generated audio, preserve
turn correlation, and require acknowledged cleanup before response release.
Handle Unicode arguments, UTF-8 replay budgets and user-ASR completion replays.

Validate with 318 voice/runner/shutdown tests and 1563 provider-free tests.
Three Windows symlink tests skip; 311 PostgreSQL tests are deselected.
Real-provider, browser playback and PostgreSQL acceptance remain unrun.
This commit is contained in:
amirhosein mazaheri
2026-10-08 18:06:03 +03:30
parent b50c920bfc
commit 9dac244590
13 changed files with 5303 additions and 0 deletions
+59
View File
@@ -405,3 +405,62 @@ For each material failure, record the scenario, expected behavior, correlated ID
- **Real-call limits:** retain the existing ten-call calibration and 26-query evaluation bounds. Use a separately opted-in voice smoke run capped at ten minutes total. Ingestion has its own explicit budget.
- **External prerequisites:** approved originals/document bindings, required human review, compatible database/provider access, and frontend availability. Missing prerequisites block their dependent acceptance only.
- **Markdown artifact:** this plan is stored as `docs/plans/realtime-agent-mvp-plan.md`. Add links to phase completion reports as implementation progresses. This document records the proposed work; it does not claim implementation or runtime acceptance.
## Phase 1 repair checkpoint (2026-10-08)
Implemented the scoped existing-runtime repairs; see
[operator configuration, behavior, exact checks and remaining acceptance](../guides/realtime-agent-phase1.md#phase-1-repair-acceptance).
The original proof/mock scripts, shared canonical search/StructuredTool/runner,
migrations and frozen inputs remain unchanged.
Targeted fake-provider/shared-runner/shutdown acceptance: 181 passed.
Final provider-free acceptance: 1426 passed, three existing Windows symlink
skips and 311 PostgreSQL tests deselected. Dependency, AST, manifest, whitespace,
guide-link and baseline preservation checks passed. Real provider/Persian
speech/browser playback and isolated PostgreSQL acceptance remain unrun; missing
opt-in/calibrated corpus bindings and TEST_DATABASE_URL are not filled with
invented evidence. The cancellation classifier remains fail-closed. This
checkpoint does not claim the real grounded-provider Phase 1 exit criterion.
## Five remaining Phase 1 defects checkpoint (2026-10-08)
Repaired independent failure cleanup, one-to-one function identity, exact adapter
wire accounting, common call-ID validation and successful empty-audio lifecycle.
See [behavior, regression evidence and exact executed checks](../guides/realtime-agent-phase1.md#five-remaining-defects-repair-2026-10-08).
This later checkpoint passed 229 targeted tests and 1474 provider-free tests
(three existing Windows symlink skips; 311 PostgreSQL tests deselected).
Protected inputs and unrelated changes remain preserved; shared retrieval and
the existing 50 ms runner test are unchanged. Real provider, speech, browser
playback and isolated PostgreSQL acceptance remain unrun with the prerequisites
and fail-closed limits recorded in the operator guide. Scope remains Phase 1.
## Readiness and Unicode Phase 1 checkpoint (2026-10-08)
Repaired application admission to require successful session_ready delivery,
separate from provider-confirmed setup. Malformed Unicode model arguments now
receive canonical INVALID_TOOL_ARGUMENTS with safe bounded replay fingerprints,
while provider framing/correlation remains strict.
See [operator behavior, evidence and exact checks](../guides/realtime-agent-phase1.md#readiness-and-unicode-repair-2026-10-08).
This later checkpoint adds 52 regressions: 281 targeted tests passed; the full
provider-free suite passed 1526 tests with three existing Windows symlink skips
and 311 PostgreSQL tests deselected. Protected files and unrelated changes were
preserved. Real provider/speech/browser and isolated PostgreSQL acceptance remain
unrun; missing calibration and unproved cancellation classification remain
fail-closed. Historical results above are unchanged. Scope remains Phase 1.
## Provider replay and user ASR Phase 1 checkpoint (2026-10-08)
Repaired replay hashing to retain the provider's actual UTF-8 wire admission
without applying that cap to ASCII expansion or canonical numeric spelling.
Completed user-ASR is coalesced by mapped input/content identity, with conflicts
failing observably and legitimate repeated partial text preserved.
See [operator evidence, failures/reruns and exact checks](../guides/realtime-agent-phase1.md#provider-replay-and-user-asr-repair-2026-10-08).
This checkpoint adds 37 cases: 318 targeted tests passed; 1563 provider-free tests
passed with three existing Windows symlink skips and 311 PostgreSQL tests
deselected. Protected files, unrelated changes, shared search/runner and the
existing 50 ms test remain preserved. Historical results above remain distinct.
Real provider/speech/browser and isolated PostgreSQL acceptance remain unrun,
subject to authorization/calibrated actor/corpus prerequisites and fail-closed
calibration/cancellation classification. Scope remains Phase 1.