# Phase 3 - Local provider and normal browser session Paste the following into a fresh implementation session in this repository. ```text Implement Phase 3 only: Local provider and normal browser session. Prerequisite: Phases 1 and 2 have accepted prerequisite evidence. Candidate app has disposable DB/storage. Required visible outcome: The existing browser opens a local_s2s session, greets in Persian, displays transcript and closes cleanly in isolation. 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. Add local_s2s to validated selection/factory/settings/readiness without removing openai/gemini or adding a UI selector. 2. Freeze engine/patch/contract revisions, effective component models, voice, speech policy, rates and instruction/config digest. Do not store secrets or secret hashes. 3. Compare reservation expectations with authoritative effective engine setup; do not rely on connection reachability or echoing desired values. 4. Map real input acceptance, response intent/identity, tool frames, terminal states and audio/transcript. Do not synthesize native commit acknowledgements from timing. 5. Keep browser PCM16LE mono24k and public events. Bound resampling and convert playback coordinates correctly. 6. Preserve owner/Origin/cookie/CSRF/replay/epoch checks and old profiles. Audit DB/DTO constraints; new migration only if necessary. 7. Use isolated DB/storage and separate test browser credentials/origin. Unsupported interruption fails closed until Phase 4. Acceptance criteria: - Ready/audio/transcript/close work end to end in the isolated app. - Incorrect profile, configuration, ownership or epoch is rejected; no snapshot rewrites. - Malformed terminals/disconnects cannot cause false success. - This remains development-only, not operational parity or a default switch. Relevant paths (verify actual locations before editing): configuration.py, settings.py, voice_provider.py, new local adapter, live admission/lifecycle only where required, .env.example and isolated deployment config. Validation: Provider-free adapter contract tests, isolated PostgreSQL admission/replay/profile/revocation, then bounded browser live smoke. Visible demonstration: Use the existing browser to greet and close. Show the local pinned profile and separate OpenAI conformance results. Explicit stop/narrow condition: Never use a second port with the operational DB. No promotion before interruption/RAG acceptance. 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-03.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. ```