Files
rag-technical-docs-assistant/docs/plans/live-conversation-repair-progress.md
amirhosein mazaheri 18e595ac93 fix(voice): preserve interrupted searches and report used sources
Retain and revalidate interrupted searches, resolve abandoned provider calls, recover invalid source reports privately, and expose only declared sources. Improve Persian delivery and provider event replay capacity. Include regression coverage and contract updates.
2026-10-13 14:09:20 +03:30

972 lines
66 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Live conversation repair handoff
Date: 2026-10-12
Status: **Paused at the user’s request on 2026-10-12; resume acceptance on
2026-10-13.** Start with [the next-session checklist](live-conversation-repair-next-session.md).
The sections through “Where to resume” preserve the original pause checkpoint.
The final checkpoint and next-session checklist supersede historical
working-tree and acceptance status. This remains a progress record, not
completion or release acceptance of [the repair plan](live-conversation-repair-plan.md).
## Repositories and scope
- Backend: `D:\raymand\projects\rag-technical-docs-assistant`
- Frontend: `D:\raymand\projects\faq_chatbot_frontend`
- Both working trees were clean before this repair began. The changes listed below are uncommitted. No migrations, provider calls, deployment, or PostgreSQL tests were performed.
## What changed
### Backend
- **Issue 1, continuous speech:** `RuntimeSettings.max_input_buffer_bytes` is now fixed at 3,072,000 bytes (64 seconds at 24 kHz PCM16), and an independent, fixed 65-second speech-stop deadline replaces the old deadline derived from the byte bound. The 96,000-byte transport queue and input offset/commit logic remain. The API contract, operator guide, and `.env.example` were aligned. Tests now exercise 10, 30, and 60 seconds with four seconds of padding, hard-bound exhaustion, late starts, missing stop/commit, and transport saturation.
- **Issue 8, already-ended cancellation:** the exact `invalid_request_error` / `response_cancel_not_active` / null-param classifier now also accepts `gpt-realtime-2.1/shimmer`. Other model/voice pairs and signatures remain rejected. Runtime event-ID, response terminal, and truncation gates were not relaxed. A guide addendum records the observed profile and limits of that evidence.
- **Issue 12, cleanup:** route child-task and runtime worker termination waits are bounded. Runtime close retains one shared owner; provider graceful-close expiry attempts the existing transport's abort capability through each adapter. Cleanup diagnostics record pending task count and abort result. The route still attempts terminal persistence and registry release after a task timeout. A regression covers a task that resists cancellation while preserving the original failure.
- The backend edits are in `app/modules/voice/{settings,runtime,diagnostics}.py`, `app/infrastructure/{realtime,gemini_live}.py`, `app/api/v1/live.py`, `.env.example`, the API catalog and two guides, plus the three affected unit-test files.
### Frontend
- **Issue 5, premature listening:** normal completion no longer uses the 700 ms idle heuristic or a completed transcript alone. It requires a matching `audio_ended` and a worklet idle event for the audio reference. Idle while generation remains open is treated as an underrun. Duplicate final transcripts no longer re-flush playback.
- **Issue 4, accounting instrumentation:** the existing `audio_ended.sent_bytes` field is typed and validated when present. The service compares sent and received bytes at sealing, then compares sent bytes with worklet-reported consumed milliseconds at drain, allowing for the sub-millisecond reporting remainder. It logs bounded numeric discrepancies; it does not yet establish or repair the cause of the reported audio/text mismatch.
- Audio-reference tagging now passes through the playback worklet and engine. Duplicate `audio_started` events no longer reset byte accounting; stale seals and old-turn interruptions are guarded. The remaining 700 ms timer is limited to a limited response with no audio reference.
- **Issues 6 and 7** were already implemented in the clean frontend baseline: limited-answer rendering and final transcript snapshot replacement. Their existing tests were exercised; no new implementation for those items was needed in this pass.
- Frontend edits are under `src/app/services/voice-stream/` and `public/assets/worklets/pcm-playback.worklet.js`, including tests. No other frontend paths were edited.
## Plan position
| Plan item | Position at pause |
| --- | --- |
| 1. 60-second speech | Code and targeted regressions pass; real microphone/provider acceptance pending. |
| 2. Choppy audio | Open. No correlated provider-to-worklet trace or prebuffer comparison yet. |
| 3. Complete initial answers | Open. Existing style already requests concise completeness, but the 256-token budget was not changed or evaluated. |
| 4. Audio shorter than text | Instrumentation only. No measured discrepancy attribution or root-cause fix. |
| 5. Premature listening | Code and focused frontend regressions pass; browser playback acceptance pending. |
| 6. Limited answer UI | Present in baseline and focused tests pass; browser acceptance pending. |
| 7. Repeated final text | Present in baseline and focused tests pass; browser acceptance pending. |
| 8. Cancellation race | Narrow classifier change and targeted tests pass; same-connection provider acceptance pending. |
| 9. Cancellation acknowledgement deadline | Open. No timing trace or root-cause fix. |
| 10. Same-topic evidence reuse | Open. No contract amendment, reuse tool, authorization/revision recheck, or PostgreSQL tests were implemented. Current fresh-retrieval rule remains. |
| 11. Longer output capacity | Open. The 30-second bound remains; the proposed 120-second OpenAI bound and token budgets were not measured or selected. |
| 12. Cleanup timeout | Backend code and targeted tests pass; blocked-transport/ASGI and real-provider acceptance pending. |
The plan's diagnostic prerequisite is only partly met. The new audio counters and cleanup numbers do not provide a full provider-to-browser timeline, underrun duration, or cancellation enqueue/dispatch/terminal trace.
## Checks actually run
- Backend focused command: `.venv/Scripts/python -m pytest tests/unit/test_voice_input_accounting.py tests/unit/test_live_context_sync.py tests/unit/test_voice_session_incident.py tests/integration/test_voice_session_incident.py -m "not postgres" -q -p no:cacheprovider` — **69 passed, 11 PostgreSQL cases deselected**.
- Frontend focused command: `npm.cmd test -- --watch=false --include=src/app/services/voice-stream/voice-stream.service.spec.ts --include=src/app/services/voice-stream/voice-event.validator.spec.ts --include=src/app/services/voice-stream/pcm-playback.worklet.spec.ts` — **81 passed**.
- `npm.cmd run build` — passed; existing `moment-jalaali` CommonJS optimization warning.
- Backend broad suite: one parallel run reported failures and was interrupted after stalling near its end. A solo `-x` rerun stopped at the unchanged `test_transport_capacity_survives_timeout_and_recovers_without_late_results[False]` 50 ms timing case after **755 passed, 1 skipped**. Both cases of that test passed when rerun alone. **No clean broad-suite result is claimed.**
- Frontend full suite was run before the final duplicate-flush test assertion was updated: **137 passed, 6 failed**. One failure expected the removed duplicate flush and passes in the later 81-test focused run. The other five were outside edited voice paths: three `localStorage` failures in app/auth/theme tests and two call-center/chat-question rendering assertions. The full suite was not rerun after the correction.
- `git diff --check` passed in both repositories. Git printed only LF/CRLF working-copy notices.
`TEST_DATABASE_URL` was absent. PostgreSQL acceptance, actual browser/microphone playback, same-connection provider runs, and the plan's 20-question answer-quality benchmark have not been performed. Synthetic tests and the build do not establish release readiness.
## Where to resume
1. Review the uncommitted diffs in both repositories and run `git diff --check` again. Preserve these edits; do not treat the handoff as a commit or a completed rollout.
2. Finish and test the remaining cleanup and audio-accounting edge cases, especially unresponsive real transport abort, route finalization, and real worklet consumption at 24/44.1/48 kHz. Keep issue 4 open until an actual trace identifies the first loss point.
3. Instrument and reproduce issues 2 and 9 on the same live connection. Compare fixed 80/120/160/240 ms prebuffer traces; retain the five-second cancellation deadline unless internal blocking is demonstrated.
4. Implement issue 10 as an explicit contract change with session-local evidence, backend-owned eligibility/owner/access-epoch/knowledge-revision revalidation, real source identities, and isolated PostgreSQL tests. Do not infer validity from the current epoch alone.
5. Evaluate issues 3 and 11 together using the plan's fixed 20-question set and measured 512/1024/2048/4096-token candidates. Only then select the OpenAI reservoir and generation budget; keep Gemini bounds separate.
6. Run focused and broad checks again, followed by the plan's browser/provider same-connection acceptance. Record implementation, synthetic checks, and real acceptance separately for each issue.
The active work immediately before the pause was the final diff/contract check. That check returned clean whitespace results and the file inventories above; no further implementation was started.
## Resumption checkpoint — 2026-10-12
The user resumed work and selected the frontend repository
`/home/moz/Projects/raymand/projects/faq_chatbot_frontend`, branch
`feat/backend-changes`. At this resumption the backend handoff repairs were
already committed in `9e6864a`, and the frontend lifecycle/accounting repairs were
present in `58c3c20`. The earlier review of the other frontend branch does not
describe this branch. The new changes below are uncommitted in both repositories;
the backend's unrelated untracked `.aws` entry was preserved.
### Implemented during resumption
- **Issues 2/4/9 diagnostic prerequisite:** optional numeric backend timing
(`LIVE_DIAGNOSTIC_TRACE_ENABLED=1`, default off), audio/backlog counters,
cancellation enqueue/dispatch/send, terminal receipt versus processing/lock
wait, and truncation timing. Browser diagnostics cover receipt/enqueue,
open-generation underruns, matching drain, clear/flush reasons, and actual
consumed/discarded output samples at the context rate. Discards stay attributed
to each queued reference and never become playback credit. No root cause of
the historical provider/browser incidents is claimed.
- **Issue 12:** Gemini's shared cleanup now bounds both receive-pump termination
and transport closure, attempts abort after expiry, attempts transport closure
even when pump termination fails, and reports incomplete cleanup as failure.
Regressions include cancellation-resistant pump/transport and cancelled/repeated
close waiters. The original runtime/route cleanup owner remains.
- **Issues 1/8 regression alignment:** corrected two remaining obsolete tests
which still expected overflow at 480000 bytes and rejection of the newly
verified 2.1/shimmer signature. Tests retain genuine hard-bound exhaustion and
rejection of unsupported voice/signatures; accepted cancellation errors still
cannot substitute for a terminal or release continuation.
- **Issue 10:** internal `reuse_last_evidence({})`, latest successful delivered
session-local evidence, original retrieval reference and query/provenance,
owner/auth/Live-session checks, independent access-epoch and knowledge-revision
checks, and per-source document/chunk eligibility. Delivery and continuation
revalidate the saved original result again. New-turn source labels use existing
execution mapping to prevent collisions. New topics/insufficient evidence use
canonical search; revocation does not trigger replacement retrieval. No new
retrieval row, embedding call, public endpoint, migration, durable history or
cross-session cache is added. Interruption/fresh search/failure/end clear the
bundle. API 7.3, implementation/database contracts and new reservation profiles
are aligned; older reservations are not rewritten. OpenAI style revision is v3.
- **Issues 3/11 preparation:** a fictional corpus and fixed 20-question benchmark
define essential facts and 512/1024/2048/4096-token candidates, with three
repetitions each. The user authorized localhost and test data. No real-provider
budget evaluation has run; 256 tokens and the 30-second reservoir remain.
See [numeric trace guide](../guides/live-conversation-traces.md),
[benchmark corpus](../../tests/fixtures/live_repair_benchmark.md), and
[question matrix](../../tests/fixtures/live_repair_benchmark.json).
### Resumption validation
- Focused backend voice set: **177 passed**; a later profile/reuse check including
source-label collisions: **48 passed**. The four existing Unicode/multi-call
cases passed after preserving the original search validation message.
- Final focused frontend lifecycle/validation/worklet checks: **85 passed**.
- Frontend build passed; the existing `moment-jalaali` CommonJS warning remains.
- Frontend full suite: **146 passed, 2 failed** in the unchanged call-center and
chat-question rendering assertions already listed at the original pause.
- PostgreSQL acceptance used a disposable `pgvector/pgvector:pg16` container,
database `rag_live_repair_test`, with `--require-postgres`: **11 cleanup/ASGI
cases passed**, **11 evidence-reuse cases passed**, and **8 ASGI tool-delivery/
reservation-replay cases passed**. The reuse cases include unchanged-epoch
selection addition, removal, deletion/deactivation, logout/disable/epoch change,
session closure, cancelled retrieval, and change between reuse and delivery.
- Fixed real-worklet trace: **24 combinations passed** across 24/44.1/48 kHz and
80/120/160/240 ms. Jitter produced no underruns; a two-second upstream pause
produced one underrun for every candidate. Retain 80 ms pending a real failing
trace. Every admitted sample drained and the two-second source bound held.
- Final complete provider-free backend suite: **1975 passed, 2 skipped,
447 deselected** (503.30 seconds), including the full environment-isolation
subprocess. The two skips cover Windows-only path semantics. Command:
`TRUSTED_HOSTS='["localhost:8000","127.0.0.1:8000"]' .venv/bin/python -m pytest -m 'not postgres' -q -p no:cacheprovider`.
The host override supplies valid test configuration without modifying `.env`.
Earlier interim runs exposed four search-validation-message regressions and
their nested-suite failure; preserving the original validation message fixed
them before this clean final run.
- `git diff --check` and benchmark JSON validation pass. No deployment or paid
provider calls were made. Browser discovery reported no connected browser.
### Local browser entry point
The authorized frontend branch is served at `http://localhost:4200` (HTTP 200).
This development-server invocation uses `/tmp/live-repair-localhost-proxy.json`
to proxy API/WebSocket requests to `http://127.0.0.1:8000`; the repository's saved
LAN proxy configuration was preserved. No backend server is listening on port
8000. The build alone does not start either server. A connected browser and a
running backend with an isolated, initialized acceptance database are still
needed for microphone/provider checks. The disposable PostgreSQL acceptance
container was stopped after the database tests; it was not a running app backend.
### Remaining plan work
| Issue | Latest position |
| --- | --- |
| 1 | Code/regressions present; real 60-second microphone/provider acceptance pending. |
| 2 | Numeric tracing and fixed-trace comparisons available; actual incident attribution and live acceptance pending. |
| 3 | Fixed quality benchmark prepared; real budget selection and any generation-profile change pending. |
| 4 | Sent/received/consumed/discarded diagnostics and sample-conservation coverage available; historical discrepancy attribution pending. |
| 5 | Correct matching seal/drain implementation present on the selected frontend branch; browser acceptance pending. |
| 6/7 | Baseline handling verified by focused tests; browser acceptance pending. |
| 8 | Narrow signature accepted and regressions aligned; same-connection real-provider acceptance pending. |
| 9 | Cancellation timing/lock-delay trace available; actual missing/delayed terminal cause remains unresolved. Five-second deadline unchanged. |
| 10 | Code, contract, same-connection synthetic regression and PostgreSQL revalidation implemented; real-provider continuation quality/retrieval-count acceptance pending. |
| 11 | No capacity change accepted. Paired quality/backlog/peak-memory measurements and proposed OpenAI 120-second reservoir work remain. |
| 12 | Bounded cleanup extended; real PostgreSQL/ASGI checks pass. Real-provider resource-release acceptance remains. |
Continue with a connected localhost browser and the synthetic benchmark, tracing
issues 2/4/9 and measuring 3/11 together. Do not close incidents or select a
generation budget from token counts or synthetic tests alone. Complete the
three same-connection browser/provider sequences and record every issue's code,
regression and real-acceptance status separately before claiming completion.
## Local acceptance preparation — 2026-10-12
The user authorized starting the step-by-step scenarios. The frontend remains on
`feat/backend-changes` at `http://localhost:4200`. The backend is now running at
`http://127.0.0.1:8000` using the supported `app.server` entrypoint, the selected
OpenAI adapter (`gpt-realtime-2.1`, `shimmer`), and
`LIVE_DIAGNOSTIC_TRACE_ENABLED=1`. Backend log:
`/tmp/live-acceptance-backend.log`. No OpenAI provider connection has been opened
by the preparation checks.
### Isolated corpus and actual retrieval
- Task-owned container: `rag-live-acceptance-20261012`, loopback port 32769.
Current database: `rag_live_acceptance_ipv4_test`; the existing `rag-postgres`
database and `.env` were not changed.
- Original: `tests/fixtures/live_repair_benchmark.md`, imported through the real
intake/worker/publication workflow. Document:
`51cb12a1-caac-4548-994f-91f487d4dff7`, now ready, active and selected.
- Actual local embeddings: Ollama `bge-m3`, 1024 dimensions, endpoint
`http://127.0.0.1:11434/v1`. The fresh database pins this identity; existing
frozen profiles were not rewritten. Review policy is explicitly configured
for the synthetic fixture; no human-review acceptance is claimed.
- Six answerable and four unsupported synthetic calibration annotations were
frozen before retrieval. The final measured run returned complete support
**6/6**, unsupported false positives **0/4**, with **10 local query embedding
calls** and cutoff `0.5434604999885849`. An earlier ten-query run could not
serialize UUIDs in the temporary setup script; its incomplete artifact was
retained and a fresh run produced the valid report. These are setup calibration
cases, separate from the held-out 20-question answer-quality benchmark.
- A real canonical search for the first fee question returned `ok` and one
source. Report and temporary configuration are under
`/tmp/rag-live-acceptance-20261012/`; test-account credentials are in its private
`account.json`, not this document. `VOICE_TRANSPORT_TESTING=false` is active.
### Setup diagnosis and HTTP verification
The user's frontend login 500 was reproduced as proxy `ECONNREFUSED` while the
API was not listening. Startup restored the route. Python's local embedding
request then stalled in IPv6 socket connection for `localhost`, while IPv4
requests succeeded. The first test database/job remains separate for diagnosis;
the working endpoint was pinned in a new test database. No application audio
buffer, answer budget, cancellation deadline, or adapter code was changed here.
Through the actual frontend proxy, the final checks passed: login **200**,
configuration **200** with `voice=true`, `calibration_status=calibrated` and
transport bypass disabled; conversation creation **201**, calibrated voice
reservation **201**, documented POST close **200**, and logout **204**. An
incorrect DELETE used by an interim diagnostic script returned 405; it was
corrected to the documented POST close route. Both probe reservations were
closed. These checks did not open the provider WebSocket.
### Next user-assisted scenario
Browser automation still reports no connected browser. The user is viewing the
frontend and can perform the microphone steps manually while backend diagnostics
are collected. Begin with Q01: «طبق داده آزمایشی، هزینه بررسی پذیرش چقدر است؟».
Expected fact: 20 million rials for the review fee. Record microphone transcript,
retrieval/source, actual heard audio, limitation/terminal/seal, and whether
listening resumes only after playback. Keep the connection for the following
scenarios. No scenario is marked passed before its actual result is observed.
## Q01 real OpenAI reproduction and sender repair — 2026-10-12
The user reported the correct **20 million rial** fee, severe choppiness, a
mid-answer cut, audio ending before displayed text, and audio starting when most
text had already been generated. The factual check passed by user report;
playback/complete-answer acceptance failed. Browser automation remains unavailable,
so heard-audio observations are user-reported and browser underrun counters have
not yet been collected.
Two actual OpenAI sessions were captured:
| Session | Main answer generated/sent PCM | Final reported playback | First main audio received → sent | Validated answer terminal |
| --- | --- | --- | --- | --- |
| `1a8736b8-720f-4e84-b3fd-d04d2925bc01` | 374400 / 374400 bytes | 7800 ms | 21081 → 24676 ms | `max_output_tokens` limited |
| `06047fe5-c775-47e5-b99d-e837a163cb50` | 369600 / 369600 bytes | 7700 ms | 15386 → 20592 ms | `max_output_tokens` limited |
Each session also contained an earlier audio reference. All four references
reached matching generated/sent/reported-consumed totals and matching seals, with
no recorded interruption discard. This establishes conservation of recorded PCM,
not word-level correspondence or absence of audible dropout. The latest session
had first-reference send gaps up to **3340 ms** and **2551 ms**, with available
queued PCM; its main answer had a send gap of **1016 ms**. The actual answer
generation cap was 256. The validated limitation flag requires the adapter's
specific `incomplete/max_output_tokens` signature, so this is measured attribution
of this cut, not inference from the configured token count alone.
The sender previously drained all queued controls ahead of available PCM, while
each caption and each audio frame performed current authority checks. The repair
alternates PCM with assistant captions, combines adjacent queued partial deltas
for the same response, and preserves source/lifecycle control order, audio-start
before bytes, seals before switching references, and per-send authorization.
No authority cache or larger buffer was introduced. Numeric `authority_ms`,
`emit_ms`, and `queued_controls` were added to the trace to diagnose remaining
latency in the replay. **335 focused voice tests passed**, including new fairness,
text-conservation and revocation cases. The prior full-suite result applies to
the earlier checkpoint; it was not rerun for this sender change.
The real ASGI/tool/source PostgreSQL set also passed **6 cases** on the separate
`rag_live_scheduler_regression_test` database, using fake provider transport.
The task-owned API was restarted after confirming all five prior reservations
were closed. Health is ready; new reservations use OpenAI `gpt-realtime-2.1`
with the temporary 512-token cap and numeric tracing enabled.
Raw local reproduction log: `/tmp/live-acceptance-q01-before-fix.log`.
Numeric events: `/tmp/live-acceptance-q01-numeric.json`. These contain actual
local test observations; they do not replace the missing browser consumption
trace. An earlier short-lived session also recorded a provider cleanup timeout
and abort; issue 12 real-provider cleanup acceptance is still open.
Next: replay Q01 using the repaired sender and a **temporary 512-token candidate**
in the isolated runtime, with a new reservation. This is an experimental profile,
not the selected production budget. Keep the default generation budget, reservoir,
prebuffer and cancellation deadline unchanged in the repository. Do not move to
the next scenario until the Q01 replay result is recorded.
## Q01 replay and second candidate — 2026-10-12
The user reports choppiness in the first call but none in two later calls.
Some displayed answers still end mid-sentence; audio does not speak all displayed
text and **speaking pace itself** is too slow. The previous transcript is no
longer available to the user. No word-level text/audio comparison is available,
so these remaining failures are not marked fixed.
Five replay sessions were recorded under the temporary 512-token profile.
Actual validated `max_output_tokens` terminals occur in three:
`d9723a53-9d83-4e6f-a616-eae60f91b3c1`,
`69747c7a-97b4-4d80-b079-50fb5ffdd8a6`, and
`69b94b83-fbd5-4ee4-867d-d83cc4b7edb5`.
The other two recorded sessions have completed terminals. These five sessions
cannot be mapped individually to the user's three-call report without browser
evidence. All five durable close reasons are `user_requested`; that alone does
not distinguish a manual close from a frontend-initiated close.
The latest session's main audio reference conserved **936000 generated/sent
bytes = 19500 ms of reported playback**, with a matching seal. First received
audio was at 11692 ms and first sent at 11814 ms. Some earlier sessions closed or
interrupted with queued/unreported-played samples remaining; they cannot establish
full playback. Audio sends sometimes show `authority_ms` up to **1060**, whereas
`emit_ms` remains at most 1. This identifies a remaining authority-check delay,
not a socket-send delay or proof of a browser resampling defect.
### Second candidate implementation and checks
- The live route now fences session and turn captures in **one fresh locked
lifecycle transaction per outbound frame**. Owner/auth/session/epoch and both
capture gates remain enforced; there is no authority cache.
- Server-only `OPENAI_REALTIME_SPEED` accepts finite 0.25..1.5, defaults to 1.0,
freezes `audio_output_speed` in new OpenAI profiles, and requires provider setup
acknowledgment. PCM stays 24 kHz and credit remains based on actual samples.
The official [Realtime audio-output reference](https://developers.openai.com/api/reference/resources/realtime/subresources/calls/methods/create)
documents this provider-side adjustment. Gemini is unchanged.
- OpenAI style **v4** requests silent evidence-tool calls, short direct complete
factual answers and brisk natural speech. Essential conditions, exceptions,
numbers and negation remain mandatory; no automatic response chaining.
- **346 focused unit tests passed**. An initial sandbox-restricted run produced
socket-fixture errors and was stopped; the completed rerun had local socket
access. It is not a full-suite result.
- **12 PostgreSQL tests passed**: six real authority-fence/revocation cases and
six actual ASGI tool/source cases with fake provider transports on the isolated
scheduler regression database.
- The idle task-owned API was restarted only after confirming zero active
reservations. Readiness is 200. New localhost reservations use the temporary
**1024-token / speed 1.15 / style v4** candidate. Repository defaults remain
256 tokens and speed 1.0; output reservoir and frontend prebuffer are unchanged.
- A real OpenAI `gpt-realtime-2.1` setup-only probe acknowledged the exact new
instructions, speed 1.15 and 1024-token cap. It generated zero responses and
closed cleanly. This confirms setup compatibility, not audible acceptance.
Replay artifacts: `/tmp/live-acceptance-replay-512.log` and
`/tmp/live-acceptance-replay-numeric.json`. Current candidate log remains
`/tmp/live-acceptance-backend.log`.
### Resume point
Repeat Q01 on a **new reservation**, keep the call open through playback, and
retain/copy the displayed answer before closing. Check sentence completion,
whether every displayed phrase was heard, pace and choppiness. This combined
candidate is a repair replay, not a controlled single-variable comparison or
selection of the production budget. Issue 2/4/9 live acceptance and issue 3/11
quality/capacity benchmark remain open. Only after this replay should the
same-connection continuation, topic change, interruption and long-input scenarios
continue.
## Positive second-candidate user report — 2026-10-12
The user reports that everything appeared OK and this test was good. Record this
as a positive user-assisted replay observation, not completion of all acceptance.
The current candidate log records three sessions; all six processed terminals
are completed and none is limited or cancelled. Session
`b1e44d02-149a-4652-b78c-e926a0d19a11` sent and sealed both audio references;
reported playback is within one-millisecond rounding of generated duration.
The latest session `4a6366d4-941d-48be-ad64-bd02c5b15c24` contains two turns:
its first main reference did not fully drain, while the second-turn reference
sent/sealed all 466190 bytes and reported 9712 ms playback. Without the browser
trace or exact transcript, do not attribute the undrained first reference to a
defect or claim word-level correspondence. The user's positive report cannot be
mapped uniquely to one of these sessions.
Next manual scenario: start a new call if the prior connection is closed, ask Q01,
wait for playback to finish, then say «ادامه بده؛ درباره همین هزینه بیشتر توضیح بده»
on that same connection. Verify a grounded continuation, no repeated retrieval
when the existing evidence is sufficient, full playback, and usable listening
afterward. Keep the connection open for the next topic-change scenario. Production
budget selection and the complete quality/capacity benchmark remain open.
## Same-connection continuation failure at 1024 — 2026-10-12
The user supplied both displayed answers. The initial answer states the fee and
discount, separate unspecified infrastructure cost and deposit distinction.
The «توضیح بیشتر» answer repeats these and adds documents/deadlines, then ends
mid-word at **«تضمین باز»**, with the limited notice. This invalidates a blanket
claim that the second candidate fixes complete answers. The previous positive
report remains a positive observation of its earlier test only.
Session `622f388e-2961-472a-be63-7519342753b1` confirms:
- The second-turn answer has a validated `max_output_tokens` limited terminal
under the temporary 1024-token cap.
- All **1655560** generated PCM bytes were sent and sealed. Reported playback
**34490 ms** differs by only 40 bytes of sub-millisecond rounding. This cut is
in generation, rather than an unexplained loss of the recorded PCM.
- Peak aggregate backlog is **1269592 / 1440000 = 88.17%**, above the plan's
80% capacity acceptance threshold. Raising the budget alone is insufficient.
- The durable `tool_calls` table has **one successful retrieval** for the entire
session, query «هزینه بررسی درخواست». The follow-up added no retrieval row.
Reuse acceptance is positive for this call; complete-answer acceptance fails.
### Capacity implementation for the next candidate
Implement repair-plan issue 11's OpenAI-only **5760000-byte / 120-second** finite
aggregate reservoir and 664 logical-slab bound. Runtime/provider queued PCM,
reservations and delivery credit remain accounted together. Admission refuses
both byte/slab exhaustion before decoding/allocation. Keep Gemini's baseline,
9600-byte frame, 96000-byte transport/browser queue, 72000-byte credit and existing
deadlines. Provider controls keep processing while delivery waits; there is no
receive throttling or automatic response chaining.
New OpenAI reservations freeze `output_backlog_bytes` and `output_slab_limit`;
old snapshots are not rewritten. The next temporary answer-budget candidate is
**2048 tokens**, with speed 1.15 and style v4 retained, after capacity regression
checks and restart of the idle task-owned API. This candidate is not production
selection. Repeat the same two questions on one new connection; complete answer,
audio/text agreement and measured capacity remain acceptance gates.
### Verified checkpoint and running candidate
- **402 focused voice tests passed** after updating the smoke fixture to identify
its selected provider. The first broad run had five fixture failures from that
missing provider field; the completed rerun passed. The first capacity-only
run also corrected two measurement assertions by enabling opt-in tracing.
- **12 PostgreSQL cases passed** for real authority gates and actual ASGI
tool/source delivery. **18 bounded WebSocket transport tests passed** after
choosing provider-specific settings there as well, so a legitimate OpenAI
reservoir override does not get rejected by a baseline transport initializer.
- Synthetic healthy 80-second/two-reference burst drains completely with
aggregate peak **3840000 bytes**, without widening 72000-byte credit. A
120-second burst reaches exactly **5760000** and rejects the next aligned delta
before decode. Large-backlog cancellation/control and genuine stall tests pass.
- Separate synthetic `tracemalloc` measurement: **6668463-byte allocation peak**
for the full 120-second burst. This excludes existing process allocations and
is not provider/browser RSS or production memory acceptance. Artifact:
`/tmp/live-output-capacity-memory.log`.
- The idle localhost API was restarted after confirming zero active sessions.
Readiness is 200. A real OpenAI setup-only probe acknowledged **2048 tokens /
speed 1.15**; runtime reservoir is **5760000**, with zero generated responses
in the probe. Repository generation-budget default remains 256. No frontend
change was needed; its required branch remains `feat/backend-changes`.
- Full-suite results still refer to the earlier checkpoint. The fixed
20-question/three-repetition budget matrix, real peak memory and audible
continuation completeness remain open. No production budget is selected.
Failed continuation evidence is archived in
`/tmp/live-acceptance-continuation-1024-numeric.log` and
`/tmp/live-acceptance-candidate-1024.log`. Next: repeat the user's exact fee question
and «توضیح بیشتر» on one **new connection** with the running candidate, wait for
both playback drains, and retain the text before closing.
## Fee-question replay waits on local embeddings — 2026-10-12
The user reports that the fee question entered processing and produced no answer.
Session `68229a21-b08d-427a-a5c4-4027d10a9b65` became ready and delivered the
user transcript. Its tool-generation terminal completed at 19418 ms; canonical
search began for «هزینه بررسی پذیرش». The local Ollama embedding request took
**47933.47 ms**. Search eventually returned `ok` with two sources at about 63733 ms
from turn trace start, after the client close. No answer PCM was generated or
sent before close. This attempt does not evaluate the 2048-token answer budget.
Provider close also timed out and aborted; real cleanup acceptance remains open.
The Ollama model was resident on subsequent inspection with a five-minute expiry.
Two native embedding probes took **518 / 506 ms**; a probe of the actual backend
`/v1/embeddings` route took **516 ms**, returning the expected 1024 dimensions.
The delayed request has no model-load-duration measurement, so cold loading is
not proven as its sole cause. Residency is a local test mitigation, not a proven
application repair or permanent latency acceptance.
Following the official [Ollama embedding reference](https://docs.ollama.com/api/embed),
empty-input preload with `keep_alive` was verified to return zero embeddings.
Task-owned `/tmp/live_acceptance_embedding_residency.py` now performs empty-input
preloads every 60 seconds for a bounded 30-minute test window, with a 60-second
request timeout and five-minute model residency. It then stops automatically.
It performs no retrieval, factual caching, paid-provider generation or global
Ollama configuration change. Model/endpoint/dimensions/calibration identity remain
unchanged, as do the 2048-token / speed 1.15 / 120-second capacity candidate.
Probe artifacts: `/tmp/live-embedding-residency-probes.json`,
`/tmp/live-embedding-canonical-probe.json`, and
`/tmp/live-embedding-residency-helper.log`. Next: repeat the fee question on a new
connection while the local model is resident. Only after the first answer arrives
should «توضیح بیشتر» be tested on that same connection.
## Browser attachment confirms a playback stall — 2026-10-12
The user supplied apparently complete sentences for the fee question and
«ادامه», plus browser console output. The browser attachment identifies session
`b713a416-6323-4b32-9cb6-9a6db41d90b6`: server error `LIVE_BUFFER_OVERFLOW`, clean
WebSocket close 1013, and partial assistant caption frames. The user confirms
choppy playback and automatic mid-answer closure. This is a **failed playback
scenario**, regardless of the displayed sentence ending.
Backend diagnostics identify the specific failure as **PLAYBACK_PROGRESS_STALL**:
no increasing playback report for 5018 ms. The second-turn audio had 714608
generated bytes, 680208 sent bytes, reported playback 12671 ms, 72000 outstanding
sent bytes and 34400 unsent bytes at failure. Peak aggregate backlog was only
673348 / 5760000 = 11.69%; the larger reservoir was not exhausted. No second-turn
spoken-answer terminal or seal was received before the failure, so natural
generation completion and transcript/audio agreement are unverified. The durable
session is failed/LIVE_BUFFER_OVERFLOW; there is one retrieval row, so same-session
reuse remains positive for this execution.
The attachment omits the existing Debug-level numeric audio/worklet traces.
It cannot distinguish missing received PCM, missing enqueue, stopped consumption
or interrupted context/reporting. Do not infer a root cause or loosen the
five-second stall deadline from these incomplete counters.
Frontend diagnostics on `feat/backend-changes` now expose the existing numeric
receive/enqueue/consume/discard timeline at Info level **in development only**,
plus AudioContext state changes, sanitized worklet processor-error reports and
a once-per-second capture clock. No audio/text/credentials are logged. Preserve
the chunk length before transferring its ArrayBuffer to the worklet; otherwise
the enqueue diagnostic reports zero for the detached buffer. Runtime playback,
credit and completion behavior are unchanged by this diagnostic patch.
Next: refresh localhost and repeat the same fee/continuation call, retaining the
new Info-level console timeline through completion or failure. Correlate the last
backend successful send with browser receipt/enqueue, real consumed samples,
capture clock and context/processor events to locate the first stopped stage.
Do not proceed to topic-change acceptance yet.
Diagnostics checkpoint verification: frontend build passed and **90 voice tests
passed across four files**. The first test launch used system Node 20 and failed
in jsdom/undici before running tests; the completed rerun explicitly prepended
the installed Node 22.23.1 directory to PATH. No dependencies were changed.
Both repository diff checks passed. Numeric backend evidence is archived at
`/tmp/live-browser-playback-stall-numeric.log`. No playback repair or successful
repeat is claimed from this diagnostics-only change.
## Successful three-turn continuation replay — 2026-10-12
The user reports no problem in the fee answer followed by two «ادامه بده» turns,
and provides the development Info-level browser timeline. Session
`85c0199a-b3cc-43e6-8f19-93feb2df939e` correlates with that attachment.
All five processed provider terminals completed, with **zero limited terminals**.
All four audio references were sent and sealed, and the browser reported a matching
drain. At the actual 24000 Hz context rate, final worklet consumption exactly
matches generated/sent PCM:
| Turn/ref | Generated = sent bytes | Browser consumed samples | Backend reported ms |
| --- | ---: | ---: | ---: |
| Turn 1 / `823042…` | 914616 | 457308 | 19054 |
| Turn 2 / `33f09d…` | 1096362 | 548181 | 22840 |
| Turn 3 / `df8f4e…` | 284440 | 142220 | 5925 |
| Turn 3 / `3c01c2…` | 1757102 | 878551 | 36606 |
Consumed samples × 2 equals bytes in every row; millisecond differences are only
floor rounding. No browser processor-error or server-error frame appears. The
durable session closed as `user_requested`. There is **one actual retrieval row
for all three turns**, confirming continuation without extra retrieval in this
execution. Peak aggregate backlog **1757142 / 5760000 = 30.51%** is below the
plan's 80% threshold for this run. Numeric summary:
`/tmp/live-continuation-three-turn-success.json`.
Record the fee/two-continuation scenario as **passed for this local run**, with
positive heard-audio feedback and matched worklet consumption. This does not
explain or erase the earlier intermittent playback stall, prove word-level
alignment automatically, complete the 20-question budget matrix, or select the
production budget. Keep 2048 / speed 1.15 / current finite capacity for subsequent
local scenarios. No application behavior changed in this checkpoint.
Next scenario: **explicit topic change on one connection**. If the successful
call is already closed, establish the fee topic in a new call, wait for playback,
then ask «حالا موضوع تمدید مجوز را توضیح بده؛ مهلت و شرایطش چیست؟» without closing.
Expected essential facts: request at least 30 days before expiry, safety review,
no established debt, and no automatic renewal of an expired permit (new application
required). A new topic must trigger a fresh search; confirm its additional
retrieval row and complete audio drain before interruption/long-input scenarios.
## Topic-change report — 2026-10-12
The user reports the topic-change test was OK. Latest session
`727f38d1-0075-4705-a4e6-676513d1cfdd` has two successful retrieval rows:
«هزینه بررسی پرونده شهرک صنعتی اصفهان» then «تمدید مجوز». Thus fresh retrieval
on explicit topic change is confirmed on one connection. All four processed
terminals completed; none was limited. Durable close is `user_requested`.
The first answer and the earlier second-turn audio reference sent/sealed fully.
The last second-turn reference generated 962494 bytes, sent 602208, and reported
11182 ms playback before close; no matching seal/drain was recorded for it.
Record topic routing/fresh search as passed and the user's experience as positive,
while retaining full final-audio drain as unverified for this call. The log also
contains an unretrieved `LIVE_SESSION_UNUSABLE` future during close; retain it as
cleanup evidence for issue 12 rather than ignoring it or claiming clean shutdown.
Next scenario: interruption during a longer answer. Ask for acceptance conditions,
then while the assistant is speaking say «صبر کن، هزینه بررسی چقدره؟». Confirm old
audio stops promptly, the connection stays usable, and the new question receives
a grounded complete answer. Keep the call open through the new answer's playback.
## Long-input transcription burst — 2026-10-12
The user reports `LIVE_BUFFER_OVERFLOW` in session
`8c7e7d8c-6dee-4572-8a1a-7dc9209663ae` during the longer-question scenario.
The numeric trace identifies **CLIENT_CONTROL_CAPACITY**: 63 queued/in-flight
controls, 6454 bytes against the unchanged 64-message / 262144-byte limits.
Output backlog is zero and speech bytes are zero at failure. This is an input
transcript delta burst overflowing the outgoing control-message count, not
the 60-second speech bound or PCM reservoir. Trace preserved at
`/tmp/live-long-input-control-overflow.log`. Provider close also required the
bounded timeout/abort path; issue 12 remains open.
The runtime now coalesces adjacent unsent partial transcripts of the same role,
turn and response, applying the existing assistant-caption approach to user ASR.
It preserves every delta's text, completed snapshots, intervening controls,
in-flight frames, authority checks and all existing capacity bounds. Oversized
merges fall back to individual bounded frames. No prompt, topic routing, document
facts, speech limit or playback deadline was changed. OpenAI delivery revision
remains v4; the proposed v5 intent instruction was reverted at the user's request.
A regression blocks the first transcript send, supplies 200 Persian ASR deltas
and a completed snapshot with an intervening control, then verifies no overflow,
exact text conservation, completion, control order and released accounting. The
existing replay regression now checks conserved incremental text rather than
requiring one client frame per provider delta; duplicate-ID suppression and
completed-snapshot replay assertions remain. Real long-question replay remains
unverified until the user repeats it after loading this repair.
Validation: the four focused runtime/delivery/interruption files pass **220 tests**
in 27.96 seconds with local socket access enabled. Log:
`/tmp/live-input-caption-burst-tests-final.log`. The first sandboxed run had
16 socket-fixture errors and one old frame-boundary assertion failure; the
socket-enabled first run had 219 passes and that same assertion failure, before
the text-conservation assertion update. No full-suite or new PostgreSQL run
is claimed for this queue-only change.
## User-reported replay and reconnect results — 2026-10-12
After the input-transcript queue repair, the user reports that the longer
question received a good answer without the earlier overflow. Its mixed-domain
wording received a scope clarification; this is transport feedback, not factual
benchmark acceptance. Latest available trace session
`e1ef27ab-fb93-472f-bf3c-c769f20448fd` has no diagnostic overflow, generated/sent
1286026 PCM bytes and a matching server seal, then user close before full final
playback progress. Do not claim exact complete browser consumption from it.
The user also reports success for closing during playback and immediately
starting a new call. Record this as **user-reported pass**. The available backend
log does not independently correlate both calls in that sequence, so resource
release and absence of stale audio are not separately proven by this checkpoint.
No behavior changed for this report. Remaining acceptance includes 30-second
silence, the full 60-second input boundary and repeated combined same-connection
sequences, alongside unresolved intermittent playback stall, cleanup evidence
and the fixed answer-budget matrix.
## Fee-query mismatch report — 2026-10-12
For the user's spoken «هزینه بررسی پذیرش چقدر؟», latest session
`bd6828c1-a121-42ae-a236-62bc14816e32` **did execute search_knowledge**: its
durable query is only «پذیره» and execution status is succeeded. The user-facing
answer reports no evidence; source delivery also appears in the trace. This is
not evidence of an omitted search. The query loses the fee/review aspect and
uses a different term; available numeric traces do not distinguish input
recognition from model query formulation. No fixture-specific synonym, routing
rule or prompt correction is applied. Keep this as a retrieval-quality failure
for the benchmark, separate from silence/transport acceptance.
## Final pause checkpoint — 2026-10-12
The user explicitly defers the 60-second input test and all subsequent tests
until tomorrow. No further implementation, live evaluation, commit, deployment
or branch switch is authorized by this pause/report request. Resume instructions
are consolidated in [next-session checklist](live-conversation-repair-next-session.md).
Current backend: `/home/moz/Projects/raymand/projects/rag-technical-docs-assistant`,
branch `feat/ingestion-foundation`. Current frontend:
`/home/moz/Projects/raymand/projects/faq_chatbot_frontend`, branch
`feat/backend-changes`. Both have uncommitted work. `.aws` is unrelated and must
not be staged with this repair. Earlier Windows paths and clean-tree descriptions
in the original checkpoint are historical.
Completed implementation includes bounded 60-second input, PCM/caption delivery
fairness, bounded input-ASR delta coalescing, cancellation classification and
cleanup bounds, revalidated same-session evidence reuse, OpenAI-only finite
120-second output capacity, validated speech-speed configuration, and numeric
backend/browser diagnostics. Versioned OpenAI delivery is v4. No fixture-specific
intent instruction remains: the proposed v5 addition was reverted. Local
2048-token / speed 1.15 values are candidates, not production acceptance.
Today's manual reports: fee and two continuations were successful in the
correlated run with all four references consumed exactly; topic change retrieved
fresh evidence; a longer input replay after the control-queue fix, close/reconnect
and silence were user-reported OK. The user accepts the silence scenario despite
the separate «پذیره» query mismatch. Do not mark that mismatch as fixed or the
full 60-second boundary as tested. Initial interruption cancels were traced; the
user says the scenario was already exercised, but a complete correlated explicit
new-question answer/drain is not independently proven in this checkpoint.
Verification evidence is cumulative, not a single full-suite run on the final
tree: 1975 ordinary backend passes (2 platform skips, 447 deselected) predate the
latest sender/speed/capacity/ASR changes; capacity checkpoint has 402 focused
voice passes, 12 PostgreSQL passes and 18 transport passes. Latest ASR change
has 220 focused passes. Frontend latest checkpoint has a successful build and
90 focused voice passes; earlier broader run had two unrelated page failures.
Diff checks pass for both repositories. No final full-suite or full live matrix
result is claimed.
Frontend **requires its own commit** to preserve current changes. Exactly four
modified files relative to its current HEAD:
- `public/assets/worklets/pcm-playback.worklet.js`: actual consumed sample/rate
reporting and reference-specific discarded sample accounting.
- `src/app/services/voice-stream/pcm-playback.worklet.spec.ts`: conservation and
multi-reference discard regressions.
- `src/app/services/voice-stream/voice-audio-engine.service.ts`: numeric worklet
handling, development context/capture diagnostics and processor-error logging.
- `src/app/services/voice-stream/voice-stream.service.ts`: development audio
timeline, underrun/seal/drain/clear diagnostics and correct chunk length before
buffer transfer.
Previously implemented seal/drain completion and limited-answer handling are
already in the frontend baseline; do not describe them as new changes in this
four-file diff. These diagnostics do not fix the unexplained browser playback
stall. Backend code/tests/contracts/report changes need a separate backend commit.
No commit or push was performed.
## Frontend commit checkpoint — 2026-10-12
Supersedes the earlier uncommitted-frontend status: at the user's explicit
request, all four reviewed frontend files were committed on `feat/backend-changes`
as **52202c2** (`Add live voice playback diagnostics and sample accounting`).
The frontend working tree is clean. No push was performed. Backend changes
remain uncommitted, and live acceptance remains paused until tomorrow.
## Windows microphone replay and query-name repair — 2026-10-13
Acceptance resumed from the beginning on Windows after the user's Git pull.
Backend is the local `rag-api` container on port 8080; port 8000 belongs to
another project. Local overrides enable numeric traces and retain OpenAI
`gpt-realtime-2.1` / `shimmer`, budget 2048 and speed 1.15. These remain
experimental settings, not production budget acceptance.
- 30-second silence: session `36120006-b089-40eb-92d0-db8555679829` records
32739 ms between ready and first speech; response completed successfully.
- One-minute natural speech: session `93e9b3ff-0885-4b0c-86e1-6acd8a49089c`
succeeded according to the user, but VAD split input into separate turns.
The continuous 60-second single-input boundary remains unverified.
- Continuation replay: `52473ab0-7b6f-42ce-b995-ae6d8acd3472` has one durable
retrieval for the entire call, completed continuation and final playback
progress. Earlier unintended interruption in `9d542f89-12e0-41d0-8ec5-3cc71ffc8713`
followed provider speech-start while the user reported silence and possible
environmental noise. Its noise/echo origin remains unresolved.
- Topic change: `e85e00a2-b54b-472b-8fee-f1a444f1081c` has two successful
retrievals with different topics. User feedback is positive; intentional
close prevents independent confirmation of full final-audio drain.
- Intentional interruption: `29ac4995-821a-48d0-bfcb-866d77bb00f9` stopped old
playback, acknowledged truncation and answered the new topic. The old response
had already completed generation; this is not an active-generation cancellation
test. The user confirms manually closing the new answer.
- Water conditions: the answer states that available land does not guarantee
water supply. Interruption in `4183884f-68b9-4d24-b042-ce925a746d6c` was caused
by actual user speech, confirmed by the user. Provider close timed out and
transport abort succeeded; clean graceful shutdown remains unaccepted.
- Reconnect initially failed while Docker Desktop was unavailable and health
timed out. After an approved Desktop restart, `601ce736-9998-44f8-ab7c-2f75babbeb4a`
closed and `fd36f56d-bbb7-4568-b094-ba6fda880d6a` admitted and answered.
No cleanup diagnostic appeared in that replay.
Missing-price session `fff4acf6-8fb2-4f05-91fb-82f1c222c98b` gave a supported
answer without inventing a price, completed generation and reported final
playback progress. However, the UI user transcript says Mahmoudabad while the
single durable tool query says Baharestan. The returned S1 happens to concern
Mahmoudabad. Correct evidence by chance does not validate the substituted name.
The numeric trace does not prove whether the audio model's interpretation or
its query formulation caused the substitution.
The shared voice policy now explicitly requires preserving user-stated entity
names and document identifiers when shortening queries and asking for clarification
rather than guessing an unclear name. No place-specific substitutions, search
heuristics or corpus changes were added. OpenAI's existing instruction digest
pins this change in newly created sessions; delivery style remains v4.
This is an instruction correction, not deterministic prevention or live proof.
Validation: `.venv/Scripts/python -B -m pytest tests/unit/test_openai_persian_style.py tests/unit/test_voice_evidence_reuse.py tests/unit/test_realtime_phase1.py -m "not postgres" -q -p no:cacheprovider`
passed 74 tests in 17.81 seconds; `git diff --check` passed. No full-suite,
PostgreSQL, budget matrix or exact browser worklet-sample conservation check is
claimed at this checkpoint. The name-preservation microphone replay remains pending.
### Name-preservation microphone replay — 2026-10-13
Latest session `8c487241-f29e-43cc-8695-3837aecd98e9` has one succeeded
durable retrieval with query `شهرک صنعتی محمودآباد قیمت زمین`. The previously
substituted place name is preserved in this replay. Answer generation completed
without output limitation; the final audio reference generated and sent 1087902
bytes and reported 22664 ms playback, leaving 30 bytes below the one-millisecond
reporting resolution. Peak aggregate backlog was 1043838 bytes. No diagnostic
error was observed for this call. Exact worklet sample conservation was not
independently collected. Mark this individual replay passed for query-name
preservation; one prompt-driven success does not establish deterministic or
general entity-preservation reliability. The user reports completing the test.
### Follow-up, conditions and deliberate limitation — 2026-10-13
- `883f649a-701c-48fc-be8e-4ad5f453a9da`: both durable queries preserve
Mahmoudabad (`قیمت زمین شهرک صنعتی محمودآباد`, `قیمت واحد زمین محمودآباد`).
The thousand-square-metre follow-up retains the place and does not invent
an unavailable unit price. It performs fresh retrieval; this does not pass
the no-additional-search continuation criterion. The initial playback is
interrupted at the follow-up speech start. Final full drain is unverified.
- `0814242e-956f-499d-8641-83bc8638e3ba`: search for `مشوق واگذاری زمین دهه فجر 1404`
succeeds. The supplied answer correctly includes the 10% reduction of the cash
down payment, 12 Bahman through end Bahman 1404, and cancellation/auction
exclusions. Response completes without limitation. Final audio generates and
sends 1192126 bytes and reports 24835 ms playback (46 sub-millisecond bytes
remain in integer-ms accounting). This individual factual scenario passes.
- `3169c4a0-5402-4704-a919-5ab1a4d6d31c`: temporarily pin budget 128 for a
deliberate limited-output test. Validated terminal is limited, not completed;
`answer_limited` is sent and the user supplies the displayed limited notice
without duplicated final text. All 184452 generated bytes are sent, final
progress is 3842 ms (36 sub-millisecond bytes). No diagnostic error appears.
Zero durable retrievals were executed: generation stops during the preamble,
so this is limited-state delivery evidence, not grounded-answer quality.
The user closes the call; continued usability after limitation is unverified.
Local candidate budget is restored to 2048 after the scenario. No new code
change is made for this test. Exact browser sample conservation remains unrun.
Combined same-connection acceptance (three repetitions), a single continuous
60-second input, the full answer-budget matrix, and clean graceful provider
shutdown remain outstanding; these isolated scenarios do not complete the plan.
### Selected-source reporting and short acknowledgement - 2026-10-13
User-authorized change: retrieved candidates remain available privately to the
model, while browser sources are emitted only after `report_used_sources`
selects current-turn source labels. Unknown labels, duplicate labels and extra
scope/identity fields are rejected; no report means no candidate-list fallback.
Both provider adapters advertise the internal reporting tool. Original retrieval
identities and metadata are retained; delivery revalidates authorization and
reused knowledge revisions. Metadata reporting creates no retrieval rows.
New sessions use `same-session-evidence-selected-v2` and OpenAI delivery v5.
The optional acknowledgement is only the user's requested short phrase, once per
turn; instruction adherence and actual grounding require microphone validation.
Validation:
- 98 focused provider-free tests passed in 15.84s (reported sources, reuse,
OpenAI style, Gemini and Realtime runtime).
- 22 isolated PostgreSQL tests passed in 71.81s, including source-report delivery
after deactivation, deletion, epoch change and reuse revision change.
- Full provider-free suite: 2005 passed, 3 host-symlink skips, 2 failures.
The ASR repeated-word ordering test timed out; the environment-isolation test
fails because its nested suite encounters the same timeout. Loading the
unchanged HEAD runtime in memory reproduces the individual failure; this is
a pre-existing issue, not accepted as passing or changed in this feature.
- `git diff --check` passed. Task-owned PostgreSQL container was stopped and
automatically removed. Frontend event contract remains compatible; no
frontend change was needed.
Local API rebuilt for microphone verification using the existing diagnostic
2048-token override. Actual provider source-report compliance, spoken phrase,
and audible latency remain pending a fresh voice session.
### Conversational delivery candidate - 2026-10-13
User reports slow, artificial delivery. OpenAI style revision is now
`iranian-persian-conversational-v6`: everyday spoken Iranian Persian, warm
matter-of-fact tone, natural intonation and short clause pauses, with clear
numbers/dates and faithful evidence retained. Local diagnostic override changes
server playback speed from 1.15 to 1.30; the global default stays 1.0 and new
sessions pin the effective speed and instruction digest. This is a candidate
pending microphone comparison, not verified Persian voice quality.
48 focused style/speech-configuration tests passed in 3.58s; the known baseline
ASR ordering failure was explicitly deselected. `git diff --check` passed.
Official reference: https://developers.openai.com/api/docs/guides/voice-prompting
(playback-rate adjustment and model speaking cadence are separate controls).
### Source-report repair after turn changes - 2026-10-13
User reports INVALID_TOOL_ARGUMENTS request dd2be480-9543-4996-860b-4238b4d17973.
Nearby trace session a24ec65a-c992-4eed-87b0-dcd88189ba4c contains an error in
live-turn-4 after rapid turn changes; search occurs in turn 3 before turn 4
supersedes it. Exact report arguments were not logged, so stale labels are a
plausible explanation, not a proven payload attribution. The definite bug was
publishing recoverable citation metadata validation errors as browser errors.
Invalid reports now remain private tool feedback, include current allowed labels
when labels are unknown, and prompt silent retrieval/revalidation before retry.
Authority validation, no invalid citations and no all-candidate fallback remain.
99 focused provider-free tests passed in 13.80s, including invalid-then-valid
report recovery without a browser error, old-turn rejection and source revocation.
No PostgreSQL persistence behavior changed in this follow-up; no new database or
full-suite run is claimed. Numeric report diagnostics added; microphone replay
remains pending a fresh session. Local API rebuild follows this checkpoint.
### Search waiting loop after interruption - 2026-10-13
Session 8a908ca2-855c-4085-9c74-607a5d27ad04: one office-hours search starts at
08:31:06 UTC in turn 2 and finishes with five sources at 08:31:10. Turn 3 starts
at 08:31:07 and turn 4 at 08:31:09, before result completion. Later turns contain
no new search in the collected trace; caller reports repeated claims of waiting.
Inspection finds the interrupted private function call is left without output,
consistent with the waiting loop. Provider reasoning is not independently known.
Repair resolves abandoned OpenAI calls with metadata-only cancellation output
before the next response. Late evidence remains withheld; current authority and
existing audio/terminal barriers remain enforced. Prompt explicitly requires a
fresh call after cancellation when a clear question still needs evidence.
100 focused tests passed in 15.93s, including interrupted slow search followed by
new successful retrieval. Broader interruption/repair/remaining run initially
had 220 passes and five old no-output expectations; tests now distinguish empty
cancellation metadata from prohibited old evidence. All 21 search-interruption
cases passed in 3.95s after updating those expectations. No full-suite or new
PostgreSQL acceptance is claimed for this runtime-only follow-up. Actual provider
replay remains pending a fresh session. See API/implementation amendment.
### Provider event limit incident - 2026-10-13
Session b74383ed-a657-4015-bc9c-d92f3de583db closes at turn 26 after 317265ms.
Diagnostic explicitly reports PROVIDER_EVENT_CAPACITY, occupancy_count=4096,
limit_count=4096, transport_bytes=0, transport_messages=0. This is cumulative
provider replay-ledger exhaustion, not evidence of an overflowing audio queue.
Source reports in this session have zero rejected labels; interrupted-tool
resolution also appears at turn 26. Shutdown still reports CLEANUP_TIMEOUT,
which remains a separate open incident.
Replay-event default and maximum increase to 32768 while retaining all digests
and failing safely at the configured cap. 69 surrounding runtime/repair tests
passed on first run; one new test had the wrong expected provider-protocol error
code, corrected to the existing LIVE_PROVIDER_PROTOCOL_ERROR. All three new
capacity/replay tests then passed in 1.61s. They cover more than 4096 events,
idempotent replay, conflicting replay and finite cap validation/exhaustion.
No full-suite, PostgreSQL or long real-session acceptance is claimed here.
Local API rebuild uses the new default; replay remains pending a fresh session.
### Retained search across repeated follow-ups - 2026-10-13
User authorizes separating playback interruption from retrieval cancellation.
The latest search now has an independent token and original deadline. It is
retained across interrupted turns; explicit reuse awaits and revalidates its
original durable row for the new turn. Identical later search args also coalesce.
New-topic queries cancel/discard retained older searches. Session termination
cancels all independent tokens. Old-turn results remain private. Retained search
refs are omitted from the cancelled-tool list emitted on speech interruption.
Private OpenAI interruption metadata now directs continuation to reuse.
Validation:
- 70 focused unit tests passed in 15.50s (sources, reuse, interruption, style,
Gemini and retained-search cases), followed by an additional deadline case.
- 272 Realtime/repair/remaining/retained-search tests passed in 48.67s, including
repeated waiters not resetting the original search deadline.
- 26 PostgreSQL evidence-reuse/stream-authority tests passed in 104.51s on a
disposable isolated database. Four new runtime cases verify a pending row stays
running after interruption, successful reuse creates only one row, and changed
knowledge revision, inactive document or access epoch blocks publication.
- Tests cover pending/completed results, three repeated follow-ups, direct exact
search-call coalescing, changed topic, current authority loss and session stop.
Older cancellation expectations were updated for the intentional amendment;
unrelated technical failures remain terminal. `git diff --check` passed.
Real provider same-question interpretation and microphone replay remain pending.
Semantic equivalents require explicit reuse by the model; only exact validated
query args are automatically coalesced. No full-suite, frontend or migration run
is claimed at this checkpoint. Earlier baseline ASR failure and graceful provider
shutdown incident remain separate. API local rebuild uses a fresh v5 reservation.