Repository navigation
fix(live): honest "didn't catch that", persona as systemInstruction, English transcription, nudge as the tutor's line - #33
Merged
Conversation
…h that" instead of guessing
The tutor persona now travels as the Live setup's systemInstruction (on
every setup, resumed ones included) instead of as the learner's first
message; a short bracketed app note starts the greeting. The persona
tells the tutor such notes are never the learner speaking.
The persona also gets honest-hearing rules: when the tutor did not
clearly hear the learner it says so ("Sorry, I didn't catch that —
could you say it again?") and neither corrects nor guesses; it only
corrects words it heard clearly; a retry is always the learner's own
words with one fix, never an invented phrase; and the every-turn
cadence gives encouragement every turn but a fix only for a real
mistake.
Real API (speech-probe, echo = only a faint tail of the tutor's voice):
- gemini-3.8-live echo: 0/4 -> 7/8 "didn't catch that"
- gemini-3.8-live clean+quiet invented retry phrase: 5/8 -> 0/7
- gemini-3.1-flash-live-preview echo: 4/4 "didn't catch that"
Time to first greeting audio (live-probe, 13 paired runs on 3.8-live):
~1.6 s -> ~1.35 s median; the 3.1 fallback is ~150 ms slower (its setup
takes longer with the persona in it).
live-probe gains --persona user|system and --runs; speech-probe now
mirrors Parley's setup by default (--legacy for the old delivery).
Closes #26
Closes #23
Co-authored-by: Claude Code <noreply@anthropic.com>
…rds are clear With the English transcription hint (#28) the echo probe's faint tail of the tutor's own voice is transcribed as clear words ("dog please") and gemini-3.8-live answered it as if the learner had spoken (1/4 honest). The "did not understand" check now comes before the feedback rules and also covers a short scrap of words that is not a sensible reply, even if clearly worded, and faint speech of only a few words. A clear, complete sentence that changes the topic still counts as understood (the fallback model was over-applying the rule to it). Real API with the hint, 4 runs each (speech-probe echo/quiet/clean): - gemini-3.8-live: echo 3/4 "didn't catch that"; clean+quiet 0/7 invented phrases, 0/7 false "didn't catch that" - gemini-3.1-flash-live-preview: echo 3/3 (+1 no reply); clean+quiet 0/8 false "didn't catch that", still 4/8 unneeded retry suggestions Co-authored-by: Claude Code <noreply@anthropic.com>
Without a language hint the input transcriber guessed the language on every turn and wrote short or unclear English in other scripts (Hindi, Chinese, Czech...), which the review then scored as "not understood". The setup now sends inputAudioTranscription.languageCodes ['en-US']; both gemini-3.8-live and gemini-3.1-flash-live-preview accept it (scripts/live-probe.mjs --variants-only), and clean, doubled, quiet and accented speech all transcribe as English on both. A learner who really speaks Spanish still gets a gentle English nudge, but it is no longer turned into a phrase to correct and repeat. speech-probe now runs with Parley's hint by default (--no-hint for the old setup). Closes #28 Co-authored-by: Claude Code <noreply@anthropic.com>
A Node timer can fire a millisecond before Date.now() says its delay has passed. SilenceNudge.shouldFire() then said "not yet" and nothing ever checked again, so the "take your time" nudge silently never played and the conversation stayed frozen. The timer now reschedules itself for the time left. This was the intermittent multi-turn test failure; the nudge tests also poll for the nudge instead of sleeping a fixed 60 ms. Co-authored-by: Claude Code <noreply@anthropic.com>
The "take your time" nudge went upstream as a bare user turn, so the tutor took it as the learner's own words and answered them, sometimes with another request to repeat something. It is now sent as a Parley app note, which the persona says is never the learner speaking. A model-role turn was tried first: gemini-3.8-live stays silent after one and gemini-3.1-flash-live-preview improvises, so the harness test now checks for the app note instead of a non-user role. Real API, greeting -> learner mistake -> correction -> nudge, 3 runs per model: 6/6 the tutor said the nudge as its own line (e.g. "Take your time — try saying it, or we can move on."), none answered it as learner speech. Closes #29 Co-authored-by: Claude Code <noreply@anthropic.com>
- waitFor moves to test/harness/wait.mjs; the nudge tests use it - SilenceNudge.shouldFire() derives "due" from msUntilDue() - live-probe builds its turn with textUpstreamFrame/upstreamUrl, uses one median helper and one run loop - drop an unused export, a one-use constant, a stale test header and a prompt assertion already covered in tutor.test.js 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.
What changes for the learner
systemInstructioninstead of being sent as the learner's first message. A short bracketed app note ("[Parley app note, not the learner speaking] …") starts the greeting. Resumed sessions get the persona too and are still not re-greeted.languageCodes: ['en-US']), so short or unclear English is no longer written in Hindi, Chinese, Czech and so on. A learner who really speaks Spanish still gets a gentle English nudge, but it is not turned into a phrase to correct and repeat.Date.now()shows the delay has passed. The nudge then never played, and this was also the intermittentmulti-turntest failure. The timer now re-checks.Closes #26
Closes #23
Closes #28
Closes #29
Evidence (real Gemini API, scripts in this branch)
"Didn't understand" (
scripts/speech-probe.mjs: echo = only a faint tail of the tutor's voice; clean/quiet = a correct sentence)Note: with the English hint, the echo tail is transcribed as clear words ("dog please" instead of "No."), and 3.8 first answered it as real speech (1/4). The check-understanding rule was moved ahead of the feedback rules and extended to cover this, which brought it to 3/4. The fallback model still follows the "fix only real mistakes" rule less reliably than the primary.
Time to first greeting audio (
scripts/live-probe.mjs --persona user|system)Setup fields:
systemInstructionandinputAudioTranscription.languageCodesare accepted by both models (live-probe --variants-only). A resumed setup with a handle plussystemInstructionis accepted by both.Nudge: greeting → a learner line with a mistake → correction → nudge, 3 runs per model. 6/6 Parley said it as its own line (e.g. "Take your time — try saying it, or we can move on."). A
role: 'model'turn was tried first and doesn't work (3.8 stays silent, 3.1 improvises), so the harness test checks for the app note instead.Browser repro (
scripts/repro-browser.mjs, all scenarios) before/after: no behavioural change.server-restartshowed 13.5 mic frames/s once; re-runs gave 32 and 31.5, so that was noise.Tests:
npm testand/usr/bin/node --import tsx --test test/*.test.jswent from 136 tests (6 todo) to 143 tests (2 todo), 0 fail;npm run typecheckis clean. The todo markers for #14/#26 (didn't-understand rule, own-words-only rule), #23 (systemInstruction), #28 (English hint) and #29 (nudge) are removed, so they are regression tests now. The remaining todos (thinking state, ACCESS_TOKENS) belong to other issues.Not done / worth knowing
🤖 Generated with Claude Code