fix(tui): honor the auto_session_title experimental flag - #3169
Open
iosmanthus wants to merge 1 commit into
Open
fix(tui): honor the auto_session_title experimental flag#3169iosmanthus wants to merge 1 commit into
iosmanthus wants to merge 1 commit into
Conversation
The engine only generates an AI session title when a client asks for one. `kimi web` asks each time a turn settles; the TUI never asked. So "AI session titles" shows up in the TUI's /experiments panel, with a description promising that "clients auto-generate once the first turn completes", and turning it on there changes nothing — the session keeps the truncated first prompt as its name. Ask from `handleTurnEnded`, with the web client's policy: the `first_turn` excerpt, at most three attempts per session, and no further attempts once a title lands. Everything downstream is already wired — the engine refuses to overwrite a renamed or already generated title, and the `session.meta.updated` it publishes reaches the status panel and the terminal title through `handleSessionMetaChanged`. Also documents `KIMI_CODE_EXPERIMENTAL_AUTO_SESSION_TITLE`, which the env-var reference was missing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 501841d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Related to #2963 — this covers the AI-session-title part of that report. The two other
asks in it (hiding the third-party-provider OAuth error toast, and picking the node used
for titles) are out of scope here.
Note on process: #2963 has no maintainer
/approveyet. Happy to wait for one, or tosplit this into a separate bug issue first if you would rather have it filed that way —
the patch is small and can sit here in the meantime.
Problem
auto_session_titlegeneration is on demand only: the engine never starts one by itself,a client has to ask.
kimi webasks every time a turn settles, withgenerateSessionTitle(sessionId, { source: 'first_turn' })and a 3-attempt-per-sessioncap. The TUI never asks — there is no
generateTitle/generateSessionTitlecall siteanywhere under
apps/kimi-code, only the kap-server route and the klient facade.The TUI does list the flag in
/experiments, description included:So a CLI user reads "clients auto-generate once the first turn completes", turns the
switch on, and nothing happens. The session keeps the
titleKind: 'replaceable'titlethat
applyPromptMetadataUpdatederived from the first prompt, which the terminal titlethen truncates to 32 characters.
What changed
KimiTUI.handleTurnEndednow asks the engine for a title, with the same policy the webclient uses:
completed, so thefirst_turnexcerpt has both a userprompt and an assistant reply (the web client asks on any settle; restricting it to
completed turns keeps a cancelled first turn from naming the session)
source: 'first_turn'Nothing downstream needed changing. The engine already refuses to overwrite a
customorgeneratedtitle, skips the platform call entirely without a managed OAuth login, andpublishes
session.meta.updated, whichhandleSessionMetaChangedalready turns into thestatus-panel title and the terminal title.
Also adds the missing
KIMI_CODE_EXPERIMENTAL_AUTO_SESSION_TITLErow to the env-varreference (en + zh), which listed the other two
KIMI_CODE_EXPERIMENTAL_*flags but notthis one.
Verification
test/tui/kimi-tui-message-flow.test.ts: asks once on a completed turnand not again after a title lands, stays quiet while the flag is off, ignores a
cancelled turn, gives up after 3 unproductive attempts. Reverting the
kimi-tui.tschange fails 2 of them.
apps/kimi-codesuite: 3136 passed, 2 skipped, no regressions.tsc -p apps/kimi-code/tsconfig.json --noEmitclean;oxlintreports no new findings.KIMI_CODE_EXPERIMENTAL_AUTO_SESSION_TITLE=1, a fresh session's terminal title changedfrom the truncated prompt to
TypeScript readonly 数组与普通数组区别说明, and itsstate.jsonwent fromtitleKind: 'replaceable'to'generated'.Not included, happy to add if you want it in the same PR: the "on-demand regeneration in
the rename field" half of the flag description — a
/title --regenerate(or bare/titleon an already-titled session) that calls
generateSessionTitle({ force: true }).Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.