fix(tui): stabilize generated session titles - #39894
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Keep generated TUI session titles stable when title generation overlaps initial hydration and when multiple TUI processes share persisted tabs.
Before / After
Before
session.renameddelivers the generated title while the initial session read is still in flight.New sessionfallback.tabs.json.New session.After
Rename events reapply their title after initial hydration. Persisted titles are also treated as hints that an untitled local snapshot cannot downgrade, and tab normalization reruns against the latest file contents after acquiring the storage lock.
How
packages/tui/src/context/data.tsxwaits for session hydration before applyingsession.renamed.packages/tui/src/context/session-tabs.tsxprefers authoritative session titles, then persisted titles, then synthetic fallbacks.Scope
This supersedes the TUI hydration fix proposed in #39051 and adds coverage for the separate shared-tab persistence feedback loop. It does not redesign session sync keys or generic storage no-op handling.
Testing
bun run testfrompackages/tui: 578 passed, 5 skippedbun typecheckfrompackages/tuibunx prettier --check packages/tui/src/context/data.tsx packages/tui/src/context/session-tabs.tsx packages/tui/test/app-lifecycle.test.tsx packages/tui/test/context/session-tabs.test.tsxDemo
The deterministic concurrent-TUI regression reproduced repeated generated-title/default-title writes before the fix. After the fix, the shared file remains on
Generated titlefor the full observation window.Flow