Repository navigation
Description
Problem
A V2 session can remain permanently named New session - ... when its initial model step fails and another user message is admitted before a later step succeeds.
Title generation currently starts only after runStep completes successfully. Once it eventually starts, SessionHistory.firstUserMessageIfOnly declines to provide the first message if more than one user message now exists. The title attempt then returns silently and is not retried.
Reproduction
- Create a new V2 session using a model that fails its initial request, for example with
provider_model_unavailable. - Submit another user message before switching to a working model or otherwise recovering execution.
- Allow a later model step to complete successfully.
- Observe that the session retains its generated default
New session - ...title indefinitely.
No user prompt content or identifying session metadata is included in this report.
Root cause
packages/core/src/session/runner/llm.ts:startTitleOnce(sessionID)runs only afteryield* runStep(...)succeeds. A failed initial step exits before title generation starts.packages/core/src/session/history.ts:firstUserMessageIfOnlyreturnsundefinedonce a second user message exists.packages/core/src/session/title.ts: the missing first message causes a silent return.- The runner records that title generation started once invoked, so there is no later recovery attempt. Durable history also means the sole-user-message condition can never become true again.
Expected behavior
A recoverable initial model failure should not permanently prevent automatic session naming. After execution recovers, the session should receive a title based on its first user message if it still has the generated default title.
Suggested fix
Allow title generation to read the first user message even when later user messages exist, while guarding the rename on the session still having its generated default title. This preserves explicit user renames while closing the failed-first-step gap.
Add a regression test covering: failed initial step, second admitted user message, successful later step, automatic rename.
Activity
opencode-agent commentedon Jul 31, 2026
Addressed by #39748. Automatic title attempts now coalesce only while in flight rather than latching permanently, later successful executions can retry after an initial failure, and title generation reads the first user message even after later prompts arrive. Durable checks and a sequence-guarded rename ensure explicit/manual titles win, including races during generation. Focused runner and title regressions cover failure followed by recovery. Closing as resolved on the v2 branch.