Repository navigation
feat(chat): let the user pick a preferred reply language - #31189
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the change adds one opt-in field, defaults to today's behaviour, and reuses the existing Notes
[DESIGN-REVIEWED] 1f149c8 Description read[DESCRIPTION-READ] fb0c71c3900fa0a62e16a3d3f5162dca08edc3a05037af93710ed41199438279 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The new setting defaults to Auto, so nobody's context changes unless they pick a language. The one gap: the PR adds a second Python copy of the shipped-language code set, beside one that already exists. Notes
What this change shipsInventory (7 items) — 5 justifiedIntent: the user wants the agent to reply in one chosen language instead of switching every turn. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 1f149c8 Description read[DESCRIPTION-READ] 4e68ee4c68a603a3073bc340245002751ef52d6c9dbf5d53af434356edf3097e That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. The blind reader understood the new reply-language select ("sure", would use it), and the three screenshots show its default, open and changed states. Notes
[UX-REVIEWED] 1f149c8 Description read[DESCRIPTION-READ] b1bcc8e5d8faaf641c7149fb013f1a884b5f0fce1ed29d4f06914f31d7e360c3 That sha256 names everything this verdict read: the PR description, plus the 6 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
|
Rebased: main moved in config-baseline.json, src/kiro_crew/config/loader_builders.py, src/kiro_crew/config/sections.py and other overlapping files since this head's CI ran (3922b02 -> f5340cc); CI re-running. The same push rewrites the preferred_language_hint in fr/ru/bn/hi to each style guide's informal address (tu, ты, তুমি, तुम), which the [changed-values] register tests require. |
4d99885 to
03f9e21
Compare
03f9e21 to
b463a52
Compare
buluoray
left a comment
There was a problem hiding this comment.
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:
Verdict: request changes. One prompt conflict in the feature's core case, plus the missing screenshot that keeps PR Policy red. The rest of the change is sound, and the fix is small.
What it does for users. A user who writes Chinese (or Japanese, Korean, Hindi...) mixed with English technical terms gets replies that switch language from turn to turn, because the only rule today is "reply in the user's language", judged per message. This adds a Preferred Reply Language select under Response Verbosity. A chosen language holds for every reply, while code, commit messages and PR text keep the project's language.
Value gate. This does not duplicate an existing surface. dashboard.language and its [UI LANGUAGE] block steer only the tool-call purpose text, and say outright that replies follow the user's message (context_assembly/output_contract.py:168). dashboard.verbosity controls length and style, not language. The current workaround is a memory note, which is per workspace and competes with other memory facts. The issue's reason for a separate setting from the UI language (English UI, Chinese replies) holds up.
Blocking: the new rule contradicts [UI LANGUAGE] when both are set.
- When
dashboard.languageis set explicitly, every session start carries[UI LANGUAGE](session_start.py:233,session_start.py:426). That block says "Your replies to the user keep following the language the user writes in" (output_contract.py:168). - The new section (
context_assembly/sections.py:345) only claims to outrank a "user's language" rule. That phrase matches the verbosity levels' lines (sections.py:271,sections.py:320), not the[UI LANGUAGE]wording. - So the target user (UI language picked, reply language picked, message mixes languages) gets two direct instructions that disagree. The one that does not match the precedence sentence is the one telling the model to follow the message's language, which is exactly the behaviour this PR exists to stop.
- Suggested fix: make
_build_ui_language_sectiondrop or reword its reply sentence whendashboard.preferred_languagenames a listed language (for example, "Your replies follow [RESPONSE PREFERENCES]"). Add a test that builds both blocks with both settings set and asserts the follow-the-message sentence is absent. Widening the precedence sentence to name[UI LANGUAGE]would also work, but removing the false sentence is cleaner.
Blocking (gate): PR Policy is red. Screenshot Evidence fails: the PR changes a visible Settings control and carries no screenshot. The UX and design lanes also report "cannot evaluate" for the same reason. Please attach a capture of the new row, both closed and opened.
Default keeps main's behaviour (verified).
- With
preferred_languageempty,_reply_language_rulereturns "" (sections.py:325). The frame join atsections.py:396then leaves the block byte-identical to main, and atdefaultverbosity it renders nothing. - The loader narrows a stored value outside the list to auto (test_an_invalid_stored_value_loads_as_auto). The PUT handler rejects any value outside the list with a 400.
- Mutation: I made the empty value fall back to English in
_reply_language_rule. That reddened 8 of 12 tests in TestReplyLanguageRule, including test_auto_adds_nothing and test_a_config_without_the_attribute_is_auto. I restored the file and the tree was clean afterwards.
How the preference reaches the model.
- It is prompt text inside the existing trusted
[RESPONSE PREFERENCES]frame. The language name comes from the fixed PREFERRED_LANGUAGES table, never from the stored value. - It is global (one config field), not per session. Sub-agents are excluded through
_response_preferences_apply. - The frame is minted in the provider-agnostic
build_messagepath (turn_message.py:521-524). It is re-added after compaction (turn.py:112) and in side prompts (dashboard/side_prompts.py:179), so Kiro, KAS and Claude Code sessions all receive it. - A change made mid-session lands at the next session start or compaction, not on the next turn. This matches verbosity, but the hint does not say so.
Tests run on this head.
- Backend: test_preferred_language_config.py, test_verbosity_config.py and test_context_ui_language.py, 130 passed.
- Frontend: ChatPanel.preferredLanguage.test.tsx, 8 passed.
- CI: 90 success, 10 skipped, 1 failure (PR Policy, screenshot). PR Readiness is success.
- Bot lanes: Opus, GPT, design, UX and first-principles all PASS. The UX and design lanes say they could not evaluate without a screenshot.
- merge-tree against main exits 0. The full suite was not run.
Source-only (not run). Hidden-turn prompts in crewmate_prompts.json (goal setup, welcome, check-ins) say "in the user's language" or name the [UI LANGUAGE] tag, and they arrive after the frame. I did not check how they interact with a set reply language.
Non-blocking follow-ups.
- Prompt phrasing: the new section uses "stay exactly as they are" and "Write every reply in...". Please phrase it as a principle the model can apply (the reason being consistency for a mixed-language reader), without "exactly". The wrapper sentence at
sections.py:405predates this PR and is out of scope. - Hint copy: three sentences, and the second one restates the "Auto (match my message)" option label. One sentence carrying only what the user cannot see would do, for example that code, commit messages and PR text keep the project's language.
- Locales: all 12 catalogs plus the pseudolocale carry the three keys with translated text. No issue found.
b463a52 to
f692d4d
Compare
af793f6 to
8a73ff7
Compare
|
Merge conflict in the generated src/kiro_crew/docs/ui-index.generated.json again. Rebased onto main 480d162 and re-ran gen:settings then gen:ui; against main the index only adds the chat.preferred-reply-language rows (gen-ui-index --check up to date, src/uiLocations tests pass). New head 8a73ff7, no code change. Conflict rebase, not a green-age re-sync. |
8a73ff7 to
fe70812
Compare
|
Merge conflict in the generated src/kiro_crew/docs/ui-index.generated.json again. Rebased onto main 5f7f8d1 and re-ran gen:settings then gen:ui; against main the index only adds the chat.preferred-reply-language rows (gen-ui-index --check up to date, src/uiLocations tests pass). New head fe70812, no code change. Conflict rebase, not a green-age re-sync. |
|
Backend Tests (3.12/Windows/macOS) fail on test_security_gate_liveness.py::test_the_package_stays_within_its_line_budget (34855 > 34845). That is main's red: this PR touches nothing under src/kiro_crew/security. Fix in flight: #32183. This PR waits for it, then rebases. The AI review lanes and PR Policy failed on GitHub API rate limits / merge-base reads, not on findings. |
fe70812 to
378c9fd
Compare
|
Resolved a merge conflict with main: |
|
Merge conflict in the generated |
378c9fd to
1f149c8
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Approving head 1f149c8. The gate shows 103 checks passed, none red. The only pending check is a numbered macOS backend shard. The branch now merges cleanly into main.
What I checked:
- A sub-agent keeps the follow-the-user sentence.
_build_ui_language_sectiontakesframe_delivered(defaultFalse, the old sentence), and both call sites insession_start.py, the minimal run and the full one, pass_response_preferences_apply(session_key, runtime_source). So the reply sentence defers to [RESPONSE PREFERENCES] only in a session that actually receives that frame, andtest_a_subagent_session_keeps_follow_the_userpins it for asubagent:session. - No free text reaches the trusted block.
_reply_language_ruletakes the language name from the fixedPREFERRED_LANGUAGEStable and returns""for auto or any unlisted code, so a hand-edited config value never lands in the prompt. - Unset changes nothing. With
preferred_languageempty,_build_response_preferences_sectionstill returns""at default verbosity, and the UI-language sentence is the original one.
No product regex and no new restriction.
|
@buluoray could you take another look? Your change request on 325b07c looks addressed at head 1f149c8:
The branch merges cleanly into main, and all checks pass apart from one macOS shard still running. |
buluoray
left a comment
There was a problem hiding this comment.
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:
APPROVE: the change request from 325b07c is fixed at 1f149c8. A sub-agent now keeps the follow-the-user reply sentence, and person-facing sessions still defer to the reply-language frame.
What it does for users: a Preferred Reply Language select under Settings → Chat → Response Verbosity pins the language the agent replies in. Someone who writes Chinese mixed with English terms stops getting replies that flip language from turn to turn. Auto, the default, adds nothing to the context.
Re-review item (sub-agents were pointed at a [RESPONSE PREFERENCES] block they never receive): fixed.
- output_contract.py:85 adds a frame_delivered parameter that defaults to False. _reply_language_clause (output_contract.py:138-152) defers only when frame_delivered is true and the code is listed.
- Both session-start call sites pass the same gate the frame itself uses: session_start.py:208-213 for the minimal run and session_start.py:375-380 for the full run, both via _response_preferences_apply(session_key, runtime_source). The frame's own delivery points, turn.py:113 and turn_message.py:512, use that same predicate. That predicate returns False for the sub-agent runtime source (sections.py:353-366).
- Mutation 1: I dropped "frame_delivered and" from the clause. Two tests went red: TestUiLanguageBlockDefers::test_without_the_frame_the_ui_block_keeps_follow_the_user and TestUiLanguageBlockDefers::test_a_subagent_session_keeps_follow_the_user (2 failed, 5 passed). The tree was clean after the restore.
- Mutation 2: I hard-coded frame_delivered=True at the full session-start call site. TestUiLanguageBlockDefers::test_a_subagent_session_keeps_follow_the_user went red (1 failed, 6 passed). The tree was clean after the restore.
Changes since 325b07c: I read them as a range-diff of the single commit, since the branch was rebased. They are the frame_delivered parameter and its two call sites, three new tests, and regenerated ui-index digests and counts. Against the merge base, the generated ui-index and settings-registry files remove nothing except the digest and coverage lines. I found no new defect.
Evidence:
- test/test_preferred_language_config.py plus test/test_context_composition_contract.py: 112 passed. ChatPanel.preferredLanguage.test.tsx: 8 passed.
- CI on this head: 91 success, 10 skipped, 1 failure. PR Readiness is success. The failure is macOS Backend Tests shard 6, in test_cloud_ssm_cov80.py::TestInstallCommandHint::test_deb_one_liner_reaches_sudo_only_on_a_matching_download[True], where the macOS sha256sum printed its usage text. That file is not in this diff and the test does not touch this code path. I did not check whether the same shard fails on other PRs.
- git merge-tree against current main exits 0.
Source-only: the minimal-context call site (session_start.py:208-213) is not covered by a test of its own. It uses the same expression as the full-run site, and I did not mutate it. I did not exercise a real sub-agent on a live gateway.
Non-blocking follow-ups:
- The config spec section on response preferences (config.md, after the verbosity paragraph) documents the "## Reply language" section but not that [UI LANGUAGE] changes its reply sentence when the frame is delivered. One sentence there would keep the spec in step with output_contract.py.
- A test that builds a minimal_context sub-agent session start would pin the second call site.
Problem / Motivation
Goal: Let the user pick one language the agent always replies in, so replies stop switching language from turn to turn.
Today the only language rule is "reply in the user's language", which the model judges per message. A user who writes Chinese mixed with English terms gets some replies in Chinese and some in English.
dashboard.languagechanges only the dashboard UI, not the replies.Why it matters
Mixed-language users are common (Chinese, Japanese, Korean and Hindi speakers who type English technical terms). They have no setting to stop the switching; the workarounds are memory notes that compete with every other memory fact and do not reach other workspaces.
Not a goal
[RESPONSE PREFERENCES]block).dashboard.language.What changed (motivation → approach → change)
A new Preferred Reply Language select sits under Response Verbosity on Settings → Chat.
Auto (match my message)is the default and keeps today's behaviour byte for byte.## Reply languagesection in[RESPONSE PREFERENCES]The section says: reply in that language even when the message mixes languages, switch only when the user asks in chat, keep code and identifiers verbatim, and keep commit messages, PR text, code comments and public posts in the project's own language. It outranks the levels' "user's language" line, and it applies at every verbosity level,
defaultincluded. With a reply language set, the[UI LANGUAGE]block's reply sentence points to[RESPONSE PREFERENCES]instead of telling the model to follow the message's language, so the two blocks never disagree. It defers only in sessions that receive the frame (_response_preferences_apply); a sub-agent never gets the frame, so it keeps the follow-the-user sentence.[UI LANGUAGE]is built once at session start, so a setting changed mid-session reaches it at the next session start.The approach reuses the existing trusted frame instead of a new block, because that frame already reaches every person-facing agent, cron included, and is re-injected after compaction. The language name comes from a fixed table (
PREFERRED_LANGUAGESinconfig/sections_dashboard.py), never from the stored value, so a hand-edited config cannot put free text into the frame. The codes are the dashboard's UI languages, so the picker shows each by its own name.dashboard.preferred_languageis a new config field (enum-checked), readable and writable throughGET/PUT /api/dashboard/config, and registered in the change-card catalog so the agent can offer the setting. The config spec,config-baseline.json, the settings registry, the UI index and all twelve locale catalogs (plus the pseudolocale) carry it.config/sections_dashboard.py,context_assembly/sections.py,context_assembly/output_contract.py,context_assembly/session_start.pydashboard/file_api/dashboard_config.py,dashboard/handlers/files.pychange_card_catalog_plans.pypages/settings/ChatPanel.tsx,chatPanelOptions.ts,useChatPanelDashboard.ts,pages/chat/ChatSettings.tsxdocs/settings-registry.generated.json,docs/ui-index.generated.json,components/commandPalette/settingsRegistry.gen.tswebsite/src/i18nlocale catalogsBackwards compatibility
Compatible: the field is new and defaults to
"", which adds nothing to the context; existingdashboard.verbositybehaviour and every existing PUT key are unchanged.Removes nothing: the diff only adds a field, a section, a select and catalog keys.
Tests
test/test_preferred_language_config.py: auto adds nothing; a set code emits the frame even atdefault; the rule names the language, holds through mixed messages and outranks the "user's language" line; unknown values (free text, pseudolocale, non-strings) inject nothing; the config enum, change-card plan and UI language list agree; load and PUT round-trip, and a PUT outside the list is a 400 that stores nothing; with bothdashboard.languageand a reply language set,[UI LANGUAGE]defers to[RESPONSE PREFERENCES], and unset it keeps its follow-the-user sentence byte for byte; asubagent:session start keeps the follow-the-user sentence with both settings set (a mutation dropping that gate reddens two tests).website/src/test/ChatPanel.preferredLanguage.test.tsx: the select offers auto then every shipped UI language by endonym, passes a stored code through, and narrows malformed values to auto.--sequence.shuffle(seeds 1-3).Local gates: related backend tests, isort, flake8, black gate, mypy, semgrep,
tsc -p tsconfig.app.json, eslint,lint:i18n, pseudolocale and UI-index checks all pass locally. The related backend set's only reds (file_explorer/tests/test_server.py,test_acp_*copilot, oneauto_improvementmembers test) fail identically on a cleanorigin/mainworktree on this host (scratch dir under~/.kiro/crew, no user namespaces).Manual verification
Opened Settings → Chat → Transcript on this branch's built dashboard, with
/api/**answered by the sharedwebsite/scripts/lib/stub-dashboard-api.mjsfixtures (this host has no user namespaces, so a live gateway stops at the sandbox page). The row renders under Response Verbosity, lists Auto then every UI language by its own name, and picking 简体中文 sendsPUT /api/dashboard/configwith{"preferred_language":"zh-CN"}and shows the new value, in light and dark.Screenshots / video
Default (Auto), light:
The options, light:
After picking 简体中文, dark:
Related Issues
Closes #31137
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)