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

Closed
opened 2026-02-16 18:12:28 -05:00 by yindo · 2 comments
Owner

Originally created by @rmk40 on GitHub (Feb 16, 2026).

Originally assigned to: @thdxr on GitHub.

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.

Originally created by @rmk40 on GitHub (Feb 16, 2026). Originally assigned to: @thdxr on GitHub. `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.
yindo added the perfzen labels 2026-02-16 18:12:28 -05:00
yindo closed this issue 2026-02-16 18:12:28 -05:00
Author
Owner

@rmk40 commented on GitHub (Feb 16, 2026):

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.

@rmk40 commented on GitHub (Feb 16, 2026): For context on how this code got here: the per-message title generation was introduced in [`fb40dc6b2`](https://github.com/anomalyco/opencode/commit/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`](https://github.com/anomalyco/opencode/commit/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.
Author
Owner

@rmk40 commented on GitHub (Feb 16, 2026):

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.

@rmk40 commented on GitHub (Feb 16, 2026): 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 in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9444