Skip to content

response-language setting for Ask AI and agent review jobs#1018

Open
JaeSeoKim wants to merge 1 commit into
backnotprop:mainfrom
JaeSeoKim:feat/ai-response-language
Open

response-language setting for Ask AI and agent review jobs#1018
JaeSeoKim wants to merge 1 commit into
backnotprop:mainfrom
JaeSeoKim:feat/ai-response-language

Conversation

@JaeSeoKim

Copy link
Copy Markdown

Summary

Adds a Response Language setting so users can get AI output in their preferred language (e.g. Korean) instead of English, across both Ask AI chat and launched agent jobs (Guided Review / Code Tour / agent code reviews).

Motivation

Ask AI and guide/tour outputs always come back in English (the model default), which makes the AI features awkward for non-English-speaking users during code review. This adds an opt-in language preference that injects a prompt instruction; default is Auto (no instruction, today's behavior).

What's included

Settings UI (AISettingsTab)

  • "Response Language" section: Auto (default) + 31 preset languages (native + English labels, SaaS-typical coverage) + Custom… free-text input.
  • Stored as the English language name in the cookie plannotator-ai-response-language (consistent with other cookie-backed prefs; works across random ports).

Ask AI

  • Optional responseLanguage field on AIContext (all three variants) — rides inside the existing context serialization, so no provider or endpoint changes needed; claude / codex / opencode / pi all pick it up via buildSystemPrompt and buildForkPreamble (forked sessions skip the system prompt, so the fork preamble carries it too).
  • The session bakes the language into its system prompt at creation. If settings drift mid-session, a small per-query (Respond in …) tail is appended only until a new session picks it up — a change applies from the very next question, with no duplicate instruction in the steady state.

Agent jobs (guide / tour / review)

  • launchJob injects the setting into the job body; responseLanguage added to the jobs-endpoint field allowlist and config threading (Bun server + Pi server mirror).
  • agentJobLanguageInstruction() (shared in agent-review-message.ts) is prepended to the guide/tour user message and the review-job user message. Instruction scopes to natural-language output only — file paths, code identifiers, and JSON/schema keys stay as-is, so guide/tour structured output still validates.
  • Guide repair jobs are deliberately excluded: they must fix JSON syntax without rewriting content.

Testing

  • Unit tests: buildSystemPrompt/buildForkPreamble include/omit the instruction; guide buildCommand prepends it from config.responseLanguage.
  • End-to-end: with Korean selected, Ask AI (code review mode) answers in Korean; a real Guided Review job produced fully Korean titles/overviews with valid schema output. Auto reproduces today's prompts byte-identically.
  • bun run typecheck clean; full test suite passes.

Adds a "Response Language" option (preset dropdown + custom input, Settings
AI tab) so Ask AI answers and guide/tour/review agent jobs are written in
the user's chosen language.

- Ask AI: optional `responseLanguage` on AIContext; buildSystemPrompt /
  buildForkPreamble append the instruction. A per-query instruction is
  appended only when settings drift from the session's baked-in language,
  so a change applies from the very next question without duplication.
- Agent jobs: launchJob injects the setting into the job body;
  guide/tour buildCommand and the review-job user message (Bun + Pi
  servers) prepend the instruction. Guide repair jobs are deliberately
  excluded (they must never rewrite content).
- Stored as English language name in the cookie
  `plannotator-ai-response-language`; default Auto (no instruction).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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