Skip to content

feat(titles): let users edit the naming style of chat titles - #46603

Open
amadsalmon wants to merge 1 commit into
kirodotdev:mainfrom
amadsalmon:feat/title-settings
Open

amadsalmon wants to merge 1 commit into
kirodotdev:mainfrom
amadsalmon:feat/title-settings

Conversation

@amadsalmon

@amadsalmon amadsalmon commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Problem / Motivation

Goal: Let users write their own naming style for chat titles, while the title prompt's safety rules stay fixed.

Kiro Crew names every dashboard chat with a background model call. The naming style (3 to 6 words, no quotes, no punctuation) is hardcoded, so a user who wants titles that lead with the repo or ticket, or that read "Fix dictation caret jump", cannot get them.

Why it matters

The sidebar is how people find a chat again. Generic 3-6 word titles do not follow the pattern a user scans for, and renaming by hand freezes the title so it stops following the chat.

Not a goal

What changed (motivation → approach → change)

One setting for dashboard chats, in Settings › Chat › Sessions after the title refresh interval: Title Instructions, stored as dashboard.title_instructions (trimmed, at most 1000 characters). Empty means the built-in instructions. The text box shows them, Reset to default puts them back, and "See the full prompt" shows both title prompts with the text in place.

Every title call (first, refresh, fork, "Regenerate title") reads the instructions from one off-loop config load, so a save applies to the next title. Titles still run on the background session with model="auto", as on main.

The two title prompts moved to src/kiro_crew/dashboard/chat_title_prompt.py. Each carries the instructions in a "Title style" block outside the transcript delimiters, ending with the limits the unchanged reply check enforces, so a custom style cannot ask for a title that is then thrown away. The SKIP and KEEP rules follow it. The unspaced-language hint moved into the built-in instructions. With nothing set, the first-title prompt changes only here:

-If the delimited topic is clear: reply with ONLY a short title (3-6 words). No quotes, no punctuation.
+Title style:
+A short title of 3-6 words. In a language written without spaces between words (zh, ja, th, ...), that is roughly 4-14 characters. No quotes, no punctuation.
+Whatever the style asks, the title is one line of at most 12 words (24 characters in a language written without spaces) and 80 characters, and it is never a sentence.
+
+If the delimited topic is clear: reply with ONLY the title, in that style.
 If NO (too vague, just greetings, or unclear topic): reply with exactly SKIP
 ...
-For a language written without spaces between words (zh, ja, th, ...), 3-6 words means roughly 4-14 characters.

The refresh prompt gets the same block, and its "reply with ONLY a short new title (3-6 words). No quotes, no punctuation." becomes "reply with ONLY a new title, in that style."

GET /api/chat/title-prompt (owner only, writes nothing) gives Settings the built-in instructions, their cap, and both prompts split around the instructions slot, so the browser holds no copy of the prompt; website/src/api/client/chat.ts calls it. The answer changes only with a gateway update or the dashboard language, so the query never goes stale on its own. Once a new dashboard.language is in force, from any writer, the gateway's config watcher (server_runtime/config_watch.py) pushes a config refresh frame. website/src/hooks/websocket/serverState.ts then re-reads the prompt in every open dashboard, the one that saved the language included, and again after a reconnect. The re-read keeps the cached answer until the new one arrives, so the editor stays mounted with its draft. TitleInstructionsSetting.tsx mounts the shared PromptInstructionsEditor from #46597. A save writes the stored value from the PATCH reply into the config cache, so the editor does not depend on the follow-up config read. A failed first load shows an error in place of the editor, with no hand-off to the agent, because leaving the page would discard the panel's unsaved drafts; a failed later read keeps the editor and its draft.

In src/kiro_crew/config, the setting is read through the loader (loader_builders.py, re-exported by loader.py) with its cap in sections_limits.py; the PATCH gate in core_config_schema.py refuses a value over the cap. change_card_catalog_kinds.py lists it as a setting that cannot widen what an agent may do, and route_access.py labels the new route. The help, hint and docs say the setting applies to dashboard chats and name the reply limits. New strings are in all 12 website/src/i18n catalogs, and src/kiro_crew/docs, config-baseline.json and the settings search files in website/src/components and website/scripts are regenerated or extended. Comments in chat_auto_tag.py, chat_summary.py, suggestions.py and tips.py name the language template's new module.

Backwards compatibility

Compatible: the setting is new and empty by default, which sends the built-in instructions. Titles keep running on the same model as before.

Removes nothing: no key, route or validator is removed or narrowed.

Tests

  • test/test_chat_title_prompt.py: in both prompts the instructions sit before the transcript and ahead of the SKIP/KEEP rules, custom instructions replace the built-in ones, and the reply limits follow them; with custom instructions and a UI language, no built-in length rule is left.
  • test/test_chat_title.py TestTitleCallSettings: custom instructions reach the first title and the refresh, both still on model="auto"; unset instructions use the built-in ones; a failed config read titles as an unconfigured install does.
  • test/test_title_refresh.py: the refresh tests stub the one config read.
  • test/test_config_patch_titles.py: instructions round-trip trimmed; a PATCH over the cap is refused and a hand edit over the cap is cut.
  • test/test_title_prompt_handler.py: the owner gets the instructions, the cap and both prompts split around the slot; anyone else gets 403.
  • website/src/pages/settings/TitleInstructionsSetting.test.tsx: the preview shows the edited instructions in both prompts; Save PATCHes dashboard.title_instructions; when the config read after a save fails, Reset then Save still sends ''; a failed first load shows only the error, with no "Ask the agent" hand-off; a failed later read keeps the typed draft; a config refresh frame swaps in the new language's prompts and keeps the typed draft in the same box; and a reconnect re-reads the prompt.
  • test/test_config_live_server_appliers.py: a dashboard.language change pushes one config refresh frame, and an unrelated key pushes none.
  • website/src/test/SettingsChatPanelCoverage.test.tsx, website/src/test/ChatPanel.railRegistry.test.tsx and website/src/test/settingsCoverage.test.ts: the Sessions page mounts the editor and the settings search indexes it as chat.title-instructions.

Manual verification

Rendered Settings › Chat › Sessions on an isolated ./dev-backend.sh gateway from this branch with #46597's editor (loopback, its own data home, a built and staged dist), captured with scripted Playwright. The capture host cannot build the agent's OS sandbox, so the harness stubbed only the /api/kiro-prerequisite status read to get past the setup gate; the Settings rows, GET /api/chat/title-prompt and the save were served by the real gateway. Seen: the box holding the built-in instructions; custom text typed, unsaved, with Save and Reset to default enabled and the full prompt showing the custom text in its "Title style:" block; and after Save, the box keeping the saved text with Save disabled, and GET /api/config/kirocrew returning it.

Real-machine verification

Machine: Amazon Linux 2 dev desktop, Linux 5.10 x86_64, 16 vCPU / 62 GiB, kiro-cli 3.8.2.

Method: one fixed conversation (a dictation caret bug in the kirocrew repo), English UI language. A harness imported this head's own prompt builders (_build_title_prompt, _build_refresh_prompt) and title validator (_validate_title_reply) and sent each exact prompt to a real model through kiro-cli, the way the background titler does: the tool-less kirocrew-lite agent, model auto, no tools trusted. Every raw reply went through the validator. The first title used the opening turn; the refresh used the whole six-message conversation and that run's first title as the current title. Each case ran 3 times. The full gateway path (create a chat, Regenerate title) could not run on this host: the agent sandbox here refuses the gateway's own nested user namespace (unshare(CLONE_NEWUSER) fails with EPERM), so no chat turn starts. The prompts and validator are the same code the gateway calls.

Model: auto (kiro-cli reports the requested model only, not the model it routed to).

Case Prompt Raw replies (3 runs) Kept by the guard? Final title
Before: Title Instructions empty first title Composer caret jumps after dictation · Dashboard composer caret jumping · Composer caret jumps after dictation 3 of 3 as replied
Before: Title Instructions empty refresh KEEP · KEEP · KEEP KEEP, title unchanged the first title
After: Start with the repo name, then a verb first title kirocrew: Fix dashboard composer caret jumping to end after dictation · kirocrew: Diagnose dashboard composer caret jumping to end after dictation · kirocrew: Fix dashboard composer caret jumping after dictation 3 of 3 (8-10 words, at most 74 characters, no sentence) as replied
After: Start with the repo name, then a verb refresh KEEP · KEEP · KEEP KEEP, title unchanged the first title

Every After title starts with the repo name and then a verb, and the guard dropped none of them. The default title on this head matches main: main's first-title prompt, sent the same way 3 times, gave Composer caret jumps after dictation twice and Dashboard composer caret jumps after dictation once, the same 4-6 words and style as this head with Title Instructions empty.

