Repository navigation
chore: reproduction harness and probes for #13 and #14 - #15
Merged
Merged
Conversation
A scriptable stand-in for the Gemini Live WebSocket plus a preload that points the real, unmodified server at it (and answers review/translate fetches locally), so session lifecycle bugs can be reproduced offline and deterministically. Replies stream at real-time pace with a per-session sample value, which lets a listener tell which upstream session any audio chunk came from. The server helper runs on a free port and stops the child by PID only. Co-authored-by: Claude Code <noreply@anthropic.com>
Runs the real server against the fake upstream and asserts the correct behaviour for each confirmed bug: reconnect starts a new conversation instead of resuming, mic audio leaks into the reconnecting session, queued audio is not flushed on a drop, a second drop leaves a zombie session that holds a slot, no setup timeout, no turn watchdog, an upstream leak when the client leaves during setup, a repeated start opening a second upstream, a 'thinking' state that never fires, the silence nudge sent as the learner, a persona with no "didn't catch that" rule, and ACCESS_TOKENS never being enforced. They are marked todo so the suite stays green; each flips to a passing regression test when its fix lands. Co-authored-by: Claude Code <noreply@anthropic.com>
Measures one tutor turn against the real Gemini Live API (connect, setup, time to first audio, audio delivery, where turnComplete lands relative to the end of playback, chunk sizes, base64/JSON wire overhead) and checks which optional setup fields the model accepts (systemInstruction, transcription language hints, session resumption, context window compression). Spends one short greeting plus one setup-only connection per variant. Co-authored-by: Claude Code <noreply@anthropic.com>
Replays one learner turn through the real Live API with Parley's exact setup frame and persona prompt, for a clean control and degraded variants (two mic pipelines interleaved, a quiet noisy mic, a strong Spanish accent, and only a faint tail of the tutor's own voice), and records the input transcript and the tutor's reply. Flags try an English language hint, the persona as a systemInstruction, or a revised prompt from a file. The accented fixture is generated once with Gemini TTS and committed so later runs only spend the Live sessions. Co-authored-by: Claude Code <noreply@anthropic.com>
Drives the real page in headless Chrome with a fake microphone against the real server and the fake upstream, and instruments the page before any app code runs: scheduled playback buffers (tagged with the upstream session that produced them), /live sockets and mic frames sent, getUserMedia streams still live, and how much tutor audio is still queued when the server re-opens the mic. Scenarios: double-tap, server-restart, end-restart, echo-window, upstream-drop-twice, two-tabs, idle-cpu. The fake upstream gains a burst mode that matches what gemini-3.8-live does: the reply's audio arrives at once and turnComplete is held until real-time playback would end. Co-authored-by: Claude Code <noreply@anthropic.com>
Runs the real server against the fake upstream with N simulated browsers streaming mic frames exactly like the page (31.25 base64/JSON frames per second) and samples the server process from /proc, so the cost of each live session can be measured before and after a change. Co-authored-by: Claude Code <noreply@anthropic.com>
Measures what a device sees from a running Parley: /live socket open -> ready -> first greeting audio -> greeting done, /api/review and /api/translate round trips, and the app shell's bytes, caching and compression. Defaults to a scratch port so it is never pointed at production by accident. Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
This was referenced Sep 29, 2026
The server joins DATA_DIR onto the project root, so the absolute temp path the harness passed was written under the repo's tmp/ while cleanup removed a different directory, leaving one profile dir behind per run. Create it under tmp/ and pass it as a relative path. Co-authored-by: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 1 of the stability review: tooling to reproduce and measure the problems in #13 (two voices at once, then a freeze) and #14 (asks the learner to repeat phrases they never said). No app code changes.
public/is untouched, so no cache bump is needed.What's in it
Offline, deterministic (runs in
npm test)test/harness/fake-gemini.mjs: a scriptable fake Gemini Live upstream. It supports real-time or burst replies (burst is whatgemini-3.8-liveactually does), drops with close code 1011, setups that are slow or never complete, and a swallowedturnComplete. Each session's audio carries its own sample value, so any chunk can be traced back to the session that produced it.test/harness/redirect-upstream.mjs+server.mjs: run the real, unmodified server against the fake, with review/translate answered locally. The helper runs on a free port and stops the child by PID only.test/live-harness.test.js: 2 baseline tests (pass), plus 14todotests that pin each confirmed bug. They show up as TODO and don't fail the suite. When a fix lands, remove itstodoso it becomes a regression test.Browser (manual, like
browser-check)scripts/repro-browser.mjs: runs headless Chrome with the fake mic against the real server and the fake upstream. It instruments playback buffers, sockets, mic streams, and how much tutor audio is still queued when the mic reopens. Scenarios:double-tap,server-restart,end-restart,echo-window,upstream-drop-twice,two-tabs,idle-cpu.scripts/perf-server.mjs: server CPU and RSS per live session (offline).Real API (spends quota, so keep runs small)
scripts/live-probe.mjs: turn timing, plus which setup fields the model accepts.scripts/speech-probe.mjs: what the tutor hears and says back for clean, doubled-mic, quiet, accented, and echo-only learner audio. Flags try a language hint, a system instruction, or a revised prompt without editing code.test/fixtures/speech-accented.pcm(153 KB) is generated once with Gemini TTS.scripts/perf-api.mjs:/livetime to first audio, review and translate latency, shell weight. It defaults to scratch port 8399.Verified
npm run typecheck✔GOOGLE_API_KEY=ci-placeholder-key npm test: 124 tests, 110 pass, 14 todo, 0 fail (Node 26)GOOGLE_API_KEY=ci-placeholder-key /usr/bin/node --import tsx --test test/*.test.js: same result on Node 20.20.2node scripts/repro-browser.mjs: all 7 scenarios ran. Results are in the Parley sometimes sounds like two sessions talking at once, then freezes #13 / Parley misunderstands the user's language and asks them to repeat phrases they never said #14 comments.npm test, mostly deliberate waits inside the todo tests (a fix is expected to honourPARLEY_SETUP_TIMEOUT_MS/PARLEY_TURN_WATCHDOG_MSso they stay fast).🤖 Generated with Claude Code