Description
Description
When automatic session title generation runs, it passes the full rendered message history to the title model via MessageV2.toModelMessagesEffect. If a memory MCP server injects prior conversation summaries or facts into the system prompt or as synthetic message parts, the title model receives that injected content and generates a title based on it rather than the actual user message.
Expected Behaviour
The title should reflect the content of the current user message only.
Actual Behaviour
The title reflects injected memory context from prior sessions. Starting a session with "hi" produced:
"Discussion on Workaround and GitHub Issue Regarding Roampal Data Location Setup and Patching cli.py"
— an accurate summary of the previous session's content, surfaced via memory context injection.
Root Cause
In packages/opencode/src/session/prompt.ts, the title generation constructs its payload as:
const context = input.history.slice(0, idx + 1)
messages: [
{ role: "user", content: "Generate a title for this conversation:\n" },
...yield* MessageV2.toModelMessagesEffect(context, mdl)
]
MessageV2.toModelMessagesEffect renders the full message including injected memory/system content. The title model then titles based on that rather than the actual user message.
Suggested Fix
Pass only the raw text of the first real user message to the title model:
const userText = firstUser.parts
.filter(p => p.type === "text")
.map(p => p.text)
.join("\n")
messages: [
{ role: "user", content: "Generate a title for this conversation:\n" + userText }
]
This strips all synthetic/injected parts before passing to the title model.
Plugins
roampal-core
OpenCode version
1.4.6
Steps to reproduce
- Configure a memory MCP server that injects prior session context into the conversation (e.g. Roampal, mem0, or similar).
- Start a new session with a short or unrelated message (e.g. "hi").
- Observe that the generated session title reflects content from a previous session rather than the current one.
Screenshot and/or share link
No response
Operating System
Windwos 11
Terminal
PWSH
Description
Description
When automatic session title generation runs, it passes the full rendered message history to the title model via
MessageV2.toModelMessagesEffect. If a memory MCP server injects prior conversation summaries or facts into the system prompt or as synthetic message parts, the title model receives that injected content and generates a title based on it rather than the actual user message.Expected Behaviour
The title should reflect the content of the current user message only.
Actual Behaviour
The title reflects injected memory context from prior sessions. Starting a session with "hi" produced:
— an accurate summary of the previous session's content, surfaced via memory context injection.
Root Cause
In
packages/opencode/src/session/prompt.ts, the title generation constructs its payload as:MessageV2.toModelMessagesEffectrenders the full message including injected memory/system content. The title model then titles based on that rather than the actual user message.Suggested Fix
Pass only the raw text of the first real user message to the title model:
This strips all synthetic/injected parts before passing to the title model.
Plugins
roampal-core
OpenCode version
1.4.6
Steps to reproduce
Screenshot and/or share link
No response
Operating System
Windwos 11
Terminal
PWSH