Cleanup: no setting was changed in any real config and no chat was created; the harness and its replies stayed in the agent's scratch folder, and the main checkout used for the comparison was removed.

Screenshots / video

Settings › Chat › Sessions, Title Instructions at rest:

Title Instructions at rest

Custom instructions typed and not yet saved: Save and Reset to default are enabled, and the full prompt shows them in the "Title style:" block:

Title Instructions edited and unsaved

After Save: the box keeps the saved text and Save is disabled again:

Title Instructions saved

Related Issues

Closes #46568

Checklist

  • A Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commits
  • 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

@amadsalmon
amadsalmon requested review from a team and KiroCrewCaptain as code owners December 3, 2026 12:44
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running labels Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of ce06733b68a456faafe6d63491b94e0775def7bb via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level concerns. The editable part is limited to the style block, the fixed limits and the SKIP/KEEP rules come after it, and the removed prompt constants have no code readers left in this tree.

[DESIGN-REVIEWED] ce06733

Description read

[DESCRIPTION-READ] 2143552430201d2388f1c4e8f20cf97597825786daf6f717fbd9e9acd8ebfbd1

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 Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of ce06733b68a456faafe6d63491b94e0775def7bb via the fork AI-review pipeline — 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

Nothing blocks. The new setting is off unless someone fills it in, and the one change to the built-in prompt (it now states the length limits the reply check already enforces) is declared in the description.

What this change ships

Inventory (10 items) — 10 justified

Intent: let a user decide how their dashboard chat titles read, while the prompt's safety rules stay fixed. This is an ADDITION.

  1. New "Title Instructions" text box in Settings › Chat › Sessions, with Reset to default — justified
  2. Custom instructions apply to the first title, refreshes, fork titles and "Regenerate title" — justified
  3. The built-in title prompt now states the reply limits, and the hint for languages without spaces moved into the built-in instructions — justified
  4. "See the full prompt" shows both title prompts with the user's text in place — justified
  5. New owner-only GET /api/chat/title-prompt route — justified
  6. Changing dashboard.language now sends a config refresh frame to every open dashboard — justified
  7. New config key dashboard.title_instructions (trimmed, 1000-character cap, the PATCH gate refuses longer values) — justified
  8. Settings search finds the row as chat.title-instructions — justified
  9. Title prompt text moved into chat_title_prompt.py — justified
  10. The key is listed among the settings that cannot widen what an agent may do — justified

[FIRST-PRINCIPLES-REVIEWED] ce06733

Description read

[DESCRIPTION-READ] 6a14e6fc549fc74335dc7a5ea49acffa3f7fb1a2b0691248b247ad26aac66019

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 Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

UX-level review of ce06733b68a456faafe6d63491b94e0775def7bb via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

cannot evaluate: missing the two error states this PR adds. If the first load fails, an inline error line takes the place of the whole Title Instructions row; if a save fails, an error line appears under the editor. No attached screenshot shows either one.

Evidence gaps

  • Failed first load. TitleInstructionsSetting.tsx shows only an ErrorNotice reading "Failed to load the title instructions", with no editor and no retry. Close it with a screenshot of Settings › Chat › Sessions while GET /api/chat/title-prompt fails.
  • Failed save. An ErrorNotice reading "Failed to save the title instructions" appears under Save / Reset to default. Close it with a screenshot after a refused PATCH, with the typed draft still in the box.

Notes

  • The three screenshots (built-in text, an unsaved edit with the full prompt open, after Save) show the editor and its states. No first-time reader saw them, because this fork-only lane does no blind read. A maintainer can push the branch to this repo to get one.
  • title_instructions_hint runs to four long sentences inside a tooltip. Keep the example ("Start with the repo name, then a verb") and the "not used / cut" limits. Drop "The rules shown under See the full prompt stay fixed", because the full-prompt toggle sits right under the box and already shows those rules.
  • The load-failure line gives no next step. Add a retry (for example "Try again", which re-runs the prompt query) so the row can come back without reloading the page.

[UX-REVIEWED] ce06733

Description read

[DESCRIPTION-READ] 4e9d72df6de0979e71369102082b2624d02a0cf8a1d891ab3176a8fac29ce0e9

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 Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed ce06733b68a456faafe6d63491b94e0775def7bb via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] ce06733

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — 🔴 changes requested (blocking)

