feat(coding-agent): auto-generate session title via /rename#837
feat(coding-agent): auto-generate session title via /rename#837MikeeI wants to merge 1 commit intocan1357:mainfrom
Conversation
…rgument - /rename [title] now accepts optional argument - empty /rename triggers smol model to generate title from recent messages - unified title-system.md prompt with Handlebars (currentTitle, projectName) - shared callTitleModel() helper eliminates code duplication - shortSummary from compaction used as LLM context (not as title) - same-title guard prevents unnecessary updates - source set to 'auto' for generated titles (no accent color, no lock) - loading spinner while LLM generates title
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 034e4f786c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const source = wasManual ? "user" : "auto"; | ||
| const stored = await this.ctx.sessionManager.setSessionName(title, source); | ||
| if (!stored) { | ||
| this.ctx.showError("Session name cannot be empty."); |
There was a problem hiding this comment.
Distinguish locked auto-title from empty title
This branch treats any setSessionName() failure as an empty title, but SessionManager.setSessionName also returns false when source === "auto" and the current title was set by the user. Because /rename without args now always uses source: "auto", a user who previously ran /rename <title> cannot regenerate a title with /rename; they get the misleading Session name cannot be empty. error instead. Handle the user-locked case explicitly (or treat this user-invoked regeneration as a user-source rename) so the command behaves correctly.
Useful? React with 👍 / 👎.
Summary
/renamenow accepts an optional argument. When called without one, it auto-generates a session title using the smol model (commit/smol role) based on recent conversation context. Manual/rename <title>continues to work as before.Related: #658, #680
How it works
/renamebuilds a compact context summary from the session:shortSummaryif availablecompleteSimplewith a unified Handlebars promptsource: "auto"— no accent coloring, no auto-title lock/rename <title>setssource: "user"as beforeChanges
title-system.md{{currentTitle}}and{{projectName}}template varstitle-generator.tscallTitleModel()helper; addedregenerateSessionTitle()accepting a context summary string;cleanTitle()strips#heading markerscommand-controller.ts/renamewithout arg builds context summary, shows loading spinner, generates title; same-title guard prevents unnecessary updates;extractMessageText()helper for content extractionbuiltin-registry.ts/renamehint changed to[title](optional); handler delegates to controller for both modestypes.ts/interactive-mode.tshandleRenameCommand(title?: string)signatureCHANGELOG.md[Unreleased]Design decisions
source: "auto"for generated titles — no accent color, auto-title not locked. User can always override with/rename <title>(source: "user").maxTokens: 30output. The context cost is negligible.messagesmay be sparse. TheshortSummaryfrom the last compaction entry fills the gap.bun checkpasses (pre-existing ajv version mismatch invalidation.tsis unrelated)