Skip to content

[Superseded by #1057] Generate conversation titles with a secondary model - #1056

Closed
PeterDaveHello wants to merge 11 commits into
masterfrom
feat/auto-session-title-mvp
Closed

[Superseded by #1057] Generate conversation titles with a secondary model#1056
PeterDaveHello wants to merge 11 commits into
masterfrom
feat/auto-session-title-mvp

Conversation

@PeterDaveHello

@PeterDaveHello PeterDaveHello commented Aug 28, 2026

Copy link
Copy Markdown
Member

Superseded by #1057, which rebuilds the implementation from a clean branch and carries forward the relevant review feedback.

Original summary

  • Replace locale-dependent date/time session names with an untitled display fallback using a stable YYYY-MM-DD HH:mm timestamp.
  • Let users opt in and select an enabled OpenAI-compatible chat model specifically for conversation-title generation.
  • Generate a semantic title from the first completed user/assistant exchange instead of truncating the first prompt line.
  • Keep both the beginning and end of long prompts so role instructions and boilerplate do not hide the actual task near the end.
  • Send one non-streaming request per new conversation, with a 64-token output cap and a 15-second timeout.
  • Reuse the selected provider's current endpoint and credentials without copying API keys into the title-model setting.
  • Protect conversation history and title updates with serialized storage mutations, generation IDs, stale-request recovery, and delete/race guards.
  • Preserve all existing non-empty titles; historical date titles are not automatically rewritten.

Refs #481 and #228.

Copilot AI lite review requested due to automatic review settings August 28, 2026 18:47
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in, OpenAI-compatible secondary model flow to automatically generate semantic conversation titles from the first completed exchange, while introducing safer session-title storage semantics and a stable timestamp-based “untitled” display fallback.

Changes:

  • Introduces session-title utilities for prompt shaping, response sanitization, grapheme-safe truncation, and timestamp display fallbacks.
  • Adds per-session title-generation state (claim/complete/fail) with serialized storage mutations and stale-request recovery.
  • Adds popup settings + storage-backed hook to select/enable a dedicated “conversation title model”, and wires auto-generation into the Independent Panel.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/unit/services/session-title.test.mjs Unit tests for title message building, sanitization, truncation, timestamp fallback, and request shaping.
tests/unit/services/local-session-title.test.mjs Concurrency/race tests for session updates vs title-generation state updates.
tests/unit/services/init-session-title.test.mjs Tests default/init behavior for new session title-generation metadata fields.
tests/unit/hooks/conversation-title-config.test.mjs Tests default config + persistence behavior (including stripping copied API keys).
src/services/session-title.mjs Implements title-generation request construction, response extraction/sanitization, and fallback display naming.
src/services/local-session.mjs Adds serialized session mutations + title-generation claim/complete/fail APIs and preserves stored title state on stale writes.
src/services/init-session.mjs Extends session schema to include title source and title-generation metadata.
src/services/conversation-title-model.mjs Adds availability check for the configured title model/provider (chat-only).
src/popup/sections/FeaturePages.jsx Adds UI controls to enable auto title generation and select a dedicated title model.
src/pages/IndependentPanel/App.jsx Wires title-generation lifecycle into session updates and displays fallback session names.
src/hooks/use-conversation-title-config.mjs Implements persisted storage + reactive hook for title-generation settings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/popup/sections/FeaturePages.jsx
Comment thread src/popup/sections/FeaturePages.jsx
Comment thread src/services/local-session.mjs

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Two things to address before merge: a transient title-generation failure permanently strands the conversation without a title (the new failed state is terminal and never retried), and the new settings strings bypass the localization pipeline — no keys were added to src/_locales/en/main.json or any other locale.

Reviewed changes

  • Title configuration hookuse-conversation-title-config.mjs persists autoGenerateConversationTitle + conversationTitleApiMode in storage.local, normalizes the api mode via canonicalizeApiMode, and strips any copied apiKey before saving so the runtime always re-resolves credentials from config.providerSecrets.
  • Title generation on first exchangeIndependentPanel/App.jsx starts a single non-streaming title request once a conversation has exactly one completed exchange, guarded by an in-flight Set, a serialized claim/complete/fail protocol with generation IDs, stale-pending recovery, and delete/race guards.
  • Popup settingsFeaturePages.jsx adds a checkbox + model selector limited to enabled OpenAI-compatible chat endpoints (native Anthropic/Azure/web modes don't resolve through resolveOpenAICompatibleRequest, so they are excluded as stated).
  • Prompt, sanitizer, requestsession-title.mjs builds a system+user transcript with grapheme-safe head/tail truncation, sanitizes the reply (reasoning blocks, code fences, labels), caps output at 64 tokens with a 15s timeout, and provides a stable YYYY-MM-DD HH:mm fallback display name for untitled sessions.
  • Session write safetylocal-session.mjs/init-session.mjs serialize mutations, preserve managed title state across stale conversation writes, and default new sessions to untitled (sessionName: null).
  • Tests — unit tests for the config hook, session metadata, the claim/complete/fail state machine, and prompt/request/sanitize behavior (20 tests, all passing locally).

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread src/services/local-session.mjs
Comment thread src/popup/sections/FeaturePages.jsx
Comment thread src/services/session-title.mjs
Comment thread src/services/session-title.mjs
@PeterDaveHello PeterDaveHello changed the title Generate conversation titles with a secondary model [Superseded by #1057] Generate conversation titles with a secondary model Aug 28, 2026
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.

2 participants