Repository navigation
fix: stop Parley hearing itself, show Thinking…, add screen reader cues - #35
Merged
Merged
Conversation
The fake filled session N's audio with N * 1000, which overflows a PCM16 sample from the 33rd upstream session on and throws inside the fake. Tags now cycle through 1000..32000, and the tests compare through sessionTag(). Co-authored-by: Claude Code <noreply@anthropic.com>
The half-duplex gate opened a fixed 400 ms after turnComplete. A reply sent in a burst (gemini-3.8-live) or still queued on the phone can play well past that, so with a Bluetooth speaker the tail of Parley's own voice went back upstream as a learner turn, which Parley then answered, and so on. The gate now counts its tail guard from when the reply's audio ends in real time (already tracked for the turn watchdog), and the guard is 600 ms. The 'listening' state is sent when the gate actually opens. Harness, a phone that echoes its speaker with ~250 ms output latency: 2 phantom turns in 4 s (4 in 8 s) before, 0 after, streamed and burst. Refs #27 Co-authored-by: Claude Code <noreply@anthropic.com>
Typed text is never transcribed, so the turn reached the review with an empty learner line and every typed message scored "I didn't catch that". The typed text is now the turn's learner text: reviewed, and shown as the learner's line. This also keeps typed turns apart from the empty spoken turns #27 ignores. Refs #27 Co-authored-by: Claude Code <noreply@anthropic.com>
The production journal shows learner turns that were only a sound: empty,
"Mhm.", "un", "b", "Ja.", "RIP", "OII". Each was reviewed and scored.
A spoken turn whose transcript is empty, a single character, only
hesitation sounds, or one of those phantoms is now not a learner turn: no
review, no score, not counted, logged as noise-turn (length only). Typed
turns and short real answers ("Yes.", "Two") are unaffected.
The fake upstream can now transcribe heard speech as a given text.
Refs #27
Co-authored-by: Claude Code <noreply@anthropic.com>
The echo-window scenario now counts the device's output latency in what is still to be heard when the server reopens the mic, and also records it when the screen starts saying "Listening…" and how many mic frames were sent while Parley was still audible. echo-bluetooth runs the same with a 250 ms output latency, which headless Chrome (30 ms) does not show on its own. Refs #27 Co-authored-by: Claude Code <noreply@anthropic.com>
…he speaker In half-duplex mode the client streamed mic audio the whole time and relied on the server's estimate of when the reply stops playing. On a phone the real end is later: network, the player's look-ahead and the speaker's own output latency (Bluetooth: ~250 ms). The client now drops mic frames until its queued audio, the reported output latency and a 250 ms room tail have passed, and shows "Listening…" only then. echoCancellation and noiseSuppression stay on. Browser repro (echo-window / echo-bluetooth, ms still to be heard when the screen says Listening; negative = after playback): before: -474,-378,-442 / 871,-78; 393 / 371 frames sent while audible after: -399,-298 / -259,-190; 0 / 0 frames sent while audible Cache version bumped to 11. Refs #27 Co-authored-by: Claude Code <noreply@anthropic.com>
Refs #27 Co-authored-by: Claude Code <noreply@anthropic.com>
Voice activity detection started a learner turn at the slightest sound.
With START_SENSITIVITY_LOW, speech-probe on the real API:
gemini-3.8-live quiet voice HIGH: heard exactly LOW: heard exactly (2/2)
own echo HIGH: "dog please" LOW: "please" (2/2)
gemini-3.1-flash quiet voice heard exactly either way
own echo "please" either way
Every echo-only case is answered with the honest "Sorry, I didn't catch
that", before and after.
Refs #27
Co-authored-by: Claude Code <noreply@anthropic.com>
The thinking timer was re-armed by every mic frame, and an open mic streams silence the whole time, so 'thinking' never fired. It is now armed by what the learner says (each transcribed piece) or types (at once): 500 ms after the last words, and until the reply's audio starts, the client shows 'Thinking…'. More words hand the turn back to 'listening', and so does no reply at all within the turn watchdog. Browser repro (echo-window): 'thinking' seen 0 times before, 2 of 2 learner turns after (speaking,listening,thinking,speaking,...). The harness test for it is no longer a todo. Closes #30 Co-authored-by: Claude Code <noreply@anthropic.com>
- The mic button is "Microphone" with aria-pressed, so its on/off state is
announced (it was only "Toggle microphone").
- A hidden status region gives a short cue on every turn change: "Your
turn.", "Parley is thinking.", "Parley is speaking.".
- The on-screen transcript is no longer a live region: it is rewritten many
times per sentence while it streams. Each finished line ("Parley: …",
"You: …") and a fetched meaning is announced once through a hidden log.
Browser repro (screen-reader): aria-pressed false/true/false, 8 turn cues
over 3 turns, 5 finished lines announced, 0 repeated.
Closes #31
Co-authored-by: Claude Code <noreply@anthropic.com>
Records the mic button's aria-pressed, the turn cues and the finished lines a screen reader is given during a conversation, and whether the streaming transcript is a live region. Refs #31 Co-authored-by: Claude Code <noreply@anthropic.com>
- live.ts: _cancelThinking() clears the thinking timer and flag together, instead of three hand-paired copies. - Tests: QUIET_FRAME next to LOUD_FRAME, the fake's exported output rate, one parametrised #27 echo test, and pastGreeting() reused. - repro-browser: track the latest playback end instead of spreading an ever-growing array on every mic frame, and count output latency the way AudioPlayer.msUntilHeard() does. Co-authored-by: Claude Code <noreply@anthropic.com>
This was referenced Sep 29, 2026
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.
Stacked on #34 (
fix/single-mic-pipeline).What changes for the learner
Parley no longer hears itself or background noise as the learner (#27)
turnComplete. The guard is now 600 ms.noise-turn(length only, no text).START_SENSITIVITY_LOW)."Thinking…" shows while Parley prepares its answer (#30)
Screen reader cues (#31)
aria-pressed, so its on/off state is announced.Cache version bumped 10 → 11 (
index.html,sw.jsCACHE_NAME,sw.js?v=).announcer.jswas added to the service worker's app shell.Closes #27
Closes #30
Closes #31
Evidence
Harness: phantom turns. A new test client echoes its own speaker back into the mic, with 250 ms output latency.
Browser repro,
echo-window/ newecho-bluetooth. ms still to be heard when the screen shows "Listening…"; negative means after playback ended.Browser
echo-window: "Thinking…" states seen. 0 before, 2 of 2 learner turns after.Browser, new
screen-readerscenarioaria-pressedgoes false → true → false.aria-live.Real API,
speech-probeEvery echo-only case was answered "Sorry, I didn't catch that — could you say it again?", both before and after.
Test suites
npm run typecheckpasses.npm testand/usr/bin/node --import tsx --test test/*.test.js: 177 tests, 176 pass, 0 fail, 1 todo (ACCESS_TOKENS, deliberately left).todo.Notes
#13 an upstream that never completes setup…test timed out under load. It passed on every rerun, and it involves no code from this PR.🤖 Generated with Claude Code