docs(voice): consolidate local S2S roadmap into four phases
This commit is contained in:
@@ -11,7 +11,8 @@ text LLM and TTS through OpenRouter. Local orchestration is not offline inferenc
|
||||
Replacing individual stages with local models is a later independent optimization.
|
||||
|
||||
This is a plan, not authorization to switch the running application, download
|
||||
weights or perform unbounded paid evaluation. Each phase has a tangible demo,
|
||||
weights or perform unbounded paid evaluation. The original eight stages are consolidated into four phases without removing scope.
|
||||
Each phase has a tangible demo,
|
||||
acceptance criteria, evidence and a copy-ready English prompt. No phase has run.
|
||||
|
||||
## 2. Target architecture
|
||||
@@ -119,260 +120,152 @@ silently present it as exact heard-prefix preservation.
|
||||
lifecycle.reconcile_startup, which reconciles active sessions globally. A
|
||||
different HTTP port alone is not isolation.
|
||||
|
||||
## 5. Phase overview
|
||||
## 5. Four-phase roadmap
|
||||
|
||||
| Phase | Visible result | Operational effect |
|
||||
| Phase | Visible milestone | Previous stages combined |
|
||||
| --- | --- | --- |
|
||||
| 0 | Baseline and protocol compatibility report | None |
|
||||
| 1 | Existing OpenAI interruption replay still passes through the new boundary | None; refactor only |
|
||||
| 2 | Independent Persian audio -> text -> response -> playable audio demo | Isolated engine only |
|
||||
| 3 | Existing browser greets and closes through local_s2s | Isolated test API/database only |
|
||||
| 4 | Real interruption and coherent continuation; verified repaired history | No promotion until proof |
|
||||
| 5 | Document answers, retained search and correct source subset | Isolated end-to-end RAG |
|
||||
| 6 | Paired OpenAI/local quality, latency and cost scorecard | Promotion decision evidence |
|
||||
| 7 | Authorized deployment switch and demonstrated OpenAI rollback | Controlled opt-in switch |
|
||||
| 1 | OpenAI preserved through the provider boundary | Old 0 + 1 |
|
||||
| 2 | Local/OpenRouter voice works in the existing test browser | Old 2 + 3 |
|
||||
| 3 | Safe interruption plus full shared RAG and sources | Old 4 + 5 |
|
||||
| 4 | Quality/cost decision and verified deployment rollback | Old 6 + 7 |
|
||||
|
||||
Phases run in order. Phase 2 engine preparation may proceed independently of Phase
|
||||
1 when it does not depend on application changes. Never accept a later gate merely
|
||||
because code exists. Do not combine the OpenAI refactor and operational switch.
|
||||
Only these four phases and their four prompts are active. The original version is
|
||||
[archived](archive/local-s2s-eight-phase/README.md) for traceability. No implementation
|
||||
phase has started, so this consolidation changes planning only. Required internal
|
||||
checkpoints remain acceptance conditions inside each phase, not separate execution
|
||||
phases. The preserved OpenAI path remains the fallback chosen by the operator.
|
||||
|
||||
## 6. Phase 0 - Baseline and immutable upstream audit
|
||||
## Phase 1 - Preserve OpenAI and introduce the provider boundary
|
||||
|
||||
**Visible outcome:** Open a report showing OpenAI baseline, upstream support,
|
||||
required changes and proof tests side by side. Replay an existing offline trace.
|
||||
**Visible outcome:** An existing OpenAI session still works; an offline before/after interruption replay proves the same cleanup and next-turn behavior.
|
||||
|
||||
**Entry:** No adapter implementation has started. Inspect the current repository and deployment first.
|
||||
|
||||
**Work:**
|
||||
- Read applicable instructions, reference map and governing API/database/workflow
|
||||
sections. Inspect current source and deployment; historical defaults are stale.
|
||||
- Record active/preserved container IDs, image digests, selected profile, ports and
|
||||
storage mounts without keys/full environment dumps. Do not recreate containers.
|
||||
- Pin an upstream SHA and build inputs; record license and patch policy.
|
||||
- Audit effective session config, input acceptance, VAD/commit boundaries, manual
|
||||
response control, metadata/identity, tools, audio rates, terminal states,
|
||||
transcripts, cancellation and history repair against actual source/tests.
|
||||
- Run focused baseline tests; distinguish existing failures from new defects.
|
||||
- Prepare Persian fixture questions and expected answers against an authorized
|
||||
frozen test corpus. Record outstanding product/implementation decisions.
|
||||
|
||||
**Accept when:** baseline/rollback identities exist; each required behavior is
|
||||
verified, requires a specified patch, or is explicitly unverified; every live
|
||||
prerequisite is visible. No runtime/data changes occurred.
|
||||
- Capture current/preserved container and image identities, effective provider/profile and focused regression results. Keep the operational deployment unchanged.
|
||||
- Pin an upstream commit/build inputs and audit actual setup, input consumption, manual turn control, metadata/identities, tool events, audio rates, terminal states and history repair.
|
||||
- Record a compatibility matrix and unresolved decisions, especially the no-op truncate and completed-but-unplayed history case.
|
||||
- Extract only the small internal provider boundary needed by runtime. Runtime owns authorization, turn identity, playback credits, deadlines, evidence lifetime and next-turn release; adapters own native wire/confirmation details.
|
||||
- Keep native OpenAI cancel/terminal/truncate/ack semantics, raw replay fingerprints and correlation intact. Preserve Gemini's conservative failures.
|
||||
- Define correlated interruption progress with separate generation-stop and actual history-repair proof. Capability flags never waive safety gates.
|
||||
- Add controlled-clock replay/conformance coverage and document the internal responsibility split without changing public browser behavior.
|
||||
|
||||
**Stop/narrow:** unknown upstream behavior remains unknown. Missing credentials
|
||||
block live checks, not read-only inspection or deterministic preparation.
|
||||
**Accept when:**
|
||||
|
||||
**Prompt:** [Phase 0](local-s2s-adapter-prompts/phase-00.md).
|
||||
- Existing OpenAI regressions retain their assertions and pass; pre-existing failures are reported honestly.
|
||||
- The same fixture before/after refactoring releases exactly one new response after matching cleanup, with wrong/missing/late/conflicting acknowledgements failing safely.
|
||||
- Upstream SHA/build provenance, compatibility gaps and original rollback identities are recorded.
|
||||
- No runtime switch, production data change, wholesale rewrite or model/voice branch in shared turn control.
|
||||
|
||||
## 7. Phase 1 - Small provider boundary, OpenAI preserved
|
||||
**Show the user:** Run an existing OpenAI interaction if already authorized, and show a deterministic interruption trace through the new boundary. No new provider is enabled.
|
||||
|
||||
**Visible outcome:** Replay the same interruption before/after extraction: old
|
||||
output stops, the same played position is respected and exactly one next response
|
||||
is released. OpenAI remains the selected provider.
|
||||
**Validation:** Existing context-sync, provider-selection, retained-search, source-report, output-limit and style tests; controlled-clock replay. Isolated PostgreSQL acceptance if persisted profile/lifecycle behavior is touched.
|
||||
|
||||
**Work:**
|
||||
- Implement minimal typed operations/events; runtime keeps turn/authority/release,
|
||||
playback bounds and evidence state. Adapters own provider wire interpretation.
|
||||
- Move OpenAI native cancel/terminal/truncate mechanics behind the boundary without
|
||||
changing semantics. Do not lose raw event fingerprints/correlation on normalization.
|
||||
- Represent interruption with an operation ID, response/item/session identity,
|
||||
generation-stop and applied-history progress, and finite deadlines.
|
||||
- Do not introduce capability switches that waive cleanup. Unsupported capabilities
|
||||
reject admission or fail safely. Preserve Gemini's conservative behavior.
|
||||
- Add controlled-clock replay and regression tests. Document the internal contract
|
||||
amendment; browser wire contracts remain unchanged.
|
||||
|
||||
**Accept when:** existing OpenAI tests retain assertions and pass; terminal/error
|
||||
orderings, missing/wrong acknowledgements, duplicates, late events, incomplete
|
||||
responses and bounds remain covered. Shared control has no model/voice branches.
|
||||
Run isolated PostgreSQL cases if persisted profiles/lifecycle behavior is touched.
|
||||
|
||||
**Stop/narrow:** no full runtime rewrite or blanket provider-error suppression.
|
||||
**Stop/narrow:** Unknown upstream behavior stays unverified. Do not weaken OpenAI or start a deployment switch to make the new boundary easier.
|
||||
|
||||
**Prompt:** [Phase 1](local-s2s-adapter-prompts/phase-01.md).
|
||||
|
||||
## 8. Phase 2 - Isolated engine with OpenRouter stages
|
||||
## Phase 2 - Add an isolated local stack and browser voice session
|
||||
|
||||
**Visible outcome:** Submit a Persian recording to the independent smoke, inspect
|
||||
its explicitly requested test transcript, hear a WAV response and see stage usage
|
||||
and timing. The application remains untouched.
|
||||
**Visible outcome:** The existing browser talks in Persian through local_s2s using OpenRouter STT/LLM/TTS, displays transcripts and closes normally in a disposable environment.
|
||||
|
||||
**Entry:** Phase 1 accepted. Isolated engine and candidate API use disposable DB/storage, not the operational database.
|
||||
|
||||
**Work:**
|
||||
- Build the pinned engine in a separate image/environment with local VAD, HTTP
|
||||
STT, Chat Completions LLM and HTTP TTS. No default local model downloads.
|
||||
- Discover/pin available models/voices and validate Persian hints, tool support,
|
||||
endpoint fields, rates and audio formats. Models are independently configurable.
|
||||
- Keep the key inside the engine. Custom endpoints must not accidentally receive
|
||||
another provider's credentials. Keep engine access behind the application boundary.
|
||||
- Start with final-utterance STT, not cumulative HTTP retranscription.
|
||||
- Verify actual multipart/JSON STT and TTS stream_format/PCM compatibility; add only
|
||||
a narrow observed-mismatch shim if necessary.
|
||||
- Bound and meter startup probes, generation, response sizes, retries/concurrency
|
||||
and close. Provide deterministic stubs and an opt-in bounded live smoke.
|
||||
|
||||
**Accept when:** with live prerequisites all stages complete and audio is valid;
|
||||
otherwise mark live-pending. Bad key/model/voice/rate fails setup accurately. Save
|
||||
sanitized timing/usage and consented fixture outputs, not secrets or raw user logs.
|
||||
- Build a separate engine from the pinned SHA with local VAD and independently configured OpenRouter HTTP STT, tool-capable Chat Completions LLM and TTS. Avoid unnecessary local-model/GPU downloads.
|
||||
- Discover/pin actual model IDs, voices, Persian hints, supported fields and PCM rates. Verify multipart/JSON STT, TTS streaming/format compatibility and explicit server-side credential forwarding.
|
||||
- Begin with final-utterance STT. Bound requests/concurrency/bytes/retries/cleanup and meter startup probes. Provide stub mode plus an explicitly opt-in bounded live smoke and playable test audio.
|
||||
- Add local_s2s settings/factory/readiness alongside openai/gemini. Preserve the browser PCM16LE mono24k and existing JSON events; use bounded stateful resampling if required.
|
||||
- Freeze engine/patch/contract revision, component identities, voice/input policy and effective instruction/config digest. Compare to authoritative engine state, not request echoes or socket reachability.
|
||||
- Map actual input acceptance, manual response creation/intent, tool framing, terminal/error and transcript/audio semantics without invented native commit events.
|
||||
- Preserve owner/Origin/cookie/CSRF/replay/epoch checks and old snapshots. Audit provider DTO/DB constraints; use a forward migration only if actually needed and compatible with rollback.
|
||||
- Use a separate test hostname/browser identity and disposable DB/storage. Until Phase 3, interruptions must fail safely and be labelled development-only; do not enable unsafe continuation.
|
||||
|
||||
**Stop/narrow:** do not install every optional model/GPU dependency. Credential or
|
||||
model availability gaps do not authorize fabricated success.
|
||||
**Accept when:**
|
||||
|
||||
- A normal browser greeting/answer/transcript/close works against the isolated candidate, and independent stage probes produce valid audio.
|
||||
- Model/voice/rate/credential/effective-config mismatches fail setup accurately; keys and secret-derived hashes never enter profiles or logs.
|
||||
- Existing OpenAI remains usable; new configuration does not rewrite old reservations or change the operational provider.
|
||||
- Actual provider checks are distinguished from stubs. Missing credentials or real speech evidence leaves live acceptance pending.
|
||||
|
||||
**Show the user:** Show a recorded Persian utterance becoming a WAV response, then perform a normal greeting in the existing browser against the isolated candidate.
|
||||
|
||||
**Validation:** HTTP boundary fixtures, pinned-engine relevant tests, local adapter contract tests, isolated PostgreSQL profile/admission/replay/revocation cases and bounded actual browser/provider smoke.
|
||||
|
||||
**Stop/narrow:** A different port is not DB isolation. Do not claim safe barge-in or production parity before Phase 3; do not promote this provider.
|
||||
|
||||
**Prompt:** [Phase 2](local-s2s-adapter-prompts/phase-02.md).
|
||||
|
||||
## 9. Phase 3 - Local adapter and normal browser session
|
||||
## Phase 3 - Complete interruption, shared RAG and used sources
|
||||
|
||||
**Visible outcome:** In an isolated test app, open the existing browser, say hello,
|
||||
hear a Persian answer, see a transcript, and close cleanly. Show a local_s2s pinned
|
||||
profile. This milestone is development-only, not production parity.
|
||||
**Visible outcome:** The user interrupts and continues safely, receives correct document answers and sees only valid used sources; repeated interrupted searches are not duplicated.
|
||||
|
||||
**Entry:** Phase 2 accepted. Local engine history ownership and compatibility gaps are understood; shared SearchService remains authoritative.
|
||||
|
||||
**Work:**
|
||||
- Add local_s2s configuration/factory selection while keeping openai/gemini.
|
||||
- Freeze engine/patch revision, internal protocol revision, STT/LLM/TTS identities,
|
||||
voice, input policy, rates and effective instruction/config digest. No secrets
|
||||
or credential-derived hashes belong in database execution profiles.
|
||||
- Define the expected configuration and compare to authoritative engine state.
|
||||
A reachable socket or echoed request is insufficient setup proof.
|
||||
- Map actual consumed input, manual response identity/metadata, audio/transcript,
|
||||
terminal and tool events. No invented native commits/acknowledgements.
|
||||
- Preserve browser 24 kHz PCM; use stateful bounded conversion where required,
|
||||
including correct playback-position units.
|
||||
- Preserve owner/Origin/cookie/CSRF/replay/epoch checks. Inspect schema/DTO/provider
|
||||
constraints; use a new migration only if necessary, never edit an applied one.
|
||||
- Use disposable database/storage and isolated test browser identity/origin.
|
||||
Until Phase 4, unsupported interruption must fail safely and be labelled as such.
|
||||
|
||||
**Accept when:** ready/audio/transcript/close work; bad configuration, wrong owner,
|
||||
old epoch, mismatched profile, malformed terminal and disconnect cannot pass
|
||||
silently. Existing profiles are not rewritten; a new session pins new settings.
|
||||
- First implement/prove local interruption and history synchronization. Patch/version the pinned engine narrowly if it cannot apply the required real mutation.
|
||||
- Cover active generation AND already-completed generation with queued unplayed audio. Track operation/response/item/segment/session identities and actual played coordinates.
|
||||
- Inspect the next real controlled LLM request: unheard assistant sentinel text must be absent while valid previous user/tool/assistant context remains. Do not infer text alignment from duration/character ratios.
|
||||
- Accept only receipts emitted after the actual mutation with applied history revision/provenance. Missing, wrong, stale or conflicting receipts fail within bounded deadlines; runtime retains release authority.
|
||||
- If exact heard-prefix repair is unproven, keep the gate open. Whole-turn rollback or fully-played-segment retention is a weaker policy requiring explicit acceptance and contract documentation.
|
||||
- Suppress obsolete STT/LLM/TTS outputs even if remote inference keeps computing. Keep backend retained retrieval separate from speech cancellation and preserve original deadlines.
|
||||
- Then expose search_knowledge, reuse_last_evidence and report_used_sources through the existing backend dispatcher/ToolContext/DurableTools/SearchService; never add engine DB authority or a parallel RAG implementation.
|
||||
- Preserve successful-terminal tool validation, call/item/response dedup, backend scope, calibrated eligible retrieval, source identities and handoff/delivery revalidation.
|
||||
- Test current-turn source reports, private invalid-report correction, no_evidence versus technical error, knowledge revocation, topic switch and interrupted pending-search reuse.
|
||||
- Evaluate known hours/fees, deputy name/organization and incentive percentage/date/exclusion failures. Correct citations alone do not prove correct answer content.
|
||||
|
||||
**Stop/narrow:** a second port with the same operational DB is prohibited. No
|
||||
promotion or hidden fallback before interruption and RAG gates.
|
||||
**Accept when:**
|
||||
|
||||
- No next response before generation-stop, real context repair and playback gates. Active and completed-unplayed history tests pass without fabricated acknowledgement events.
|
||||
- Missing/wrong receipts fail safely; late output cannot contaminate a new turn or reused session; OpenAI interruption regressions remain intact.
|
||||
- All three tools execute through existing authority; no stale/revoked/inactive/deleted evidence reaches reuse/delivery.
|
||||
- Repeating an interrupted same-topic question uses one original retrieval plus revalidation, with valid used-source subset. Known critical document fixtures are answered correctly.
|
||||
|
||||
**Show the user:** Interrupt before an unheard sentinel and inspect the subsequent LLM context; then ask hours, deputy and incentive questions, including a pending-search interruption/repeat.
|
||||
|
||||
**Validation:** Controlled-clock/history-inspection/late-event tests; all affected OpenAI tests; existing retained-search/source suites extended to local; isolated DB evidence/revocation acceptance; bounded real barge-in and RAG checks.
|
||||
|
||||
**Stop/narrow:** This phase has two required checkpoints: history safety before dependent continuation tests, then shared RAG. They are not extra phases, and neither can be skipped or accepted from stopped playback alone.
|
||||
|
||||
**Prompt:** [Phase 3](local-s2s-adapter-prompts/phase-03.md).
|
||||
|
||||
## 10. Phase 4 - Verified interruption and history repair
|
||||
## Phase 4 - Validate quality/cost and prove controlled switch/rollback
|
||||
|
||||
**Visible outcome:** Interrupt a long answer, ask a follow-up, and get a coherent
|
||||
reply without stale audio. In a controlled test, show the actual next LLM input
|
||||
contains no unheard sentinel that was generated later in the interrupted answer.
|
||||
**Visible outcome:** A paired OpenAI/local scorecard supports the deployment decision, and the preserved OpenAI container is demonstrably restorable without rebuild.
|
||||
|
||||
**Entry:** Phase 3 accepted. Frozen corpus/model profiles, bounded live evaluation authorization and reviewable deployment/rollback configuration are available.
|
||||
|
||||
**Work:**
|
||||
- Implement a real correlated engine operation/extension if the pinned version
|
||||
cannot repair history. Keep a reproducible versioned patch with independent tests.
|
||||
- Cover active generation AND completed generation with unplayed buffered audio.
|
||||
- Track item/response/segment/session identities, final consumed position and
|
||||
reliable assistant text/audio alignment. Never use character/duration ratios.
|
||||
- Keep valid prior turns/user/tool state; remove unheard assistant continuation
|
||||
from future generation input. Expose applied history revision/digest as proof.
|
||||
- If exact repair is unavailable, stop this acceptance gate. Conservative whole-turn
|
||||
rollback or fully-played-segment-only history needs explicit policy acceptance.
|
||||
- Admit a receipt only after mutation; reject stale, conflicting, wrong-identity
|
||||
or missing receipts. Runtime retains deadlines and final authority to continue.
|
||||
- Suppress late STT/LLM/TTS results even if remote computation cannot be cancelled.
|
||||
Keep latest backend retrieval independent from speech cancellation.
|
||||
- Repeat OpenAI regressions; the new local proof must not weaken native OpenAI gates.
|
||||
|
||||
**Accept when:** no next turn before generation stop, real repair and playback gates;
|
||||
active and completed-unplayed cases pass; late work cannot reach another turn;
|
||||
missing/wrong proof fails safely. No fake conversation.item.truncated event.
|
||||
- Run paired Persian fixtures with the same authorized corpus and expected facts: names/roles, numbers/dates/conditions, noise/pauses/corrections, ambiguity, no evidence, follow-up and topic switch.
|
||||
- Measure first audible response after speech end, tool time, interruption stop, underruns, duplicates, disconnects and successful tasks. Count actual model usage, STT duration, TTS units, startup/failure/abandoned work; unknown cost stays unknown.
|
||||
- Fault-test quota, slow/down endpoints, partial stream loss, restart, saturation and teardown; no unbounded queues, retry storms or stale output. Use human listening separately from deterministic checks.
|
||||
- Set/accept thresholds before evaluation. Provisional targets: zero critical factual fixture errors, p95 first-audible latency <= baseline + 1 second, no persistent underruns and cost per successful task <= 70% baseline for cost-saving promotion.
|
||||
- Change one component at a time and report failures honestly. If quality/cost targets fail, keep OpenAI rather than silently changing thresholds or padding buffers.
|
||||
- Finalize opt-in Compose, .env.example and operator runbook. Keep original container/image/config intact and separately tag candidate. Check any schema change against the old image; incompatible schema blocks simple rollback.
|
||||
- Complete all reviewable preparation before operational switching. With explicit authorization, drain/close sessions, stop current API, then start candidate on operational DB. Never run both APIs against it simultaneously.
|
||||
- Verify fresh-session greeting, RAG, sources, interruption and close; actually stop candidate/start preserved OpenAI without rebuild and verify a fresh baseline session.
|
||||
- Leave final provider as explicitly requested. Record IDs/digests/commands/checks and limitations; container rollback is not DB/filesystem rollback or seamless media resume.
|
||||
|
||||
**Stop/narrow:** this is the highest-risk phase. Audio stopping or a stock-SDK
|
||||
compatibility claim does not prove our context semantics. Keep promotion blocked.
|
||||
**Accept when:**
|
||||
|
||||
- Required paired factual, human-quality, failure and resource checks have actual evidence and sample counts; missing live checks block promotion.
|
||||
- Cost-saving claims include failed/abandoned/startup usage; model pricing alone is not measured service savings.
|
||||
- Original OpenAI restoration has actually succeeded and users/ingestion data are preserved. One API owns the operational lifecycle at a time.
|
||||
- Final provider is explicitly recorded. Without switch authorization, prepare the result and remain operationally unchanged rather than claiming deployment completion.
|
||||
|
||||
**Show the user:** Play paired Persian name/date clips and show the scorecard. If authorized and accepted, demonstrate local RAG then OpenAI rollback without rebuilding the preserved container.
|
||||
|
||||
**Validation:** Focused/provider-free tests, isolated PostgreSQL acceptance, controlled faults, authorized paired real-provider checks and human listening; config/image inspection and controlled fresh-session switch/rollback.
|
||||
|
||||
**Stop/narrow:** Quality/cost evidence and explicit operational switch authorization are separate gates within this phase. Prepare independent work but do not bypass either.
|
||||
|
||||
**Prompt:** [Phase 4](local-s2s-adapter-prompts/phase-04.md).
|
||||
|
||||
## 11. Phase 5 - Existing RAG tools and used sources
|
||||
|
||||
**Visible outcome:** Ask hours/Thursday, the planning deputy in the specific letter,
|
||||
and the incentive percentage/dates/exclusions. Interrupt a pending search and
|
||||
repeat the question; show one retrieval plus revalidation and relevant UI sources.
|
||||
|
||||
**Work:**
|
||||
- Expose search_knowledge, reuse_last_evidence and report_used_sources to the new
|
||||
LLM. Execute through existing dispatch/ToolContext/DurableTools/SearchService.
|
||||
- Preserve backend identity, calibrated retrieval, document/chunk references and
|
||||
handoff/delivery eligibility. Engine gets no independent retrieval path.
|
||||
- Validate streamed arguments after successful terminal validation; correlate
|
||||
response/item/call identities and deduplicate repeats/replays.
|
||||
- Reuse same-topic pending results within original deadline, revalidate, and discard
|
||||
changed-topic results. Never use earlier assistant prose as document evidence.
|
||||
- Validate current-turn source labels and correct invalid reports privately. Do
|
||||
not show every candidate or persist metadata reports as extra retrievals.
|
||||
- Exercise ok/no_evidence/error, token-limited tools, interrupted delivery,
|
||||
revocation/deactivation and all known Mini factual failure cases.
|
||||
|
||||
**Accept when:** all three tools retain existing authority; no stale evidence or
|
||||
extra retrieval on same-topic reuse; used subset has original document/chunk
|
||||
identity. Correct citation membership is not claimed as full factual verification.
|
||||
|
||||
**Stop/narrow:** no weakened cutoff/filter or second search implementation to hide
|
||||
model-quality problems.
|
||||
|
||||
**Prompt:** [Phase 5](local-s2s-adapter-prompts/phase-05.md).
|
||||
|
||||
## 12. Phase 6 - Persian quality, latency, cost and resilience
|
||||
|
||||
**Visible outcome:** A paired OpenAI/local scorecard and audio samples show the
|
||||
actual trade-off. Demonstrate a controlled provider failure without contamination.
|
||||
|
||||
**Work:**
|
||||
- Evaluate the same authorized frozen corpus and paired Persian audio/question
|
||||
fixtures. Keep exact baseline/candidate component profiles and sample counts.
|
||||
- Cover names/roles, numbers/dates, natural pauses, noise, self-correction,
|
||||
ambiguity, continuation, topic switch, no evidence and document conflicts.
|
||||
- Measure speech-end-to-first-audible-sample, tool time, first text/audio,
|
||||
interruption-to-stop, underruns, duplicates, disconnects and task completion.
|
||||
- Count cached/input/output usage when available, STT duration, TTS billed units,
|
||||
startup probes, failures and abandoned work. Missing usage stays unknown. Compare
|
||||
cost per successful task, not only successful API requests.
|
||||
- Fault-inject slow/down providers, quotas, stream loss, restart and saturation.
|
||||
Prove bounded queues, late-result suppression and no stacked retry storms.
|
||||
- Change one component at a time. Human listening is separate from transport tests;
|
||||
do not claim that a better LLM repairs bad transcription.
|
||||
|
||||
**Accept when:** all critical factual fixture assertions pass with zero invented
|
||||
names/numbers/dates/conditions; all intended interruption cases pass or fail safely
|
||||
as specified; results assess predeclared targets and expose all failures.
|
||||
|
||||
Provisional goals, to accept or revise explicitly BEFORE evaluation: p95 first
|
||||
audible response <= baseline + 1 second, no persistent underruns, and cost per
|
||||
successful task <= 70% of baseline for a cost-saving promotion. These are targets,
|
||||
not measurements or universal guarantees. If quality/cost goals fail, keep OpenAI.
|
||||
|
||||
**Stop/narrow:** missing actual provider/human evidence leaves the gate open. Do
|
||||
not broaden prompts/buffers or silently change thresholds after seeing results.
|
||||
|
||||
**Prompt:** [Phase 6](local-s2s-adapter-prompts/phase-06.md).
|
||||
|
||||
## 13. Phase 7 - Controlled switch and demonstrated rollback
|
||||
|
||||
**Visible outcome:** Demonstrate a local document interaction, then stop the
|
||||
candidate, start the preserved OpenAI API without rebuild, and repeat the question.
|
||||
Leave the selected provider in the final state explicitly requested by the user.
|
||||
|
||||
**Work:**
|
||||
- Finalize opt-in Compose and .env.example; OpenAI stays default until an explicit
|
||||
operational switch. No automatic fallback or UI provider selector.
|
||||
- Verify original container/image/config retention. Candidate gets separate tags;
|
||||
never prune, remove, overwrite or rebuild the original rollback target.
|
||||
- Check effective setup, health, secrets, bounds and database compatibility before
|
||||
switching. An incompatible migration blocks simple old-container rollback.
|
||||
- Drain/close current sessions, stop the existing API, then start the candidate on
|
||||
the operational DB. Never two application APIs against that DB simultaneously.
|
||||
- Test a fresh browser session: greeting, RAG, used sources, interruption and close.
|
||||
- Actually exercise rollback and verify readiness plus a fresh OpenAI session.
|
||||
Container rollback is not database/filesystem rollback or media-session resume.
|
||||
- Record commands, identities, fingerprints, checks, final state and limitations.
|
||||
|
||||
**Accept when:** preserved OpenAI restoration succeeds; user/ingestion data is
|
||||
preserved; one API owns the operational lifecycle at a time; session profiles stay
|
||||
pinned. Health readiness alone is not speech/RAG acceptance.
|
||||
|
||||
**Stop/narrow:** prepare all reviewable work first. Without the operational switch
|
||||
authorization, compatibility or live evidence, stop before changing the service.
|
||||
|
||||
**Prompt:** [Phase 7](local-s2s-adapter-prompts/phase-07.md).
|
||||
|
||||
## 14. Configuration, data and deployment contract
|
||||
## 6. Configuration, data and deployment contract
|
||||
|
||||
Proposed names below must be finalized before implementation and documented with
|
||||
units/defaults. Do not create unvalidated option bags or leak credentials to LLMs.
|
||||
@@ -398,10 +291,10 @@ credentials with matching trusted Origin. Do not copy production auth sessions
|
||||
into a parallel test browser. Operational switching runs only one application API.
|
||||
|
||||
No schema migration is assumed. Inspect provider constraints/DTOs/profile replay
|
||||
in Phases 0/3; use a new migration only if required and verify rollback image
|
||||
in Phases 1/2; use a new migration only if required and verify rollback image
|
||||
compatibility. Do not add document_versions/version_id/version_no.
|
||||
|
||||
## 15. Validation commands and evidence
|
||||
## 7. Validation commands and evidence
|
||||
|
||||
Verify paths and side effects at execution time. Focused baseline command:
|
||||
|
||||
@@ -440,11 +333,11 @@ Only accepted closes a required gate. Missing paid authorization blocks dependen
|
||||
live work, not independent preparation. Reuse existing bounded authorization; do
|
||||
not ask the user to approve the same action repeatedly.
|
||||
|
||||
## 16. Decisions to resolve and definition of done
|
||||
## 8. Decisions to resolve and definition of done
|
||||
|
||||
- Upstream SHA, dependency/build lock and maintained patch provenance: Phase 0.
|
||||
- Effective profile/config attestation and concurrent engine isolation: Phase 3.
|
||||
- Real heard-prefix mapping/receipt: Phase 4 hard gate; weaker policy requires an
|
||||
- Upstream SHA, dependency/build lock and maintained patch provenance: Phase 1.
|
||||
- Effective profile/config attestation and concurrent engine isolation: Phase 2.
|
||||
- Real heard-prefix mapping/receipt: Phase 3 hard gate; weaker policy requires an
|
||||
explicit product decision and intentional API/workflow documentation.
|
||||
- Available OpenRouter models/voices, Persian quality, hardware footprint and
|
||||
latency/cost: measure, do not infer from default local-model examples.
|
||||
|
||||
Reference in New Issue
Block a user