Reviewed ce06733b68a456faafe6d63491b94e0775def7bb via the fork AI-review pipeline; updated in place on each push.

Adjudication upheld 1 of 1 blocking finding(s); those must be resolved before merging.

BLOCKING -- website/src/pages/settings/TitleInstructionsSetting.tsx:46 -- Failed prompt refreshes silently leave a stale preview

if (!prompt.data) {
Trigger: Another dashboard changes dashboard.language; the config refresh frame invalidates TITLE_PROMPT_QUERY_KEY, but the ensuing /api/chat/title-prompt request fails through retries.
Outcome: React Query retains cached data, bypassing the only load-error notice. “See the full prompt” displays the previous language directive without warning, while subsequent title calls use the new language.
Anchor: errors-use-error-notice
Fix: Render an inline ErrorNotice for failed refreshes independently of the empty-cache branch, keeping the editor mounted and preserving its draft without a hand-off.

[BLOCK-MERGE] ce06733
[GPT-REVIEWED] ce06733

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

The finding stays blocking (UPHOLD). The rule it cites carries blocking: true in the base-branch rules snapshot, and the fix costs less than the harm it prevents.

F1 — website/src/pages/settings/TitleInstructionsSetting.tsx:46 (patch L1871)

  • Harm: LOW to MEDIUM, and silent. Conditions confirmed: the prompt is never re-read once cached (staleTime: Infinity, patch L1856), and a config refresh frame invalidates it (serverState.ts, patch L1443). If that re-read fails, prompt.data keeps the old answer, so the if (!prompt.data) branch is skipped and the load-error notice never shows (patch L1871–1880). "See the full prompt" then shows the previous language directive with no warning. Recovery: only the next reconnect invalidation (patch L1451); nothing else retries.

  • Fix cost: small. One more inline ErrorNotice, rendered when the re-read failed and old data is still showing, next to the save-error notice at patch L1899. It needs no new state and keeps the draft protection.

  • Anchor: errors-use-error-notice has blocking: true in .review-base-rules/website-AUTOSDE.yaml:681. Weighing the fix against the harm gives the same answer anyway.

    [ADJUDICATION] ce06733 total=1 uphold=1 downgrade=0
    UPHOLD F1 website/src/pages/settings/TitleInstructionsSetting.tsx:46 reason=autosde-blocking-rule
    [GPT-ADJUDICATED] ce06733

@amadsalmon

Copy link
Copy Markdown
Member Author
  • return KiroCrewConfig.load().agent.resolve_model("title") span=bcccf99bf166

fixed in 58ed3ae: an unset title role now sends no model. _title_call_settings reads agent.role_models.get("title") or None from one config load, so run_bg_oneliner skips set_model and the title runs on the model the background session started on, as Optimize prompt does. TestTitleCallSettings asserts model=None for the first title and the refresh with only a Background pin set.
The Title Model row's unset option now names that model from the gateway (inherited_model from _background_session_model, which follows the background session's own start path), so the browser no longer claims a model the call does not use.

@amadsalmon

Copy link
Copy Markdown
Member Author
  • Save completion discards edits made while saving span=c742cb586c79

fixed in 58ed3ae: PromptInstructionsEditor.tsx is the shared editor, copied byte for byte from #46597 at 093ce87. It keeps an explicit edited-since-sync flag and the text the user's own Save will show, so a saved value replaces the box only while nothing was typed since the last sync, or when it is that Save's own text. Typing during a save, including undoing back to the old saved text, is kept.
Covered by PromptInstructionsEditor.test.tsx ("keeps an edit back to the old saved text while a save lands", "takes its own save when it lands, then follows later saved values again").

@amadsalmon

Copy link
Copy Markdown
Member Author
  • Both error notices omit the required hand-off decision span=f58e89fc219c

fixed in 58ed3ae: each notice in TitleInstructionsSetting.tsx now makes the decision explicitly. A failed first load (nothing cached, no draft) replaces the editor and offers askAgent. A failed re-fetch keeps the editor and its draft mounted and shows an inline notice that the full prompt and the Title Model's unset option may be out of date, with no hand-off. The save error has no hand-off either, and a comment says why: leaving the page to ask the agent would discard the unsaved draft.
Covered by TitleInstructionsSetting.test.tsx ("shows only the error when the first load fails", "keeps the typed draft when a later re-fetch fails").

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

Copy link
Copy Markdown
Member Author
  • Title Model ships against a recorded decision with no superseding entry span=c2bd82a8f732

needs-a-decision: @bolichen97, this is your call. Your 2026-11-23 decision keeps titles on the shared Background settings, and this PR's Title Model row reverses that clause. I asked for your ruling on the issue: #46568 (comment)
If you agree, I'll add a docs/decisions/ entry superseding the titles clause, citing your comment. If not, I'll remove the Title Model row (the agent.role_models.title key, the inherited_model field on GET /api/chat/title-prompt, and its Settings row) and keep only Title instructions. The PR body lists the exact files.

@amadsalmon

Copy link
Copy Markdown
Member Author
  • product-shape change without accepted RFC: titles get their own model, against a recorded decision span=31b275885b8c

needs-a-decision: @bolichen97, this is your call. Your 2026-11-23 decision keeps titles on the shared Background settings, and this PR's Title Model row reverses that clause. I asked for your ruling on the issue: #46568 (comment)
If you agree, I'll add a docs/decisions/ entry superseding the titles clause, citing your comment. If not, I'll remove the Title Model row (the agent.role_models.title key, the inherited_model field on GET /api/chat/title-prompt, and its Settings row) and keep only Title instructions. The PR body lists the exact files.

@amadsalmon
amadsalmon marked this pull request as draft December 3, 2026 19:27
@amadsalmon

Copy link
Copy Markdown
Member Author

Scope change: the Title Model row moves to a follow-up PR, once @bolichen97 rules on #46568 (comment). Until then titles keep the shared Background settings.

This PR keeps Title Instructions and imports the shared PromptInstructionsEditor from #46597 instead of carrying a copy. It is a draft until #46597 merges; then it will be rebased onto main and marked ready.

— Sent by an AI Agent on behalf of Amad

@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 Dec 3, 2026
@amadsalmon amadsalmon changed the title feat(titles): let users pick the title model and edit the naming style feat(titles): let users edit the naming style of chat titles Dec 3, 2026
@amadsalmon

Copy link
Copy Markdown
Member Author

The red i18n Render Gate (en-XA, head vs base) on 33bc99d is main's, not this PR's: it fails while exporting the base tree 74d0e37, where settings-registry.generated.json is stale (gen-ui-index: settings-registry.generated.json does not match the live settings extraction). That is tracked in #47829. This PR already carries the regenerated file for its own head. I'll rebase onto main once the fix for #47829 lands.

@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: checking Automated validation is still running labels Dec 5, 2026
@amadsalmon

Copy link
Copy Markdown
Member Author

Rebased: main moved in #47844 (the red-main fix for #47829), which conflicted in settings-registry.generated.json; took main's side ("guidable": false on chat.approval-mode-for-new-chats) and regenerated. This PR's chat.title-instructions entry is unchanged. New head: 7960a25.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Dec 5, 2026
bolichen97
bolichen97 previously approved these changes Dec 5, 2026

@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 on 20301f52cb. The maintainer (Bolin) accepted the one design point the Captain held for a person: dashboard.title_instructions joins _CANNOT_WIDEN_SETTINGS (an agent may propose it on a normal-risk card, which a person still presses) and the config PATCH schema. The text is capped at 1000 characters, the reply is format-checked, and the title call carries no tools.

Since my last review the branch was only rebased onto main; the one conflict was the generated settings-registry.generated.json, where main's side was taken and the file regenerated. The real-machine evidence (comment 7436730906) still stands.

@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 Dec 5, 2026
@amadsalmon

amadsalmon commented Dec 5, 2026 •

Copy link
Copy Markdown
Member Author

mechanism: LanguageProvider resets the title-prompt query when the gateway accepts a language write

  • Preview keeps the previous language's prompt after a language switch span=d2cbec37971a

fixed in 9b01519: TITLE_PROMPT_QUERY_KEY is now exported from website/src/api/client/chat.ts, and LanguageProvider.setLanguage calls queryClient.resetQueries on it when each PUT /api/config/theme resolves. The reset clears the cached prompt, cancels any fetch still in flight, and refetches a mounted preview, so the next read happens after the gateway reads the new dashboard.language.
Why this option: putting the language in the query key was tried in round 2 and removed, because the key changes on the click before the PUT lands and a fetch can cache the old prompt under the new key. Dropping staleTime: Infinity would still show the cached old prompt until the refetch returned, and a fetch made during the PUT could still return the old language.
Covered by TitleInstructionsSetting.test.tsx ("previews the prompt in the language the gateway reads once it accepts a switch"). It checks that the preview keeps the old prompt while the PUT is pending and shows only the French prompt once the PUT is accepted. Run against the old LanguageProvider, it fails.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Dec 5, 2026
bolichen97
bolichen97 previously approved these changes Dec 5, 2026

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

Re-approving on 9b01519a35 under Bolin's sign-off from earlier today. Since my approval on 20301f52cb the branch was rebased onto main again and took one fix from the Opus review: TITLE_PROMPT_QUERY_KEY is exported from website/src/api/client/chat.ts, and LanguageProvider.setLanguage resets that query when a language write is accepted, so the preview no longer keeps the previous language's prompt. That is a frontend cache fix inside this PR's own feature and does not touch the settings-list change Bolin signed. Auto merge stays on.

@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 Dec 5, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Dec 5, 2026
@amadsalmon

Copy link
Copy Markdown
Member Author

self-added: yes
mechanism: LanguageProvider reset the title-prompt query after each accepted language write (added for Opus d2cbec37971a); now removed
resolution: removed -- the reset is gone; a config refresh frame invalidates the query instead

  • Resetting the prompt query discards unsaved title instructions span=d7f009648496

fixed in ce06733: website/src/i18n/LanguageProvider.tsx is back to main's copy, so no resetQueries and no useQueryClient remain there. Nothing clears the title-prompt cache now. The only re-read is invalidateQueries from the config refresh frame and from the reconnect re-read in serverState.ts, and invalidation keeps prompt.data while it refetches.
Why the draft can no longer be lost: TitleInstructionsSetting replaces the editor only when prompt.data is empty. Once the first load succeeds, prompt.data stays set through every later read, whether that read succeeds or fails, so PromptInstructionsEditor stays mounted and keeps its useState draft.
Covered by TitleInstructionsSetting.test.tsx ("re-reads the prompt on a language change and keeps the typed draft"): after a config frame the preview shows the French prompts around the typed text, the textarea is the same element, and the draft is unchanged.

@amadsalmon

amadsalmon commented Dec 5, 2026 •

Copy link
Copy Markdown
Member Author

mechanism: the gateway pushes a config refresh frame when dashboard.language changes, and the frame's refresh targets include the title-prompt query

  • Another tab's language change leaves the full-prompt preview stale span=f58e89fc219c

fixed in ce06733: server_runtime/config_watch.py now has a dashboard.language applier that calls push_refresh("config"), the same pattern as the channels and command-bar switches. serverState.ts adds TITLE_PROMPT_QUERY_KEY to ALL_TARGETS and to the reconnect re-read. Before this, no frame announced a language change, so the refresh-target row alone would not have fired.
The frame is broadcast to every open dashboard, including the tab that made the write, and the config watcher sends it only after it has loaded the file with the new value. A re-read that the frame starts therefore reads the new language. A read that ran during the PUT is followed by this frame. A frame missed while the socket was down is replaced by the reconnect re-read. A CLI or $EDITOR change follows the same path.
Covered by test_config_live_server_appliers.py::test_a_language_change_tells_every_dashboard_to_refresh and by TitleInstructionsSetting.test.tsx (the config-frame and reconnect cases). Each of those two cases fails when its serverState.ts line is removed.

@bolichen97

Copy link
Copy Markdown
Contributor

Thanks @amadsalmon. I read the rebased ce06733b68 against the head I approved (9b01519a35). The two new pieces look right to me: the dashboard.language applier in config_watch.py that pushes a config refresh frame, and TITLE_PROMPT_QUERY_KEY in ALL_TARGETS plus the reconnect re-read in serverState.ts. Dropping the resetQueries from LanguageProvider also fixes the lost-draft finding.

The push dismissed my approval. One thing still blocks the merge: the GPT 6.1 Review finding on this head, which the adjudication upheld (errors-use-error-notice, blocking). After a config frame, if the title-prompt re-read fails, prompt.data keeps the old prompt. The if (!prompt.data) branch then never shows the load error. The suggested fix is small: show an inline ErrorNotice when the re-read failed while old data is still on screen (for example on prompt.isError && prompt.data), next to the save-error notice, and keep the editor mounted. A test for that case would close it.

When that head is green, I will approve again and turn auto merge back on.

AI-assisted, sent by Bolin Review bot

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chat titles: let me choose the title model and edit the naming instructions

3 participants