Skip to content

[FEATURE]: Auto-generate session titles in desktop app #30926

Closed

Description

@raghavvvgaba

Description

In the OpenCode desktop app, new chats currently appear in the sidebar as "New session", even after the conversation has started.

This makes it hard to identify previous sessions when there are multiple chats.

It would be useful if the desktop app automatically generated a short title for each session based on the first prompt or conversation context, similar to Codex.

Expected behavior

After a session starts, "New session" should be replaced with a short meaningful title, for example:

  • Plan phase 2
  • Refine menu and dark mode
  • Fix dark mode issue

Current behavior

All new sessions stay labeled as "New session" in the sidebar.

Why this helps

It makes session history easier to scan and helps users quickly return to the right conversation.

Image

It is something requested from a very long time. I request the maintainers to assign this issue to me so I can fix it right away.

Activity

  1. github-actions commented on Jun 5, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Note: Auto-title generation already exists in OpenCode (based on the first message), so this may be specifically about the Desktop app not reflecting that title in the sidebar. If so, it may be more of a bug/display issue rather than a new feature — please clarify if that is the case.

  2. fdebane commented on Jul 6, 2026

    @fdebane

    Confirmed: this is a regression/intermittent bug, not a missing feature

    The compliance bot's own note hinted at this ("Auto-title generation already exists in OpenCode... may be more of a bug/display issue") - I have concrete evidence.

    Proof from session DB

    Querying my local opencode.db (v1.17.13), last 15 sessions:

    Title Created
    Find LID 2026 photos/assets (@explore subagent) 17:54:02
    New session - 2026-07-06T22:33:57.776Z 22:33:57
    New session - 2026-07-06T22:16:22.616Z 22:16:22
    New session - 2026-07-06T18:44:08.602Z 18:44:08
    New session - 2026-07-06T16:45:41.814Z 16:45:41
    ... (12 more all "New session - ") ...

    1 of 15 sessions got a real title; the other 14 stayed as the generic timestamp placeholder. Same opencode version, same day, same project. The title-generation feature exists and works - it just fails to fire on most sessions.

    What seems different about the one that worked

    The titled session was a subagent dispatch (@explore subagent, visible in the title text itself). This suggests:

    • Subagent sessions trigger title generation reliably (maybe because they have a clear initial instruction)
    • Top-level user sessions often don't get a title generated from the first message

    What to investigate

    1. Is title generation triggered by the first user message, the first assistant response, or only certain session types (subagent)?
    2. Is there a race condition where the title-update write gets dropped if the session tab is closed/backgrounded quickly?
    3. v1.16.0 changelog mentions "Fixed tab title truncation" - was something in that area broken since?

    Happy to provide more session data or test a fix if useful. This makes the desktop multi-session UX genuinely unusable - the sidebar is just a wall of identical "New session" entries.

  3. bibendi commented on Jul 15, 2026

    @bibendi

    I've got the same issue after upgrade of OpenCode Desktop today

    Image
  4. bibendi commented on Jul 16, 2026

    @bibendi

    Update: it doesn't work only on the new Desktop layout.

  5. liudongyan13701205717-source commented on Aug 9, 2026

    @liudongyan13701205717-source

    Same pain here — hundreds of sessions stay labeled "New session..." in the sidebar, which also makes finding past conversations harder (I filed #41354 about cross-session search). Auto-title from the first prompt helps both.

  6. fdebane commented on Aug 9, 2026

    @fdebane

    Root cause found (with reproducible evidence): silent small_model failure, swallowed and never retried

    Following up on my earlier comment from July 6 where I hypothesized a UI/race bug — I dug into the logs and found the actual cause. It's not intermittent, it's deterministic, and it's a config/provider issue masquerading as a missing feature.

    The mechanism

    Title generation runs exactly once per session, right after the first user message (ensureTitle in packages/opencode/src/session/prompt.ts). It resolves the model as: the title agent's model, else small_model from config, else the session model. If the LLM call fails, the error is swallowed by Effect.ignore (prompt.ts:1139) and never retried — on the next user message, history.filter(real).length !== 1 is false, so ensureTitle returns early forever. The session keeps New session - <timestamp> for life.

    Subagent sessions are unaffected because their title is set synchronously at creation (... (@agent subagent)), bypassing the title agent entirely — which is exactly the pattern I reported on July 6 (1/15 sessions titled, the titled one being a subagent dispatch).

    The evidence

    Grepping my local opencode.db (~/.local/share/opencode/opencode.db), every untitled top-level session had a matching error in ~/.local/share/opencode/log/opencode.log:

    level=ERROR message="stream error" providerID=fireworks modelID=glm-4p7-flash small=true agent=title error.error="AI_APICallError: Model not found, inaccessible, and/or not deployed"
    

    One stream error per untitled session, all naming the same small_model. In my case this had two layers:

    1. small_model pointed at fireworks/glm-4p7-flash, a model id Fireworks had retired (404 Model not found).
    2. The deeper blocker: the Fireworks account itself was suspended for billing (412 Account ... is suspended, possibly due to reaching the monthly spending limit). My main model ran on a different provider (OpenRouter), so the app worked fine — only small_model (on Fireworks) failed, silently, taking the session titles down with it.

    The fix (user-side)

    Point small_model at a live, independent provider. In opencode.json:

    "small_model": "openrouter/inclusionai/ling-2.6-flash"

    Cost is negligible (~0.01 USD/year for ~10 sessions/day). After restart, new sessions auto-title and the sidebar is usable again. I backfilled 21 past untitled sessions by generating a title from each session's first user message and updating session.title directly in the DB.

    Suggestion for maintainers

    The user-visible symptom ("wall of New session") is caused by a config/provider problem, but the fragility is in the title path itself:

    1. No retry. Title generation fires once and only once. If the LLM call fails for any transient reason (rate limit, timeout, a flaky small_model id, billing suspension), the session is permanently untitled. A retry on the next user message (relax the history.filter(real).length !== 1 guard to === 1 on first attempt, or retry while isDefaultTitle is true) would recover most of these cases.
    2. Silent failure. Effect.ignore on the forked title fiber means the error never surfaces — not even in the TUI. Logging the title failure (or surfacing a one-time warning when isDefaultTitle is still true after N messages) would make this self-diagnosable instead of a GitHub ticket.

    The diagnostic recipe for anyone hitting this: rg "agent=title" ~/.local/share/opencode/log/opencode.log — if you see stream error lines, your small_model (or its provider account) is the culprit, not the title feature.

  7. liudongyan13701205717-source commented on Aug 15, 2026

    @liudongyan13701205717-source

    Cross-link with #41363 (session tree/branch history) — both about session management/navigation. Auto titles (#30926) help a session tree (#41363) stay readable. +1, still relevant.

  8. Q1583 commented on Aug 21, 2026

    @Q1583

    这个需求太重要了,官方为什么就不能修复一下,多项目并行总是New session,根本分不清谁是谁,哪个在运行,稍微搞错了就将A项目弄到B项目里,浪费时间,而且特么容易对项目的上下文产生干扰

  9. neriousy commented on Oct 19, 2026

    @neriousy
    Member

    V2 automatically generates session titles from the first user message and updates them in the desktop UI. If the title model fails, it tries the primary model, and untitled sessions can retry on later messages. To get v2: npm i -g @opencode/cli@latest or curl -fsSL https://opencode.ai/v2/install | bash (desktop: update the app). If you still see this on v2, please open a new issue with the details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions