Skip to content

Session title silently empty when the title model is a reasoning model (returns only a <think> block) #42287

Closed as not planned

Description

@adaline-ankit

Description

ensureTitle() generates the session title with the small model (small: true).
When that model is a reasoning model (e.g. GLM-4.6 / Kimi K3 via OpenRouter), the
completion is frequently reasoning-only: after the <think>…</think> strip in
ensureTitle, the remaining text is empty. The function then hits if (!cleaned) return
and the session silently keeps its default New session - <timestamp> title.

It is intermittent (a reasoning model returns usable text on some turns, think-only on
others), which matches the "happens at times" reports below.

Affected code

packages/opencode/src/session/prompt.ts — ensureTitle():

const cleaned = text
  .replace(/<think>[\s\S]*?<\/think>\s*/g, "")
  .split("\n").map(l => l.trim()).find(l => l.length > 0)
if (!cleaned) return   // reasoning-only output -> empty -> no title, silently

Steps to reproduce

  1. Set the small/title model to a reasoning model (e.g. openrouter/z-ai/glm-4.6).
  2. Start a new session and send a normal message.
  3. On turns where the title model returns only reasoning, the title stays
    New session - <timestamp>.

Root cause

ensureTitle withholds the title whenever the model output is empty, instead of
falling back to a deterministic source. Reasoning-only output is the common trigger.

Related open issues

Same symptom: #13710, #31592, #34257, #30662.
Same underlying family (reasoning-only / empty output treated as a successful, empty
result): #37372, #41469, #41571.

Proposed fix

Fall back to the first user message when the model output is empty — the title is then
never withheld, regardless of why the model returned nothing. I have this change ready
and will open a PR referencing this issue.

Activity

  1. github-actions commented on Oct 13, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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