Files
rag-technical-docs-assistant/docs/guides/live-conversation-traces.md
11linear11 9cc9f0bc01 docs(plan): update live repair progress report, traces guide, and next session checklist
- Record measured acceptance evidence across real Q01, continuation, and topic change runs
- Add next-session checklist for remaining 60-second continuous speech and quality benchmark
- Add guide for numeric latency and playback diagnostics
2026-10-12 17:57:51 -04:00

6.6 KiB
Raw Permalink Blame History

Live conversation numeric traces

Use this guide with the repair plan. The traces support diagnosis of issues 2, 4 and 9; they are not evidence that the reported provider/browser incidents are repaired.

Capturing a localhost run

Set LIVE_DIAGNOSTIC_TRACE_ENABLED=1 before starting the backend. The timeline uses the existing app.modules.voice.diagnostics INFO logger. The application already configures the parent app logger; custom launchers must enable INFO for that logger. Leave this flag at its default 0 outside diagnosis to avoid per-chunk logging in ordinary sessions. Failure diagnostics remain available.

In the frontend development browser console, keep Info enabled to see numeric entries named Voice audio trace, Voice worklet consumption, and Voice worklet discarded samples. Development traces also include Voice audio context state and a once-per-second Voice capture clock. Sanitized Voice playback processor failed / Voice capture processor failed errors identify processor failure without dumping event objects. Numeric traces are quiet in production builds. Older frontend checkpoints use Debug/Verbose for the numeric audio entries.

Correlate application session, turn and audio references and cumulative amounts. The backend and browser clocks have different origins; do not subtract their timestamps. Neither trace includes audio, transcript/document text, credentials, or complete provider events. Browser console entries contain numeric counters and application references, not provider response/item IDs.

Backend stages cover cancellation enqueue, dispatch and completed send; terminal receipt before lock acquisition and processing after validation; truncation enqueue/dispatch/send/acknowledgement; accepted generated audio, successful browser sends, audio sealing, real playback reports, and discards on interruption/failure. received_elapsed_ms records entry to runtime event handling after the adapter returns; it does not measure raw provider socket arrival or time inside provider parsing. lock_wait_ms measures runtime lock acquisition, not the provider's acknowledgement latency.

The trace records aggregate outstanding and peak backlog (runtime data, reservations, credit, and adapter queued audio). This is PCM accounting, not a measurement of process RSS or total provider memory. Terminal completion, cancellation and limitation are explicit numeric flags after validation.

The OpenAI repair reservoir defaults to 5760000 bytes; Gemini remains 1440000. Use the frozen reservation's output_backlog_bytes when calculating OpenAI peak occupancy, since an operator may configure a smaller bound. The answer budget benchmark requires peak backlog below 80% of that bound, no limitation, and complete essential facts. A small queue is not proof of complete answers. Synthetic allocation tracing is separate from process RSS and real-provider memory measurements; do not report one as the other.

Delivery stages also record authority_ms, emit_ms, and queued_controls. Use these to distinguish time spent checking current authority from socket send time and caption backlog. Adjacent queued partial user or assistant transcripts can be combined without changing their text; available PCM alternates with captions. Source/lifecycle ordering and per-send eligibility checks remain in force.

Frontend stages cover receipt/enqueue, consumed progress, matching seal/drain, open-generation underrun start/resumption, and each service clear/flush reason. Worklet diagnostics report integer consumed/discarded output samples at the actual context rate, including the deferred tail. Discards are attributed to each queued audio reference and are never credited as playback. These counters do not establish which transcript words the user heard.

For an underrun that ends through interruption/session termination, use the clear event as its end boundary; underrun_resumed exists only if audio resumes. Missing/reordered events, send failure and generated output after interruption must remain explicit rather than being interpreted as normal completion.

Replaying a fixed trace

From the backend repository root:

node tests/support/live_playback_trace.mjs /home/moz/Projects/raymand/projects/faq_chatbot_frontend

This provider-free runner loads the actual frontend worklet. It tests 24, 44.1 and 48 kHz output against the same five-second PCM arrival trace, with 80/120/160/240 ms prebuffer candidates and a separate two-second upstream pause. Every run must consume all admitted samples without overflowing the unchanged two-second source queue. Reported latency is simulated first-sample consumption, not real microphone-to-speaker latency.

The 2026-10-12 run passed all 24 combinations. The jitter scenario had zero underruns for every candidate. At 80 ms, first consumption was 61–64 ms; at 240 ms it was 181–243 ms. The upstream-pause scenario had one underrun at every rate/candidate, with roughly 1.98–2.07 seconds of open-generation idle time. This trace supports retaining the existing 80 ms prebuffer until a real failing trace warrants a change. It does not reproduce the historical live incident.

Real acceptance still needs localhost browser/microphone access, an authorized document corpus and the selected provider profile. Keep repair issues 2, 4 and 9 open until a correlated failing trace identifies a cause and its reproduction passes after the correction. Preserve the five-second cancellation deadline.

Fixed answer-quality fixture

The user authorized localhost and test data for this resumption. The fixed synthetic corpus and 20-question benchmark define essential facts before generation-budget evaluation. They are fictional test data and must not be mixed into a real operational knowledge selection. The fixture includes same-topic continuation, topic change, conditions, exceptions, dates, ambiguity and unsupported current information.

Evaluate all 20 questions three times per 512/1024/2048/4096-token candidate. For follow-ups, ask the preceding question on the same connection and retain that connection for continuation/topic change. Record validated terminal status, real audio accounting, retrieval counts, backlog and process peak memory. Grade all essential facts and natural completion before selecting a budget; string matches or token counts alone do not prove answer quality. The fixture has been prepared, not run against a real provider. The existing 256-token budget and 30-second reservoir remain unchanged pending the paired issue 3/11 measurement.