Skip to content

feat(chat): let the user pick a preferred reply language - #31189

Merged
iamwhatever merged 1 commit into
mainfrom
feat/reply-language
Nov 7, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
feat/reply-language

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

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.language changes 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

  • Translating the agent prompt or any shipped prompt text.
  • Changing the reply language of sub-agents, whose final message is read by their parent agent (they already get no [RESPONSE PREFERENCES] block).
  • Free-text language names; only the dashboard's own UI languages are offered.
  • Coupling the reply language to 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.

Setting What the agent gets
Auto nothing new
a language a ## Reply language section 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, default included. 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_LANGUAGES in config/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_language is a new config field (enum-checked), readable and writable through GET/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.

Area Files
config + frame config/sections_dashboard.py, context_assembly/sections.py, context_assembly/output_contract.py, context_assembly/session_start.py
API dashboard/file_api/dashboard_config.py, dashboard/handlers/files.py
change cards change_card_catalog_plans.py
Settings UI pages/settings/ChatPanel.tsx, chatPanelOptions.ts, useChatPanelDashboard.ts, pages/chat/ChatSettings.tsx
generated docs/settings-registry.generated.json, docs/ui-index.generated.json, components/commandPalette/settingsRegistry.gen.ts
strings website/src/i18n locale catalogs

Backwards compatibility

Compatible: the field is new and defaults to "", which adds nothing to the context; existing dashboard.verbosity behaviour 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 at default; 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 both dashboard.language and a reply language set, [UI LANGUAGE] defers to [RESPONSE PREFERENCES], and unset it keeps its follow-the-user sentence byte for byte; a subagent: 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.
  • Determinism: the Python file (31 tests) passed 5 runs in 5 shuffled node orders (seeds 11-55); the vitest file passed 3 runs with --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, one auto_improvement members test) fail identically on a clean origin/main worktree 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 shared website/scripts/lib/stub-dashboard-api.mjs fixtures (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 简体中文 sends PUT /api/dashboard/config with {"preferred_language":"zh-CN"} and shows the new value, in light and dark.

Screenshots / video

Default (Auto), light:

Preferred Reply Language row set to Auto

The options, light:

Preferred Reply Language options: Auto, English, 简体中文, हिन्दी, Español, Français

After picking 简体中文, dark:

Preferred Reply Language row set to 简体中文 in dark mode

Related Issues

Closes #31137

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners November 6, 2026 07:21
@iamwhatever
iamwhatever requested a review from Zedmor November 6, 2026 07:21
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 1f149c82219d798962df3f00c87dc6e5a7f15fd1 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the change adds one opt-in field, defaults to today's behaviour, and reuses the existing [RESPONSE PREFERENCES] frame.

Notes

  • dashboard.preferred_language is set once for the whole gateway, the same way verbosity is. So every person-facing surface replies in the chosen language, including Slack and Discord channels where several people share one gateway. The hint text could say this, so an operator does not expect a per-person or dashboard-only setting.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 1f149c82219d798962df3f00c87dc6e5a7f15fd1 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • Item 2 — duplicate of src/kiro_crew/context_assembly/output_contract.py:52: PREFERRED_LANGUAGES repeats the 12 codes already in _UI_LANGUAGE_CATALOGS. That set is a "mirror of the non-dev-only SUPPORTED_LANGUAGES" with a test that fails if it drifts. Grepping "zh-CN", "hi", "es" finds 2 literal sites, plus the new dict, which makes 3. The base also says the raw tag is injected "so no second code→name list has to track SUPPORTED_LANGUAGES". Subtraction: build one set from the other (_UI_LANGUAGE_CATALOGS = frozenset(PREFERRED_LANGUAGES)), or drop the name table and put the raw tag in the rule, as [UI LANGUAGE] already does.
  • Item 5 — inherited: the change-card tuple ("", "en", "zh-CN", …) is a third hand-typed copy of the list. Subtraction: replace it with ("", *PREFERRED_LANGUAGES).

What this change ships

Inventory (7 items) — 5 justified

Intent: the user wants the agent to reply in one chosen language instead of switching every turn. This is an ADDITION.

  1. New "Preferred Reply Language" picker on Settings → Chat, defaulting to Auto — justified
  2. A chosen language adds a "Reply language" rule to [RESPONSE PREFERENCES], even at the default verbosity — duplicate of output_contract.py:52 (same code set)
  3. With a language set, [UI LANGUAGE] points its reply sentence at [RESPONSE PREFERENCES]; sub-agents keep the old sentence — justified
  4. New config key dashboard.preferred_language, read and written through GET/PUT /api/dashboard/config, rejects values outside the list — justified
  5. The agent can now offer the setting through a change card — rides along, hand-typed code tuple
  6. Settings search and UI-index entries for the new row — justified
  7. The label translated in all 12 locales plus the pseudolocale — justified

[FIRST-PRINCIPLES-REVIEWED] 1f149c8

Description read

[DESCRIPTION-READ] 4e68ee4c68a603a3073bc340245002751ef52d6c9dbf5d53af434356edf3097e

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 1f149c82219d798962df3f00c87dc6e5a7f15fd1 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • The open list for Preferred Reply Language pops upward and hides its own heading, so in shot-02 it looked "like the menu belonged to 'Text Link Patterns'". This comes from the shared SettingsSelect popover's placement, not from this PR. A follow-up could anchor the list below the trigger when there is room.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 1f149c82219d798962df3f00c87dc6e5a7f15fd1 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 1f149c8

Verdict parsed from the review's SHA-scoped output markers for commit 1f149c82219d798962df3f00c87dc6e5a7f15fd1.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 1f149c82219d798962df3f00c87dc6e5a7f15fd1 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 1f149c82219d798962df3f00c87dc6e5a7f15fd1 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 1f149c8

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 1f149c82219d798962df3f00c87dc6e5a7f15fd1 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 6, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

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.

@iamwhatever

iamwhatever commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Frontend Tests (4) red is main's: framerMotionMockStableTags flags website/src/test/ChatSidebar.boardRenameOfflineScope.test.tsx:33 from #10920, reproduced on a clean origin/main. Fix: #31279 (issue #31278). This PR waits for it, then rebases.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 6, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/docs/ui-index.generated.json and other overlapping files since this head's CI ran (f5340cc -> ef0422c); the new base carries the red-main fix #31279. CI re-running.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 6, 2026

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 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.language is 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_section drop or reword its reply sentence when dashboard.preferred_language names 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_language empty, _reply_language_rule returns "" (sections.py:325). The frame join at sections.py:396 then leaves the block byte-identical to main, and at default verbosity 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_message path (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:405 predates 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.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 6, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/docs/ui-index.generated.json (merge conflict, regenerated), config-baseline.json, the website/src/i18n locale catalogs and other overlapping files since this head's CI ran (ef0422c -> 8095bc3); CI re-running.

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 6, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased onto main 26c8238, which carries the red-main fix #31625 (security package line budget, issue #31648). This rebase is for that fix, not a green-age re-sync. CI re-running.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

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.

@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 7, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

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.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 7, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

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.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 7, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Resolved a merge conflict with main: website/src/pages/settings/useChatPanelDashboard.ts (main added new_chat_crew_mode to the fallback config; kept it alongside preferred_language) and the regenerated ui-index.generated.json. Rebased onto d27a5fd; head is now 378c9fd. Main's security line-budget red was fixed by #32252. Local: gen-ui-index --check up to date, uiLocations + ChatPanel vitest 421 passed, focused pytest 56 passed.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 7, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Merge conflict in the generated src/kiro_crew/docs/ui-index.generated.json again. Rebased onto main 6f786d9 and re-ran gen:settings + gen:ui; head is now 1f149c8. gen-ui-index --check up to date, the index diff vs main only adds this PR's rows, uiLocations + ChatPanel vitest 421 passed, focused pytest 50 passed.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_section takes frame_delivered (default False, the old sentence), and both call sites in session_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, and test_a_subagent_session_keeps_follow_the_user pins it for a subagent: session.
  • No free text reaches the trusted block. _reply_language_rule takes the language name from the fixed PREFERRED_LANGUAGES table and returns "" for auto or any unlisted code, so a hand-edited config value never lands in the prompt.
  • Unset changes nothing. With preferred_language empty, _build_response_preferences_section still returns "" at default verbosity, and the UI-language sentence is the original one.

No product regex and no new restriction.

@bolichen97

Copy link
Copy Markdown
Contributor

@buluoray could you take another look? Your change request on 325b07c looks addressed at head 1f149c8:

  • Sub-agents and [RESPONSE PREFERENCES]: _build_ui_language_section now takes frame_delivered, and both call sites in session_start.py pass _response_preferences_apply(session_key, runtime_source). A session that never receives the frame, a sub-agent, keeps "keep following the language the user writes in". test_a_subagent_session_keeps_follow_the_user builds the context for a subagent: session with preferred_language set and asserts that sentence.
  • Screenshot evidence: you already marked it fixed on 325b07c.

The branch merges cleanly into main, and all checks pass apart from one macOS shard still running.

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 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.

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.

feat(chat): let the user pick a preferred reply language

3 participants