Skip to content

feat: pin chat session name to prevent auto-renames#14864

Open
LWWZH wants to merge 1 commit into
CherryHQ:v2from
LWWZH:feat/pin-chat-session-name
Open

feat: pin chat session name to prevent auto-renames#14864
LWWZH wants to merge 1 commit into
CherryHQ:v2from
LWWZH:feat/pin-chat-session-name

Conversation

@LWWZH
Copy link
Copy Markdown
Contributor

@LWWZH LWWZH commented May 6, 2026

What this PR does

Before this PR:

  • Assistant topics supported isNameManuallyEdited internally, but there was no explicit UI to pin/unpin a name without renaming.
  • Agent sessions had no isNameManuallyEdited field at all, so they were always auto-renamed after each conversation turn.

After this PR:

  • Adds isNameManuallyEdited support to agent sessions (DB schema, migration, shared schema, service mapper, renderer types, and auto-rename guard).
  • Adds an explicit "Pin Name" / "Unpin Name" context-menu action to both assistant topics and agent sessions.
  • Shows a small inline pin icon next to pinned topic/session names for immediate visual feedback.
  • Renaming a topic or session via double-click or the Rename menu now automatically pins the name.
  • Prevents agent session auto-renaming from wasting an LLM API call when the name is pinned.

Fixes #14824

Why we need it and why it was done in this way

The user requested the ability to "pin" a chat session name so it won't be overwritten by automatic title generation. The existing isNameManuallyEdited field on Topic already provided the backend guard, but it was implicit (only set on manual rename) and agent sessions completely lacked it.

The following tradeoffs were made:

  • Unified behavior: Both topics and sessions now share the same pin/unpin UX and backend logic.
  • Auto-pin on rename: When a user manually renames, the name is automatically pinned. This matches user expectation that a manual rename should "stick."
  • No Redux migration: Existing topics without isNameManuallyEdited continue to work because the field is optional/falsy by default.

The following alternatives were considered:

  • Adding a separate "Pin" column or table — rejected because isNameManuallyEdited already exists for topics and is the simplest solution.
  • Only implicit pinning (rename = pinned) — rejected because the issue specifically asks to "pin," and users may want to pin an auto-generated name without renaming it.

Breaking changes

None. The new DB column has a DEFAULT false, so existing agent sessions are unaffected.

Special notes for your reviewer

  • Migration 0020_pin_session_name.sql adds is_name_manually_edited to agent_session. The _journal.json entry was also added manually.
  • The agentSessionRenameLocks in messageThunk.ts was moved before async I/O to prevent a race condition where concurrent messages could trigger duplicate LLM summaries.

Checklist

  • PR: The PR description is expressive enough and will help future contributors
  • Code: Write code that humans can understand and Keep it simple
  • Refactor: You have left the code cleaner than you found it (Boy Scout Rule)
  • Upgrade: Impact of this change on upgrade flows was considered and addressed if required
  • Self-review: I have reviewed my own code before requesting review from others

Release note

Added the ability to pin chat session names so they are no longer overwritten by automatic title generation. A "Pin Name" / "Unpin Name" option is now available in the context menu for both assistant topics and agent sessions. Manually renaming a session or topic will also automatically pin the name.

@LWWZH LWWZH requested a review from a team May 6, 2026 11:03
@LWWZH LWWZH requested review from 0xfullex and DeJeune as code owners May 6, 2026 11:03
@DeJeune DeJeune added the v2 label May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants