Skip to content

feat: auto-generate session titles via the managed chat_title tool - #2351

Open
7Sageer wants to merge 7 commits into
mainfrom
auto-title
Open

feat: auto-generate session titles via the managed chat_title tool#2351
7Sageer wants to merge 7 commits into
mainfrom
auto-title

Conversation

@7Sageer

@7Sageer 7Sageer commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue — the problem is explained below.

Problem

Session titles are currently derived by truncating the first user prompt to 200 characters. Long or pasted prompts produce unreadable sidebar titles, and users must rename sessions by hand via /title. The managed platform already exposes a chat_title tool that generates a concise title from chat content, but the client never calls it.

What changed

Adds an experimental auto-title feature, gated by the auto-title experimental flag (off by default; KIMI_CODE_EXPERIMENTAL_AUTO_TITLE=1). With the flag on and a managed Kimi Code OAuth login, the session title is generated from the first prompt and replaces the truncated-prompt easy title a moment later. The prompt text sent is the already-sanitized lastPrompt (secrets are redacted by the existing prompt-metadata path), a custom title set by the user is never overwritten, and any failure degrades silently to the easy title. Users without a managed OAuth login (API key / third-party providers) are unaffected.

  • oauth: fetchChatTitle for the platform /tools chat_title method, following the existing managed-endpoint conventions.
  • agent-core (v1, default TUI engine): fire-and-forget generation when the easy title lands on the first prompt, then persist + session.meta.updated.
  • agent-core-v2: new sessionTitle domain (L6, Session scope) watching the easy-title session.meta.updated event on the session's own scope, with the same write-back semantics.
  • kap-server: POST /api/v1/sessions/{session_id}/title/generate for on-demand (re)generation (404 for unknown sessions, 40922 when generation is unavailable), so the web UI can offer a "regenerate title" action.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works (29 new tests across oauth / agent-core / agent-core-v2; full suites green; verified end-to-end against the production backend on both engines).
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update (experimental flag-gated feature; docs will follow when the flag is released).

With the auto-title experimental flag on and a managed OAuth login, the
session title is generated from the first prompt, replacing the
truncated-prompt easy title. A custom title set by the user is never
overwritten, and generation failures degrade silently to the easy title.

- oauth: fetchChatTitle for the platform /tools chat_title method
- agent-core (v1): fire-and-forget generation on the first prompt
- agent-core-v2: sessionTitle domain watching the easy-title event
- kap-server: POST /sessions/{id}/title/generate for manual regeneration
@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f66a0c5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

7Sageer added 6 commits July 29, 2026 16:15
Drop the automatic wiring on both engines: the v1 (TUI) first-prompt
trigger and the v2 easy-title event watcher. SessionTitleService's
generateTitle() stays as the single on-demand entry point behind the
auto-title flag, backing the kap-server title/generate route. The
changeset goes away too: with no shipped consumer, the remaining
surface is not user-perceivable.
@pkg-pr-new

pkg-pr-new Bot commented Jul 29, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@f66a0c5
npx https://pkg.pr.new/@moonshot-ai/kimi-code@f66a0c5

commit: f66a0c5

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.

1 participant