Skip to content

fix(narrator): the narration keeps the request's language - #21

Closed
maximetinu wants to merge 1 commit into
midudev:mainfrom
maximetinu:fix/narrator-keeps-your-language
Closed

maximetinu wants to merge 1 commit into
midudev:mainfrom
maximetinu:fix/narrator-keeps-your-language

Conversation

@maximetinu

Copy link
Copy Markdown
Contributor

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.

  • In a real session: I wrote in Spanish, Claude answered in Spanish, and the narration came out in English ("Fixed the spoken language code bug in Narrator…").
  • While testing the prompt: an English request was narrated in French ("Ça y est, le test de connexion instable est corrigé…"), 1 run in 8.

Either way the person hears a narration in a language they did not use.

Changes, all in narrate:

  • The language is decided before the model call. It is the setting, else the request's language when its words tell it (guessLanguage(request), the same helper the short-answer path uses). Haiku then gets NARRATOR(asked): "Always speak Spanish (es)…". When the request does not tell (too short, or no common words), the prompt stays as it is today.
  • The narration is checked after. Its language comes from its words (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 write es and 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.
  • One sentence in the README.

How I checked it

Independent of #17–#20. I did not bump the version.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BYz64SVroXE7xu269had2Y

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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T18:01:13.146501Z 3325598 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@maximetinu

Copy link
Copy Markdown
Contributor Author

Superseded by #22, which combines #19, #20 and #21 (they touched the same code and tests and would have conflicted) and adds one more fix: Claude's closing question is said as Claude wrote it.

@maximetinu maximetinu closed this Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant