Skip to content

fix(tui): stop stale cached session title from pinning New Session - #5258

Merged
2 commits merged into
Hmbown:mainfrom
SparkofSpike:codex/session-title-fix
Aug 8, 2026
Merged

fix(tui): stop stale cached session title from pinning New Session#5258
2 commits merged into
Hmbown:mainfrom
SparkofSpike:codex/session-title-fix

Conversation

@SparkofSpike

@SparkofSpike SparkofSpike commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Session titles were stuck at "New Session" forever: after the first user message, the title computed from the conversation was overwritten by a stale copy held in the in-memory session metadata cache, and the cache itself is only refreshed at the end of each snapshot. A snapshot taken before the first user message pinned the placeholder, and every later snapshot restored it.

Changes

  • fix(tui): stop stale cached session title from pinning "New Session" (tui/ui/frame.rs): build_session_snapshot no longer restores the title from the cache unconditionally. Title now resolves in priority order: (1) the persisted disk record when the session already exists (a user rename applied through the session manager survives autosave — feat: sidebar sessions panel with auto-resume and session history browsing #2934 / v0.9.2 Control plane: multi-session dashboard with peek approvals #4397 behavior preserved); (2) the in-memory cache when no disk record exists for the session yet (sessions that have never been saved); (3) the title computed from the conversation (first user message). A placeholder that survived from an earlier snapshot yields to the computed title once a user message exists, healing both fresh and pre-existing sessions.
  • refactor(tui): centralize the placeholder title string (session_manager.rs, session.rs, session_resume.rs): the "New Session" placeholder is now the DEFAULT_SESSION_TITLE constant (5 usages replaced), so the healing rule in build_session_snapshot cannot drift from the generator.
  • test(tui): regression coverage (tui/ui/tests.rs): two new tests — a stale cached placeholder no longer overrides the generated title, and a persisted placeholder record yields to the computed title once the conversation has content. Both fail on the old code.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Tests

Testing

  • cargo test -p codewhale-tui stale_cached_placeholder_title — 1 passed
  • cargo test -p codewhale-tui persisted_placeholder_title — 1 passed
  • cargo test -p codewhale-tui picker_rename — 2 passed (rename survives autosave regression)
  • cargo test -p codewhale-tui full suite — 9708 passed; 10 failures verified unrelated: 6 pre-existing on main (verified via stash), 4 parallel-flaky (pass in isolation)
  • Manual testing: built codewhale-tui (debug), sent a first user message in a new session — title updated from "New Session" to the message content; renamed sessions keep their title across autosave

Checklist

  • Updated docs or comments as needed
  • Added or updated tests where relevant (2 regression tests)
  • Verified TUI behavior manually if UI changes
  • Harvested/co-authored credit uses a GitHub numeric noreply address

Related Issues

No-Issue: session title stuck at "New Session" after sending messages was found by myself, no relevant issues.

@SparkofSpike
SparkofSpike force-pushed the codex/session-title-fix branch from 41b64ed to 35c888b Compare August 7, 2026 09:39
@SparkofSpike
SparkofSpike marked this pull request as ready for review August 7, 2026 10:00
@SparkofSpike
SparkofSpike requested a review from Hmbown as a code owner August 7, 2026 10:00
@SparkofSpike

Copy link
Copy Markdown
Contributor Author

Well, the commits on main are landing way too fast for me to keep up, so I'll just leave this PR here as is.

Hi @Hmbown, when you're up, could you take a look and merge this manually? Maybe the CodeWhale Bot should create its own branch and batch several commits together before submitting — that would make this a lot easier to catch up with.

build_session_snapshot restored the title from the in-memory cache before
the disk lifecycle merge, and the cache is only refreshed at the end of
the function. A snapshot taken before the first user message therefore
pinned the placeholder title forever: every later snapshot overwrote
the conversation-derived title with the stale cached copy.

Title now resolves in priority order:
1. disk record, when the session already exists (user renames survive
   autosave, Hmbown#2934/Hmbown#4397);
2. in-memory cache, when no disk record exists for the session yet;
3. the title computed from the conversation (first user message).

A placeholder that survived from an earlier snapshot yields to the
computed title once a user message exists, healing both fresh and
pre-existing sessions. The placeholder string is centralized in
DEFAULT_SESSION_TITLE so the healing rule cannot drift from the
generator.

Regression tests: stale cached placeholder no longer overrides the
generated title; a persisted placeholder record yields to the computed
title. Existing picker-rename tests (rename survives autosave) still
pass. Full codewhale-tui suite: 9708 passed; 10 failures all verified
pre-existing on main (6) or parallel-flaky (4, pass in isolation).

Reviewed by a sub-agent reviewer: no Critical/Major findings; Minor
findings addressed (comments corrected, placeholder centralized, cache
assertions completed); one documented edge (a session deliberately
renamed to the literal placeholder title yields to the computed title).
@Hmbown

Hmbown commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Well, the commits on main are landing way too fast for me to keep up, so I'll just leave this PR here as is.

Hi @Hmbown, when you're up, could you take a look and merge this manually? Maybe the CodeWhale Bot should create its own branch and batch several commits together before submitting — that would make this a lot easier to catch up with.

That's a great idea - sorry - I've been trying to get this new release out and keep running into things I want to fix. I'm able to get this merged - don't worry! Thank you so much for this!!

I've just added a billion issues for 0.9.5 if you want to see where things are headed 🙂

Hmbown pushed a commit to SparkofSpike/CodeWhale that referenced this pull request Aug 7, 2026
- runtime-contract: regenerate tool_catalog for todo_write sole surface (plan/act/operate full/active now list todo_write, not work_update); bumps bytes/sha + prompt stages (agent plugins work)
- web: public-surface-contract expects todo_write (matches docs/RUNTIME_SIMPLIFICATION_DESIGN already)
- source-structure: 676325 -> 676652 (+327) — 321 for bf69e7f session-title fix plus 6 for stall/UI tweaks; durable test asset
- engine: raise no_user_input_continues 12 -> 20 (6 sites) to stop false 'hit (12)' stops on long todo_write loops; preserves anti-runaway
- subagent: GENERAL/PLAN intros now say todo_write, not work_update (child priming fix)
- palette: WHALE_TEXT_HINT #8491AA -> #8A99B3 (+0.4 contrast)
- tui: add BehavioralTipTodoWrite + 15 locale keys (hint: track with todo_write)
- subagent tests: fmt fixes for isolated_fleet_roster_with + assert! expansion

Refs: efcf47a, 21ed173, ec5747f, Hmbown#5258
@Hmbown
Hmbown force-pushed the codex/session-title-fix branch from 77a56cf to 301aa91 Compare August 7, 2026 11:10
Hmbown pushed a commit to SparkofSpike/CodeWhale that referenced this pull request Aug 7, 2026
- runtime-contract: regenerate tool_catalog for todo_write sole surface (plan/act/operate full/active now list todo_write, not work_update); bumps bytes/sha + prompt stages (agent plugins work)
- web: public-surface-contract expects todo_write (matches docs/RUNTIME_SIMPLIFICATION_DESIGN already)
- source-structure: 676325 -> 676652 (+327) — 321 for bf69e7f session-title fix plus 6 for stall/UI tweaks; durable test asset
- engine: raise no_user_input_continues 12 -> 20 (6 sites) to stop false 'hit (12)' stops on long todo_write loops; preserves anti-runaway
- subagent: GENERAL/PLAN intros now say todo_write, not work_update (child priming fix)
- palette: WHALE_TEXT_HINT #8491AA -> #8A99B3 (+0.4 contrast)
- tui: add BehavioralTipTodoWrite + 15 locale keys (hint: track with todo_write)
- subagent tests: fmt fixes for isolated_fleet_roster_with + assert! expansion

Refs: efcf47a, 21ed173, ec5747f, Hmbown#5258
@Hmbown
Hmbown force-pushed the codex/session-title-fix branch from 301aa91 to 9d24af7 Compare August 7, 2026 11:14
Hmbown pushed a commit to SparkofSpike/CodeWhale that referenced this pull request Aug 7, 2026
- runtime-contract: regenerate tool_catalog for todo_write sole surface (plan/act/operate full/active now list todo_write, not work_update); bumps bytes/sha + prompt stages (agent plugins work)
- web: public-surface-contract expects todo_write (matches docs/RUNTIME_SIMPLIFICATION_DESIGN already)
- source-structure: 676325 -> 676652 (+327) — 321 for bf69e7f session-title fix plus 6 for stall/UI tweaks; durable test asset
- engine: raise no_user_input_continues 12 -> 20 (6 sites) to stop false 'hit (12)' stops on long todo_write loops; preserves anti-runaway
- subagent: GENERAL/PLAN intros now say todo_write, not work_update (child priming fix)
- palette: WHALE_TEXT_HINT #8491AA -> #8A99B3 (+0.4 contrast)
- tui: add BehavioralTipTodoWrite + 15 locale keys (hint: track with todo_write)
- subagent tests: fmt fixes for isolated_fleet_roster_with + assert! expansion

Refs: efcf47a, 21ed173, ec5747f, Hmbown#5258
@Hmbown
Hmbown force-pushed the codex/session-title-fix branch from 9d24af7 to 192e84c Compare August 7, 2026 11:15
@SparkofSpike

Copy link
Copy Markdown
Contributor Author

No worries at all — shipping a release is way more important than keeping up with it. Thanks for merging it manually, really appreciate it!

- runtime-contract: regenerate tool_catalog for todo_write sole surface (plan/act/operate full/active now list todo_write, not work_update); bumps bytes/sha + prompt stages (agent plugins work)
- web: public-surface-contract expects todo_write (matches docs/RUNTIME_SIMPLIFICATION_DESIGN already)
- source-structure: 676325 -> 676652 (+327) — 321 for bf69e7f session-title fix plus 6 for stall/UI tweaks; durable test asset
- engine: raise no_user_input_continues 12 -> 20 (6 sites) to stop false 'hit (12)' stops on long todo_write loops; preserves anti-runaway
- subagent: GENERAL/PLAN intros now say todo_write, not work_update (child priming fix)
- palette: WHALE_TEXT_HINT #8491AA -> #8A99B3 (+0.4 contrast)
- tui: add BehavioralTipTodoWrite + 15 locale keys (hint: track with todo_write)
- subagent tests: fmt fixes for isolated_fleet_roster_with + assert! expansion

Refs: efcf47a, 21ed173, ec5747f, Hmbown#5258
@Hmbown
Hmbown force-pushed the codex/session-title-fix branch from 192e84c to 5de9b71 Compare August 7, 2026 11:18
@Hmbown Hmbown closed this pull request by merging all changes into Hmbown:main in fdac09b Aug 8, 2026
pull Bot pushed a commit to 1sLand99/CodeWhale that referenced this pull request Aug 8, 2026
- runtime-contract: regenerate tool_catalog for todo_write sole surface (plan/act/operate full/active now list todo_write, not work_update); bumps bytes/sha + prompt stages (agent plugins work)
- web: public-surface-contract expects todo_write (matches docs/RUNTIME_SIMPLIFICATION_DESIGN already)
- source-structure: 676325 -> 676652 (+327) — 321 for bf69e7f session-title fix plus 6 for stall/UI tweaks; durable test asset
- engine: raise no_user_input_continues 12 -> 20 (6 sites) to stop false 'hit (12)' stops on long todo_write loops; preserves anti-runaway
- subagent: GENERAL/PLAN intros now say todo_write, not work_update (child priming fix)
- palette: WHALE_TEXT_HINT #8491AA -> #8A99B3 (+0.4 contrast)
- tui: add BehavioralTipTodoWrite + 15 locale keys (hint: track with todo_write)
- subagent tests: fmt fixes for isolated_fleet_roster_with + assert! expansion

Refs: efcf47a, 21ed173, ec5747f, Hmbown#5258
pull Bot pushed a commit to 1sLand99/CodeWhale that referenced this pull request Aug 8, 2026
Aggregate 678400 -> 680500 (+2100) for stacked PRs Hmbown#5258, Hmbown#5205, Hmbown#5256, Hmbown#5257, Hmbown#5255 plus copilot runtime APIs (goal, verifier, memory with native_memory.rs new 1017 large, mcp, skill). Large 177->178.

Passes check-source-structure-budget.
pull Bot pushed a commit to 1sLand99/CodeWhale that referenced this pull request Aug 8, 2026
Record Shizuku's exact current PR head as v0.9.5 ancestry. The verified release tree already contains the equivalent session-title repair; the ours merge preserves the contributor's commit and GitHub provenance without replaying the older release integration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants