Repository navigation
fix(narrator): the narration keeps the request's language - #21
maximetinu wants to merge 1 commit into
Conversation
With no Language setting, the model had to tell the language from the request, the tool calls and the answer. With a request in one language and tool calls in another, it sometimes narrated in the wrong one, which the voice of the right language then read. Now, when the request's words tell its language, the model is told to speak it. A narration whose words are in another language is not said, whatever code the model wrote: the answer itself is read instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BYz64SVroXE7xu269had2Y
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3325598221
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // The language to speak: the setting, else the request's when its words tell it. The model is told | ||
| // it in so many words: left to tell it from a request in one language and tool calls in another, it | ||
| // sometimes narrates in the wrong one. | ||
| const asked = settings.language || guessLanguage(request) |
There was a problem hiding this comment.
Do not treat the six-language guess as authoritative
In automatic mode, a normal unsupported-language request can be misclassified because guessLanguage's WORDS table in hooks/text.ts:6-13 only covers six languages and counts words shared with other languages. For example, Afegeix el narrador i fes que parli en la llengua de la petició is Catalan but returns es; this line therefore changes the system prompt to Always speak Spanish (es), and the later validation enforces the same mistake. Previously Haiku could infer Catalan from the request, so Catalan (and similarly Dutch) users now reliably hear a different language unless the setting is explicit; keep the automatic prompt when the detector cannot rule out an unlisted language.
Useful? React with 👍 / 👎.
What
With no Language setting, the prompt says "speak the language the user wrote the request in", and Haiku has to work that out from the brief. The brief mixes languages: a request in Spanish, tool descriptions in English (
Bash: Run the tests), an answer in Spanish. Sometimes Haiku narrates in the wrong language.Either way the person hears a narration in a language they did not use.
Changes, all in
narrate:guessLanguage(request), the same helper the short-answer path uses). Haiku then getsNARRATOR(asked): "Always speak Spanish (es)…". When the request does not tell (too short, or no common words), the prompt stays as it is today.guessLanguage(text)), else from the code Haiku wrote. A narration in another language than the request's is not said. The answer itself is read instead, as when no narration comes back, and a debug log says why. Haiku can writeesand then English, so the words count first. With a Language setting set, the result is not checked, because the answer may be in neither language.How I checked it
claude plugin test ./plugins/narrator: 61 pass (59 before). There are 2 new tests. A request in Spanish tells Haiku "Always speak Spanish (es)". A replyes+ English text from the model is not said, and the Spanish answer is read in its place. Both fail without the change. The tests that expect the automatic prompt (request "add a narrator") still pass: that request is too short to tell its language.claude plugin validate ./plugins/narratorpasses.Independent of #17–#20. I did not bump the version.
🤖 Generated with Claude Code
https://claude.ai/code/session_01BYz64SVroXE7xu269had2Y