Skip to content

feat: generate session title suggestions from the rename dialog - #669

Merged
huichen merged 5 commits into
mainfrom
feat/session-title
Sep 16, 2026
Merged

huichen merged 5 commits into
mainfrom
feat/session-title

Conversation

@huichen

@huichen huichen commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

What

Session titles can now be summarized by the model only when the user asks for it, from the rename dialog on both Desktop and mobile:

  • The rename dialog gains an Auto-generate button. It calls the conversation's own selected model with at most the first three completed question–answer pairs (tools, reasoning, model-only context, and later turns excluded; each side capped at 2000 characters) and returns a title in the requesting UI language (zh/en), at most 32 display columns. 6–12 Chinese characters or 3–6 English words is preferred.
  • The suggestion is a draft: it fills the editable input, and only Save renames the session. Generating appends no message and starts no run.
  • Errors (no completed pairs, session model unavailable, model failure) leave the existing input untouched and surface inline; a late result cannot overwrite a closed/reopened dialog, and repeated clicks do not spend twice.

Why

An earlier iteration let the model decide on its own when to rename, controlled by a Desktop setting. Live testing with real models showed the trigger was unreliable: with the opt-in instruction the model renamed consistently on some turns, but missed mid-conversation enablement on some models, and when the instruction was shortened for prompt budget, misses increased further. Any variant also had to inject title state into the system prompt, which perturbs the cached prompt prefix.

The behavior is therefore now deterministic and user-driven, and the conversation prompt carries no title state or title instructions at all. Renaming- or UI-language changes cannot alter a session's system prompt.

Implementation

  • generate_session_title RPC (agent): independent tool-free model request, read-only. It builds context from the first three user/assistant exchanges and never runs the agent loop or writes to the session. It deliberately does not hydrate a cold session, because hydration can reconcile and persist a different model; it instead resolves the session's persisted/selected model and replaces nothing (unknown model → explicit error). Non-retryable 60s command policy, so the transport never double-spends a model call.
  • Desktop: generate_thread_title Tauri command + generateThreadTitle storage client, wired through useThreadDialogs (generation is guarded against duplicate clicks and scoped to the open dialog) and RenameDialog. The remote bridge forwards the same command for mobile.
  • Mobile: remote.generateTitle → catalog generate_title, and RenameModal gains the button, an in-flight state, and a pending-generation guard keyed to dialog open/target.
  • Removed: the opt-in autoSessionTitle/uiLanguage agent settings and their Desktop toggle/language sync, and the future session title CLI command. Conversations carry no title state or title instructions.
  • Docs: docs/internals/desktop/PRODUCT.md (settings/behavior) and ER.md (RPC and config ownership) updated.

Verification

  • Rust (future-agent, future-cli, future-rpc): fmt + clippy --all-targets -D warnings clean; tests pass (agent 1782 passed/1 ignored, cli 725, plus integration suites). New unit tests cover context selection (first three pairs only, no tools/reasoning/model context, per-side caps), tool-free localized generation, refusal to return a title on incomplete/empty/failed generation, and that an unavailable session model neither hydrates the session nor rewrites its stored model.
  • Desktop: tsc --noEmit, eslint, vitest 1080 passed. src-tauri: fmt + clippy clean, 1263 passed/1 ignored, including a new test that generation returns a draft without renaming and surfaces errors without touching the stored title.
  • Mobile: tsc --noEmit, eslint, and jest 1409 passed/1 failed. The single failure is MarkdownText layout and fidelity › large file previews virtualize blocks and bypass the shared message parse cache, which is pre-existing on main and macOS-only — the file and its test are byte-identical to origin/main and the "Mobile typecheck + lint + test" job passes on Linux CI for perf(mobile): responsive streaming, fewer wakeups, incremental rich Markdown #664/perf(mobile): pause covered chat rendering and bound file previews #665/chore: shorten the mobile sync notice and drop the claude/* branch convention #666. It is unrelated to this change and left untouched.
  • End-to-end against real models (isolated Agent on its own port, isolated HOME, no changes to the user's sessions or settings): the suggestion RPC returned localized titles from the session's model (e.g. 流式会话列表性能优化, Image zoom & streaming input) while session revision, entry count and run count stayed unchanged; only an explicit set_session_name with the suggestion updated the title. Sessions without completed pairs and sessions with an unavailable model failed explicitly with no fallback model and no mutation.

Notes

  • No new persisted preference and no migration.
  • Title generation costs one model call per user click, which the dialog states in its hint.

@huichen
huichen enabled auto-merge (squash) September 16, 2026 11:53
@huichen
huichen merged commit 3e7d9d8 into main Sep 16, 2026
12 checks passed
@huichen
huichen deleted the feat/session-title branch September 16, 2026 12:02
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