Repository navigation
Description
Problem
CodeTrial already exposes the interviewer's state through the lk.agent.state participant attribute and uses a Web Audio analyser for avatar lip synchronization.
However, there is currently no explicit browser-side diagnostic for comparing when the browser observes the interviewer entering the speaking state with when remote audio activity becomes detectable.
This makes it difficult to investigate whether the interviewer's published speaking state aligns with the audio activity observed by the browser.
Proposed approach
I propose adding a lightweight, developer-oriented timing diagnostic that:
- Records a timestamp using
performance.now()when the browser observes a transition to the interviewer'sspeakingstate. - Detects the first meaningful remote audio activity following that transition.
- Calculates the elapsed time between the two browser-observed events.
- Handles track replacement, reconnection, and missing audio without reporting misleading measurements.
- Includes automated tests for timestamp calculation, state transitions, and audio activity detection.
The measurement would be reported as a browser-observed timing difference, not as end-to-end conversational latency or the exact time when the candidate hears the audio.
Related work
Issue #105 includes latency measurements comparing Gemini Live with a local model setup. This proposal focuses on browser-side event timing within CodeTrial rather than repeating those model-level benchmarks.
Relevant existing code:
web/interview.js— interviewer state and remote audio track handling.web/avatar/stage.js— remote audio analyser used for avatar lip synchronization.web/audio-playback.js— browser audio playback state management.
Questions before implementation
- Would this browser-side timing diagnostic be useful for investigating audio response delays in CodeTrial?
- Would reusing the existing avatar analyser be appropriate, or should the diagnostic remain independent of avatar visibility?
- Would a small, testable implementation of this diagnostic be an acceptable contribution?
I would like to confirm the intended scope and acceptance criteria before starting implementation.
Activity
jserv commentedon Nov 15, 2026
Measure, in the browser, the time from the interviewer's lk.agent.state changing to speaking (read where state.agentSpeaking is set in
web/interview.js) to the first remote audio frame above a threshold. Call it a browser-observed gap, as the issue already does.Keep it independent of the avatar.
attachAvatarAnalyserinweb/avatar/stage.jsbuilds no analyser while the avatar is hidden or retired, so a measurement built on it would vanish with that setting.Keep it developer-facing and off by default: nothing on the candidate's page. web/ has no debug channel today, so say in the pull request where the number is reported and how to turn it on.
There is no need to ask before a proof of concept: you are assigned, so go ahead with this scope.
Add browser audio response timing diagnostics