Skip to content

fix(live): honest "didn't catch that", persona as systemInstruction, English transcription, nudge as the tutor's line - #33

Merged
Alorse merged 6 commits into
mainfrom
fix/honest-not-understood
Sep 29, 2026
Merged

Alorse merged 6 commits into
mainfrom
fix/honest-not-understood

Conversation

@Alorse

@Alorse Alorse commented Sep 29, 2026

Copy link
Copy Markdown
Owner

What changes for the learner

  • Honest "didn't catch that". When Parley didn't clearly hear the learner (silence, a faint echo of its own voice, a scrap of words that isn't a reply), it now says "Sorry, I didn't catch that — could you say it again?" instead of guessing. It only corrects words it actually heard, only asks the learner to repeat their own words with one fix, and in "feedback every turn" mode it encourages every turn but only suggests a retry for a real mistake.
  • Instructions delivered properly. The tutor persona now goes in the Live setup's systemInstruction instead 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.
  • English transcription. The setup tells the transcriber to expect English (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.
  • The "take your time" nudge is Parley's own line. It used to reach the model as if the learner had said it. It is now an app note, which the persona says is never learner speech.
  • Found along the way: a Node timer can fire about 1 ms before Date.now() shows the delay has passed. The nudge then never played, and this was also the intermittent multi-turn test 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)

before after
gemini-3.8-live, echo: says it didn't catch it 0/4 7/8 with the persona change; 3/4 once the English hint is added (see note)
gemini-3.8-live, clean+quiet: invents a phrase to repeat 5/8 0/7 (twice, 0 false "didn't catch")
gemini-3.1-flash-live-preview (fallback), echo — 3/3 (+1 run with no reply at all)
3.1 fallback, clean+quiet: false "didn't catch" — 0/8
3.1 fallback, clean+quiet: unneeded retry suggestion — 4/8, one with a made-up phrase ("white coffee")

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)

  • gemini-3.8-live, 13 paired runs: connect → first audio median about 1.6 s before → about 1.35 s after (prompt → first audio 1.53 s → 1.05 s; setup takes about 120 ms longer because it now carries the persona). Runs are noisy (0.9–2.5 s).
  • gemini-3.1-flash-live-preview, 5 runs each: 642 ms → 792 ms. Its reply was already fast, so the longer setup makes it about 150 ms slower.
  • That is roughly 250 ms better on the primary model, not the big drop Faster first words from Parley #23 hoped for.

Setup fields: systemInstruction and inputAudioTranscription.languageCodes are accepted by both models (live-probe --variants-only). A resumed setup with a handle plus systemInstruction is 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-restart showed 13.5 mic frames/s once; re-runs gave 32 and 31.5, so that was noise.

Tests: npm test and /usr/bin/node --import tsx --test test/*.test.js went from 136 tests (6 todo) to 143 tests (2 todo), 0 fail; npm run typecheck is 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

  • 3.1 fallback: after a resume it asked a different opening question, so its context may not really be restored. That's a resumption question for the stacked Task A branch, not this one.
  • The wrong-script transcripts in Write down what the learner says in English, not in other alphabets #28 couldn't be reproduced with synthetic audio (neither before nor after), so the real check is a week of server records.

🤖 Generated with Claude Code

Alorse and others added 6 commits September 29, 2026 07:54
…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>
@Alorse
Alorse changed the base branch from fix/resume-after-drop to main September 29, 2026 13:48
@Alorse
Alorse merged commit d34c0ae into main Sep 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant