Skip to content

feat(session): make generated titles optional - #39747

Merged
kitlangton merged 5 commits into
v2from
optional-session-title
Jul 31, 2026
Merged

feat(session): make generated titles optional#39747
kitlangton merged 5 commits into
v2from
optional-session-title

Conversation

@kitlangton

@kitlangton kitlangton commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

What

Sessions now remain genuinely untitled until automatic generation succeeds or a user explicitly renames them. New sessions store NULL, current and transitional API contracts omit title when absent, and App, TUI, CLI/ACP, export, search, terminal-title, subagent, and share surfaces derive their existing display fallbacks at the boundary.

Closes #39532.

Before / After

Before: creating a session persisted New session - <timestamp>. Domain code could not distinguish a generated or explicit title from placeholder copy without matching English strings, and that placeholder could not serve as a durable retry signal.

After: creating or forking an untitled session stores no title. Consumers display the appropriate new/child-session fallback without treating it as persisted state; successful generation and explicit renames still persist real titles.

How

  • packages/schema makes current and transitional session titles optional with the shared optional(...) helper, so generated clients omit absent keys instead of encoding null.
  • packages/core makes session.title nullable, maps SQLite NULL to undefined, and stops assigning fallback strings during create/fork.
  • The SQLite migration renames the old title column, adds the nullable replacement, copies existing titles, and drops the old column. It never drops or manually recreates the session table, its indexes, or its foreign-key relationships.
  • packages/app, packages/tui, packages/cli, and packages/enterprise derive fallback labels only where titles are rendered or exported.
  • packages/client was regenerated with bun run generate.

Scope

This PR establishes the durable untitled state and preserves historical fallback rows. Retry scheduling and explicit-title race protection are intentionally layered in #39748.

Testing

  • packages/core: bun typecheck
  • packages/core: bun run migration --check
  • packages/core: migration and session creation regressions
  • packages/schema: bun typecheck; contract hygiene tests
  • packages/client: bun typecheck
  • packages/cli: bun typecheck
  • packages/tui: bun typecheck; bun run test -- test/util/session.test.ts test/context/session-tabs-model.test.ts
  • packages/app: bun typecheck; focused session-title.test.ts
  • packages/enterprise: bun typecheck
  • App formatter benchmark: 150.20 ms for 10,000,000 consumed calls versus the recorded 237.89 ms baseline
  • Full Core run: 1,526 passed, 6 skipped; one unrelated local-environment failure because plugin discovery included ~/.config/opencode/plugins/voice.ts in a fixture expecting only its two invalid plugins
  • Full App run remains blocked by the pre-existing Arabic i18n parity failure documented during validation; the affected formatter test passes

Flow

flowchart LR
  Create[Create or fork session] --> Store[(SQLite title = NULL)]
  Store --> API[API omits title]
  API --> Display{Display boundary}
  Display --> Root[New session fallback]
  Display --> Child[Child session fallback]
  Rename[Generated or explicit rename] --> Persist[(Persist real title)]
  Persist --> API
Loading

@kitlangton kitlangton changed the title optional session title feat(session): make generated titles optional Jul 30, 2026
@kitlangton
kitlangton force-pushed the optional-session-title branch from 70567d5 to 5f8e8b8 Compare July 31, 2026 00:11
@kitlangton
kitlangton force-pushed the optional-session-title branch from 5f8e8b8 to 8eb2231 Compare July 31, 2026 00:44
@kitlangton
kitlangton merged commit eb95bd2 into v2 Jul 31, 2026
10 of 11 checks passed
@kitlangton
kitlangton deleted the optional-session-title branch July 31, 2026 01:24
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