Skip to content

fix(core): generate session titles before model execution - #42067

Merged
kitlangton merged 1 commit into
v2from
early-session-title
Aug 12, 2026
Merged

fix(core): generate session titles before model execution#42067
kitlangton merged 1 commit into
v2from
early-session-title

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Generate a new root session's title as soon as its first admitted prompt becomes visible, instead of waiting for the first model step and its tool calls to finish.

This restores the responsive title behavior from V1 while preserving V2's durable prompt admission boundary: queued input does not trigger title generation until it is promoted.

Before / After

Before: the runner promoted the first prompt, completed the first model step and any local tool execution, then forked title generation. A tool-heavy first response could leave the fallback session title visible for minutes.

After: the runner promotes the prompt, forks title generation, and immediately continues into context loading and the main model request. The title and first model step run concurrently, and either title or model failure remains isolated from the other.

How

  • packages/core/src/session/runner/llm.ts starts the existing coalesced title fiber immediately after SessionPending.promote(...) reports newly visible input.
  • Removes the post-runStep title trigger.
  • Adds a regression test that blocks the first model stream indefinitely and verifies the session is renamed while that step is still running.
  • Updates retry coverage for the new title-first request ordering and verifies title generation still retries after both title and execution failures.

Scope

This does not generate titles for merely admitted queued prompts. It does not change title model selection, title content, truncation, or retry policy.

Testing

  • bun run test test/session-runner.test.ts from packages/core: 144 passing
  • bun typecheck from packages/core
  • Push hook: repository-wide bun turbo typecheck --concurrency=3, 32 tasks passing

Flow

sequenceDiagram
    participant Inbox as Durable prompt inbox
    participant Runner as Session runner
    participant Title as Title model
    participant Model as Main model

    Inbox->>Runner: Promote first eligible prompt
    Runner--)Title: Fork title generation
    Runner->>Model: Start first model step
    Title-->>Runner: Persist session rename
    Model-->>Runner: Stream response and tools
Loading

@kitlangton
kitlangton merged commit 930b075 into v2 Aug 12, 2026
12 of 14 checks passed
@kitlangton
kitlangton deleted the early-session-title branch August 12, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant