docs(voice): consolidate local S2S roadmap into four phases

This commit is contained in:
amirhosein mazaheri
2026-10-15 09:26:39 +03:30
parent 22f29b8d58
commit 872e5f25cb
20 changed files with 1005 additions and 357 deletions
@@ -0,0 +1,57 @@
# Phase 1 - Small provider boundary with OpenAI preserved
Paste the following into a fresh implementation session in this repository.
```text
Implement Phase 1 only: Small provider boundary with OpenAI preserved.
Prerequisite:
Phase 0 audit, scoped contract proposal and baseline evidence exist.
Required visible outcome:
OpenAI still produces the same command/ack behavior through a provider boundary; show a deterministic before/after replay.
Execution rules:
- Read docs/plans/local-s2s-adapter-plan.md and docs/plans/local-s2s-adapter-progress.md first. Read applicable AGENTS.md, repository skills and governing API/database/workflow sections. Inspect current code; historical defaults are not current evidence.
- Implement only this phase. Check actual prerequisite artifacts, not just the existence of code. State observed, simulated, unverified and blocked outcomes separately.
- Preserve OpenAI/Gemini behavior, original operational/rollback containers/images, frozen old profiles and unrelated working-tree changes. No database reset, compose down, pruning or implicit provider switch.
- Keep existing browser PCM24k/application events, backend-derived identity, one canonical search implementation, document/chunk references and authorization/revision checks.
- Make the smallest scoped change. No plugin framework, full runtime rewrite, new broker or unrelated refactor. Update intentional contracts and affected consumers coherently; never edit applied migrations.
- Ordinary tests are provider-free. DB acceptance requires a verified disposable TEST_DATABASE_URL and --require-postgres; never production. Do not run a parallel application API against the operational database.
- Reuse explicit authorization already present. Paid requests, downloads and operational switching need the applicable bounded authorization. Without it, finish independent offline preparation, identify the exact missing prerequisite and keep dependent live acceptance open.
- Do not print keys/full environments/raw provider payloads or real user speech. Consent-controlled fixture artifacts are separate from default logs.
- Never fake provider events, terminal success or history acknowledgements. Unsupported capabilities fail safely. Do not introduce automatic cross-provider fallback.
- Before finishing: inspect diff, run meaningful checks, record exact commands/results and demo steps, update the progress ledger and list all not-run checks. Do not accept a phase with required live/human checks unrun. Do not begin the next phase.
Required work:
1. Implement minimal internal typed operations/events for actual runtime needs, preserving raw provider replay fingerprints and identities.
2. Keep turn ownership, authorization, evidence, deadlines, audio credits, final played positions and next-turn release in runtime. Move native encoding/parsing and confirmation interpretation into adapters.
3. Define interruption progress with operation/response/item/session identities and separate generation-stop/history-repair proof. Capability declarations must not waive cleanup.
4. Adapt OpenAI using existing cancel/terminal/truncate semantics unchanged. Preserve Gemini conservative failure. No model/voice branches in shared control.
5. Add controlled-clock regression/replay tests and document the internal responsibility amendment while keeping browser wire behavior fixed.
Acceptance criteria:
- Existing OpenAI assertions remain and affected tests pass, with prior failures reported honestly.
- Before/after trace releases exactly one next response after matching cleanup.
- Wrong/missing/late/duplicate-conflicting events, limited tools and timeouts fail safely.
- No deployment/default change or unnecessary persistence migration.
Relevant paths (verify actual locations before editing):
runtime.py, a minimal internal provider-contract module if justified, realtime.py, Gemini adapter only where needed, diagnostics and focused tests.
Validation:
Provider-free adapter/runtime conformance plus existing races, final playback, output limits and evidence tests. Isolated PostgreSQL only if persistence behavior changed.
Visible demonstration:
Replay a fixture: interrupted old output stops, matching final played position is confirmed, and one new response begins.
Explicit stop/narrow condition:
No wholesale state-machine rewrite or generic provider-error suppression.
Deliver:
1. Scoped code/configuration and necessary tests/contracts where this phase requires implementation; Phase 0 remains an audit.
2. docs/evaluation/local-s2s/phase-01.md with exact commands, results, actual/simulated/unverified evidence, fingerprints, not-run checks and risks.
3. Updated docs/plans/local-s2s-adapter-progress.md with a candid acceptance verdict.
4. Exact demo instructions and rollback relevance. Preserve the operational provider unless this phase explicitly authorizes switching and session authorization exists.
Do not implement the next phase. Do not mark acceptance complete with mandatory live or human checks unrun.
```