64 lines
6.5 KiB
Markdown
64 lines
6.5 KiB
Markdown
# Phase 3 - Complete interruption, shared RAG and used sources
|
|
|
|
Copy this prompt into a fresh implementation session in the repository.
|
|
|
|
```text
|
|
Implement Phase 3 of the active FOUR-phase local S2S plan only: Complete interruption, shared RAG and used sources.
|
|
Do not execute the archived eight-stage prompts.
|
|
|
|
Prerequisite:
|
|
Phase 2 accepted. Local engine history ownership and compatibility gaps are understood; shared SearchService remains authoritative.
|
|
|
|
Required visible outcome:
|
|
The user interrupts and continues safely, receives correct document answers and sees only valid used sources; repeated interrupted searches are not duplicated.
|
|
|
|
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:
|
|
- 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.
|
|
|
|
Acceptance criteria:
|
|
- 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.
|
|
|
|
Relevant areas; verify actual paths first:
|
|
Local adapter and minimal pinned-engine repair extension, shared interruption contract/barriers, tool event mapping, existing dispatch/DurableTools and focused conformance/evaluation tests.
|
|
|
|
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.
|
|
|
|
Visible demo:
|
|
Interrupt before an unheard sentinel and inspect the subsequent LLM context; then ask hours, deputy and incentive questions, including a pending-search interruption/repeat.
|
|
|
|
Stop/narrow condition:
|
|
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.
|
|
|
|
Deliver scoped implementation/configuration/tests/contracts as necessary,
|
|
docs/evaluation/local-s2s/phase-03.md with exact commands and actual/simulated/
|
|
unverified outcomes, and an updated docs/plans/local-s2s-adapter-progress.md.
|
|
Provide demo steps, acceptance verdict, risks, not-run checks and rollback relevance.
|
|
Do not declare completion while mandatory real-provider/human checks are missing.
|
|
Do not implement the next phase or switch the operational provider implicitly.
|
|
```
|