You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: auto-title overwrites plugin session rename on first turn #32710
Plugin tools that rename a session via client.session.update() have no effect on the first turn of a new session. The title reverts to an auto-generated one. Calling the same tool on the second turn works fine.
The cause is a race in SessionPrompt.ensureTitle (packages/opencode/src/session/prompt.ts). On step 1 of the loop, auto-title is forked into the background:
The forked task checks isDefaultTitle(input.session.title) against the session object captured at the top of the loop iteration (line 1139), before any tools have run. On a new session this is always true, so auto-title proceeds to generate and set its own title via sessions.setTitle().
Meanwhile the main LLM stream runs, the model calls the plugin's rename tool, and the plugin sets the title through the HTTP API. The auto-title's LLM call finishes later and overwrites the plugin's title.
On the second turn, sessions.get() returns the session with the auto-generated title from turn 1. isDefaultTitle() returns false, auto-title bails out immediately, and the plugin's rename sticks.
The fix would be to re-read the session title from the DB before overwriting, or to skip auto-title when the title was explicitly set by a tool during the same turn.
Plugins
Custom plugin registering a session_rename tool (calls client.session.update)
OpenCode version
1.17.7
Steps to reproduce
Create a plugin that registers a tool calling client.session.update({ path: { id: context.sessionID }, body: { title: args.title } })
Configure the agent to call this tool on every turn (e.g. via system prompt or AGENTS.md)
Start a new session and send a message
Observe the session title is the auto-generated one, not the plugin's title
Activity
fix(session): don't let auto-title overwrite a title set mid-turn
github-actions commentedon Aug 17, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.