Skip to content

fix: write tips, session summaries and topic tags in the UI language - #19686

Merged
javenciu merged 2 commits into
mainfrom
fix/bg-prompts-follow-ui-language
Oct 13, 2026
Merged

javenciu merged 2 commits into
mainfrom
fix/bg-prompts-follow-ui-language

Conversation

@javenciu

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Feature tips, session summaries and topic tags appear in the language the user chose for the dashboard, not in whichever language their latest messages happen to be in.

Three background prompts produce text the dashboard shows and tell the model nothing about the UI language: the feature-tips prompt (_PROMPT_TEMPLATE in tips.py), the session-summary prompt (_PROMPT in dashboard/chat_summary.py) and the topic-tag prompt (_TOPIC_PROMPT_TEMPLATE in dashboard/chat_auto_tag.py). With no instruction the model mirrors what it is given: the user context for tips, the transcript for summaries, the first message for tags. A user who set the dashboard to zh-CN sees the heading, buttons and sidebar in Chinese beside a tip, a summary or a tag in English, or in whatever language the last pasted log was in. Home-screen suggestions and session titles already avoid this by taking the configured tag: _build_prompt (suggestions.py:112) and _build_title_prompt (dashboard/chat_title.py:640).

Why it matters

A summary is written once and kept in the transcript's sidecar until the transcript changes, and a topic tag is stored on the session, so a mismatched language stays on screen. The language also flips with the content a prompt reads, so the same dashboard shows one language today and another after a pasted stack trace. #19301 closed this for suggestions; #19530 records the prompts it left out.

Not a goal

  • The folder-suggestion prompt (dashboard/chat_folder_suggest.py), which Steer the remaining UI-visible background prompts by the UI language #19530 also lists. The model answers with a folder number or NONE (_parse_choice, dashboard/chat_folder_suggest.py:207), and the card payload takes the stored folder name and breadcrumb in maybe_suggest_folder (dashboard/chat_folder_suggest.py:391-392; module docstring, lines 15-16: "nothing generated reaches the card"). A language line there would change nothing a user sees, and the reply has to stay a bare number.
  • The link labels in dashboard/chat_nav.py. They are UI text, but Steer the remaining UI-visible background prompts by the UI language #19530 does not name them, so they are left for a follow-up.
  • Regenerating what is already cached when the language changes (tips for up to six hours, a summary until its transcript changes). Suggestions key their cache on the tag; these caches have other lifetimes and costs.
  • Translating keys and control values: a tip's id, feature and doc, the summary's JSON keys and status words, and the NONE reply.
  • A tip's cta_prompt. No page renders it; the card's type only declares the field (cta_prompt at website/src/components/TipCard.tsx:51), so the directive names the three fields the card shows.

What changed (motivation → approach → change)

  • Symptom: tips, summaries and topic tags follow the content's language, not the dashboard's (Steer the remaining UI-visible background prompts by the UI language #19530).
  • Root cause: the three prompts have no slot for the UI language, so the model has nothing to follow except its input.
  • Approach: the shape _build_title_prompt and the suggestions _build_prompt already use. A {language} slot sits outside the data the prompt carries, and is filled from the tag context.ui_language_tag returns (shape- and catalog-gated). An unset language, or a tag naming no shipped catalog, fills the slot with nothing, so the prompt is byte-identical to today's.
  • Change (8 files: 3 source, 3 test, 2 doc; source +83 −10, 23 of the added lines are comments; no catalog key added, since the changed text is model input and not a string a user reads):
    • tips.py:104 and tips.py:127: the slot, and a template asking for title, body and why in the tag's language while id, feature and doc stay as the catalog gives them (doc is matched against the catalog and is the dismissal identity). tips.py:1124-1133: generate_tips loads the config before building the prompt, reads the tag from it, and fills the slot.
    • The {language} slot before TRANSCRIPT (dashboard/chat_summary.py:146) and _LANGUAGE_TEMPLATE (dashboard/chat_summary.py:159), a template covering every free-text value while the JSON keys and status words stay as spelled (normalize_payload coerces an unknown status to active). _build_prompt (dashboard/chat_summary.py:169-176) fills the slot with str.replace on the constant alone (the prompt holds literal JSON braces), before the transcript is appended, so a transcript that quotes {language} cannot restate it. _generate_locked (dashboard/chat_summary.py:444) passes the tag from the config the pass already holds.
    • The {language} slot at the end of _TOPIC_PROMPT_TEMPLATE (dashboard/chat_auto_tag.py:92) and _LANGUAGE_TEMPLATE (dashboard/chat_auto_tag.py:101), a template that keeps NONE literal (a translated one would be stored as a tag; _parse_topic_tags drops only the ASCII word) and sizes unspaced scripts. _maybe_topic_tags (dashboard/chat_auto_tag.py:255-259) takes the tag from chat_title._ui_language() dispatched with asyncio.to_thread, which answers "" when the config read fails.
    • docs/system-specs/modules/session-summary.md and docs/system-specs/modules/learn-cron-dashboard.md (tips): state the behaviour and that cached output keeps its language until it regenerates.

Backwards compatibility

Compatible: with no dashboard.language set, or one naming no shipped catalog, the three prompts are byte-identical to de2d143dcf (I rendered each with the language unset on that commit and on this branch; the digests are equal). With one set, new tips and summaries are written in it and so are new topic tags. A tag is matched by its name, so a workspace that switches language holds debugging on older sessions and its translation on newer ones.
Removes nothing: no name, key, route, setting or string is removed; generate_tips only reads the config before building its prompt instead of after.

Tests

In short: with only the three changed or new test files copied onto origin/main de2d143dcf, the 18 new cases give 9 failed and 9 passed in 3 of 3 runs (the 9 that pass pin what main already does: no language line without a usable language, and the tips config load off the loop); on this branch the same command is 18 passed, and the three files are 134 passed, in 3 of 3 runs. Twelve mutations each fail only their own cases. Neighbours: 29 files, 3203 passed; ratchets 226 passed.

Test Locks in
test/test_tips_language.py test_prompt_carries_the_configured_ui_language (zh-CN, ja) the tag, the field names and the slot's place ahead of the catalog; no literal {language}
same file, test_prompt_keeps_the_identifying_fields_out_of_the_ui_language id, feature and doc stay as given
same file, test_prompt_has_no_language_line_without_a_usable_ui_language ("", ar, None) the follow-the-browser sentinel, a tag with no catalog and a hand-edited null add nothing, and the join is unchanged
same file, test_ui_language_is_read_off_the_event_loop no config load runs on the loop thread
test/test_session_summary_generate.py TestPromptFollowsTheUiLanguage (5 cases) the tag lands before the transcript; JSON keys and status stay; "" and ar leave the prompt as the constant with the slot removed; a transcript quoting {language} does not add a second language line
test/test_tag_session.py TestTopicTagsUiLanguage (6 cases) the tag reaches the topic prompt; NONE stays literal; no line for "" or ar or a config that cannot answer; the lookup goes through asyncio.to_thread

Red, pytest -n 0 -k ui_language on the three files in a detached checkout of origin/main de2d143dcf, RC=1 in 3 of 3 runs:

============ 9 failed, 9 passed, 116 deselected, 1 warning ============
FAILED test_tips_language.py::test_prompt_carries_the_configured_ui_language[zh-CN]   - 'BCP-47 tag zh-CN' not in the prompt
FAILED test_tips_language.py::test_prompt_carries_the_configured_ui_language[ja]      - 'BCP-47 tag ja' not in the prompt
FAILED test_tips_language.py::test_prompt_keeps_the_identifying_fields_out_of_the_ui_language
FAILED test_session_summary_generate.py::TestPromptFollowsTheUiLanguage::test_prompt_carries_the_configured_ui_language
FAILED test_session_summary_generate.py::TestPromptFollowsTheUiLanguage::test_the_json_keys_and_status_values_stay_out_of_the_ui_language
FAILED test_session_summary_generate.py::TestPromptFollowsTheUiLanguage::test_a_transcript_quoting_the_slot_cannot_restate_the_ui_language_line - assert 0 == 1
FAILED test_tag_session.py::TestTopicTagsUiLanguage::test_prompt_names_the_ui_language
FAILED test_tag_session.py::TestTopicTagsUiLanguage::test_the_none_control_word_stays_literal_under_a_ui_language
FAILED test_tag_session.py::TestTopicTagsUiLanguage::test_ui_language_is_read_off_the_event_loop - AttributeError: no attribute '_ui_language'

Green on this branch, the three whole files, RC=0 in 3 of 3 runs:

======================== 134 passed, 1 warning ========================

Mutations, one source line each, run against the 18 new cases (baseline 18 passed):

  • Tips: the fill dropped, 3 fail (the two configured-language cases and the identifier-clause case). The catalog gate bypassed with the raw config value, 2 fail (ar, None). A second config load on the loop, 1 fails (off-loop). The identifier clause removed, 1 fails.
  • Summary: the tag dropped, 3 fail (every case that needs the line to exist). The slot filled after the transcript is appended, 1 fails (the quoting case). The catalog gate bypassed, 1 fails (ar). The status clause removed, 1 fails.
  • Topic tags: the fill dropped, 2 fail. The lookup called on the loop, 1 fails. A language forced when none is usable, 3 fail. The NONE clause removed, 1 fails.

Neighbours: the 29 test files that name kiro_crew.tips, generate_tips, chat_summary, generate_session_summary, chat_auto_tag or maybe_auto_tag (git grep -l; they include the three changed files, test_tips.py and test_tips_edition_pool.py), 3203 passed. The wait-discipline, flake-pattern, pid-reader, tmpdir-helper, dir-fd-race, kill-chokepoint, agent-admission, ratchet-scope, main-ratchet-audit, fd-census and deferred-disposition ratchets: 226 passed.

Manual verification

N/A — unit coverage sufficient: the change is the text of three model prompts, and each test captures the prompt handed to run_bg_oneliner. A live call would exercise the model, not this change.

Related Issues

Refs #19530 (three of the four prompts the issue names; the folder-suggestion prompt is left as described under Not a goal, for the maintainer to close or split)
Refs #19301

Pattern harvest

Rule candidate: review-prompt
Pattern: a run_bg_oneliner prompt whose reply the dashboard renders, with no {language} slot filled from context.ui_language_tag.

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

Contribution License Agreement

Contributed under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

Feature tips, the session summary panel and the sidebar topic tags are
dashboard text, but their prompts carried no language instruction, so
the model mirrored whichever language the transcript or context was in.
Home-screen suggestions and session titles already follow
dashboard.language; these three did not.

Each prompt gets a {language} slot filled from the validated UI tag
(context.ui_language_tag). An unset or non-catalog language fills it
with nothing, so the prompt stays byte-identical to what it was. Keys
and control values keep their spelling: the tip id, feature and doc,
the summary JSON keys and status words, and the NONE reply for topic
tags.

The folder suggestion prompt is left alone: the model returns a folder
number, and nothing it writes reaches the card.
@javenciu
javenciu requested review from a team and KiroCrewCaptain as code owners October 13, 2026 05:18
@javenciu
javenciu requested a review from mbriones98 October 13, 2026 05:18
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of c68cdf94639c009c57e71eaba2437561c679ef6e — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Tips stay cached for up to six hours and that cache is not keyed on language, so check that a language switch showing old tips is acceptable.

[DESIGN-REVIEWED] c68cdf9

Description read

[DESCRIPTION-READ] 4c340f698e783c46f9eacf883042ebb570796edb45e0dd04bd06f20247b6482d

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 Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision c68cdf94639c009c57e71eaba2437561c679ef6e touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of c68cdf94639c009c57e71eaba2437561c679ef6e — 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/CONCERNS are advisory.

First-Principles-Verdict: PASS

This review's patch file also carried aws-control, registry.json and steer changes from #19783/#19800/#19795, which are already on main. Confirm the PR's own diff is just the 8 files it declares.

What this change ships

Inventory (5 items) — 5 justified

Intent: when someone has set a dashboard language, their feature tips, session summaries and topic tags come out in that language instead of the language of whatever they last typed or pasted. FIX (#19530; 9 of the 18 new cases fail on base).

  1. Newly generated feature tips' title, body and why follow dashboard.language — justified
  2. Newly generated session summaries' free text follows dashboard.language, while the JSON keys and status words stay as they are — justified
  3. New topic tags are written in dashboard.language, and NONE stays the literal word — justified
  4. With the language unset, or set to one without a shipped catalog, all three prompts stay byte-identical — justified
  5. generate_tips loads the config before it builds the prompt instead of after — justified

[FIRST-PRINCIPLES-REVIEWED] c68cdf9

Description read

[DESCRIPTION-READ] 90aacb354a20acca1ef7bf7a4bda6bb67db2343ec7657a9844b78a5a957e5b44

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 Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

Hindi and Bengali workspaces now get no topic tags at all; the language directive asks for a script the tag filter always rejects.

FINDING — src/kiro_crew/dashboard/chat_auto_tag.py:259 — when dashboard.language is "hi" or "bn" (both in _UI_LANGUAGE_CATALOGS), _LANGUAGE_TEMPLATE tells the model to write tags in Devanagari or Bengali script. The unchanged _TOPIC_TAG_RE ([^\W_][\w+#.-]*) does not match combining vowel signs, so डिबगिंग, कोड समीक्षा and ডিবাগিং all fail at line 218 and every tag is dropped. Before this change, an English message in that workspace still got English tags. → Fix: make the tag check accept combining marks (Unicode categories Mn/Mc), or leave out the language line for languages the parser cannot accept.

[OPUS-REVIEWED] c68cdf9

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable c68cdf94639c009c57e71eaba2437561c679ef6e: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] c68cdf9

False positive or not applicable? A repository writer can comment:
/ai-review override gpt c68cdf94639c009c57e71eaba2437561c679ef6e: <one-sentence reason>

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

Copy link
Copy Markdown
Contributor Author

Same fleet-queue shape as #19683: three attempts, no fleet runner in six hours, hosted lanes complete. Closing and reopening so the reopened event takes the hosted path. Details and the ask to maintainers are on #19683.

@javenciu javenciu closed this Oct 13, 2026
@javenciu javenciu reopened this Oct 13, 2026
@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 Oct 13, 2026
The off-loop test installed its recording shim through monkeypatch while the
patch_save_slot fixture already held asyncio.to_thread. An autouse fixture owns
that monkeypatch, so it unwinds after the fixture and puts the fixture's
synchronous mock back for every test that follows in the same process, which
then runs its own to_thread calls on the event loop. The shim now lives in a
context manager around the one call it observes, so the fixture's patch is the
last one standing and is undone on its own exit.
@javenciu

Copy link
Copy Markdown
Contributor Author

Pushed a test-isolation fix; closing and reopening again so CI runs on hosted runners (same fleet-queue shape as before).

@javenciu javenciu closed this Oct 13, 2026
@javenciu javenciu reopened this Oct 13, 2026
@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 readiness: checking Automated validation is still running labels Oct 13, 2026
@javenciu
javenciu enabled auto-merge (squash) October 13, 2026 12:49

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tier 1 auto-approve: fix (8 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: generated tips, session summaries and topic tags now take the configured dashboard language in their prompts, and an unset or unshipped language leaves each prompt unchanged. Spec files changed as a ride-along (a minority of the diff on both file count and changed lines), not reviewed as a design decision: docs/system-specs/modules/learn-cron-dashboard.md, docs/system-specs/modules/session-summary.md.

@javenciu
javenciu merged commit 77fd310 into main Oct 13, 2026
103 of 175 checks passed
@javenciu
javenciu deleted the fix/bg-prompts-follow-ui-language branch October 13, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants