Skip to content

fix: auto-title overwrites plugin session rename on first turn #32710

Closed as not planned

Description

@rcdailey

Description

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:

if (step === 1)
  yield* title({ session, ... }).pipe(Effect.ignore, Effect.forkIn(scope))

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

  1. Create a plugin that registers a tool calling client.session.update({ path: { id: context.sessionID }, body: { title: args.title } })
  2. Configure the agent to call this tool on every turn (e.g. via system prompt or AGENTS.md)
  3. Start a new session and send a message
  4. Observe the session title is the auto-generated one, not the plugin's title
  5. Send a second message in the same session
  6. Observe the plugin's title now sticks

Operating System

Fedora 44 (Linux 7.0.12)

Terminal

Ghostty

Activity

  1. added a commit that references this issue on Jul 9, 2026
    1e5107d
  2. github-actions commented on Aug 17, 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