Skip to content

Unnecessary Haiku calls on every user message for per-message title generation #13802

Description

@rmk40

summarizeMessage() in packages/opencode/src/session/summary.ts makes a small-model (typically Haiku) LLM call on every user message to generate a short per-message title stored in UserMessage.summary.title.

This is separate from the session-level title generated by ensureTitle() in prompt.ts, which runs once per session and populates Session.Info.title — the one shown in the session list.

The per-message summary.title is only consumed in one place: packages/ui/src/components/message-nav.tsx as a fallback label when getLabel is not provided. In practice, the main app always provides getLabel (which returns the raw prompt text), so summary.title is only reached on the enterprise share page tooltip. The TUI never displays it.

For a session with N user messages, this results in N unnecessary Haiku calls — one per message, every session, for every user.

Steps to reproduce:

  1. Start opencode, send multiple messages in a session
  2. Monitor API activity — observe a small-model call firing after each user message

The fix is to remove the LLM title generation from summarizeMessage() while keeping the diff computation intact.

Activity

  1. added
    perfIndicates a performance issue or need for optimization
    zenRelates to Zen
    on Feb 16, 2026
  2. rmk40 commented on Feb 16, 2026

    @rmk40
    ContributorAuthor

    For context on how this code got here: the per-message title generation was introduced in fb40dc6b2 ("generate user message title and body", Oct 24 2025) alongside a per-message body summary that used a second LLM call via the summary agent.

    In 71a7ad1a4 ("core: fix model selection in title generation to use user's model instead of assistant's", Jan 12 2026), the body generation was removed entirely — but the title call was left in. The summary.body field is still on the schema but has been dead code since that commit.

    This PR completes what that January cleanup started by removing the remaining per-message LLM call that isn't meaningfully consumed anywhere.

  3. rmk40 commented on Feb 16, 2026

    @rmk40
    ContributorAuthor

    Verified the desktop app is unaffected — it wraps packages/app, which always passes getLabel (raw prompt text) to MessageNav, so summary.title is never reached.

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

Metadata

Metadata

Assignees

Labels

perfIndicates a performance issue or need for optimizationzenRelates to Zen

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions