Repository navigation
Add ai-chat rename, and stop tab titles sticking on "Loading..." - #2463
Merged
Merged
Conversation
1. ai-chat's title lives in its content field with no UI path to edit it. Add click-to-edit in the viewer header: click the title to get an input, Enter/blur commits, Escape cancels. Empty/whitespace-only titles fall back to "Untitled chat" for display (aiChatDisplayTitle), matching the sidebar's existing convention rather than the previous, different "AI Chat" fallback. The commit itself is a no-op write when the trimmed draft matches what's already stored (resolveChatTitleCommit). Both functions live in the new ai-chat-title.ts so the viewer and the sidebar's chat list can't drift on what "no title yet" means. 2. Root-caused the "Loading..." tab title that never updates: tab titles are computed live every render by computeTabTitle (tab-title.ts), driven reactively off the node in sharedNodeStore — so renaming already propagates to any open tab automatically, no push mechanism needed. The actual bug was computeTabTitle's own fallback: once a node is hydrated but resolves to no title (e.g. a brand-new ai-chat with empty content), it fell back to tab.title — the tab's OWN stale placeholder — which is exactly "Loading..." and never changes again. Now it falls through to formatTabTitle's own 'Untitled' default instead, which only ever applies once the node has genuinely loaded. Also: patches ai-chats.svelte's local list in place after a rename (updateChatContent) so the sidebar reflects it without a reload, and corrects a stale doc comment on NavigationService.FocusOrOpenOptions that claimed viewers replace the "Loading..." placeholder on mount — no viewer ever did; computeTabTitle is what actually replaces it. "A node that fails to load leaves the tab stuck" is not separately addressed: a node genuinely not found already closes its tab (pane-content.svelte), and a fetch that fails for daemon-connectivity reasons already retries via onDaemonReconnect — no new failure mode introduced here. Co-Authored-By: Claude <[email protected]>
Address review: computeTabTitle's hydrated-but-titleless fallback previously replaced tab.title unconditionally with the generic 'Untitled', not just the literal 'Loading...' placeholder it was meant to clear. That silently regressed the relationship picker's target tabs — relationship-grouping.ts's rowLabel falls back to a related node's raw id as a stable, distinguishing label when it has neither a title nor content, and relationship-viewer-modal.svelte passes that as the tab's initial title specifically so the tab bar shows something other than "Loading...". Once such a node hydrated, the id was discarded in favor of the same generic 'Untitled' every other titleless node would also show — the identical-placeholder-rows problem the fallback exists to avoid, reintroduced at the tab level. Added LOADING_TAB_TITLE (navigation.svelte.ts) as the one canonical value for the placeholder a new tab opens with. computeTabTitle now only replaces tab.title with the generic fallback when it's exactly that placeholder; any other caller-supplied title (real or a stable stand-in like an id) survives hydration unchanged. Not changed: pane-content.svelte's hydration-failure handling (the review's other finding, "a node that fails to load leaves the tab stuck"). A bounded retry-then-close there would fight the existing, deliberate onDaemonReconnect design, which waits indefinitely for the daemon to become healthy rather than giving up — exactly the mechanism a fresh-install boot race (the daemon's socket not bound yet) depends on. Closing the tab after one or two quick failures would reintroduce that exact hang as a regression of its own. Left as originally scoped: "not found" already closes the tab; a healthy daemon that still fails a single fetch has no repro or existing mechanism to hang off here. Co-Authored-By: Claude <[email protected]>
mstomar125
force-pushed
the
issue-2380-ai-chat-rename-and-tab-title
branch
from
September 8, 2026 10:12
10424a0 to
9a610b0
Compare
This was referenced Sep 8, 2026
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.
Summary
Closes #2380.
1. Rename an ai-chat node
An ai-chat's title lives in its
contentfield with no UI path to edit it. Added click-to-edit in the viewer header: click the title text, an input replaces it, Enter or blur commits, Escape cancels and discards the draft.aiChatDisplayTitle(newai-chat-title.ts): empty/whitespace-only content displays as "Untitled chat" — matching the sidebar's existing convention, not the previous, different "AI Chat" fallback the viewer used. The sidebar's localaiChatLabelhelper is deleted in favor of this shared one.resolveChatTitleCommit: returns the trimmed draft to persist, ornullwhen the trimmed draft is identical to what's already stored (a no-op write is skipped — it would otherwise bumpmodifiedAtand re-run the backend's mention extraction for nothing). Clearing a previously-set title returns''(notnull) — that's a real, intentional change that must persist.aiChatsData.updateChatContentpatches the sidebar's local chat list in place after a rename, mirroring howcreateChatalready does an optimistic local update — no reload needed.2. Tab title stuck on "Loading..." after load
Root-caused rather than patched: tab titles are already computed live on every render by
computeTabTitle(tab-title.ts), driven reactively off the node insharedNodeStore— so a rename already propagates to any open tab automatically, including tabs in the background, with no push mechanism needed. (I originally assumed no such live-recompute existed and started building one — it already exists,tab-system.sveltealready calls it per render.)The actual bug was
computeTabTitle's own fallback: once a node is hydrated but resolves to no title of its own (e.g. a brand-new ai-chat with empty content), it fell back totab.title— the tab's own stale placeholder — which is exactly"Loading...", and a genuinely titleless node never makespluginRegistry.getNodeTitlereturn truthy, so it never cleared. Now it falls through toformatTabTitle's own'Untitled'default instead, which is only reached once the node has actually loaded.This is a single, generic fix (not ai-chat-specific) — it applies to every node type opened with the
'Loading...'placeholder. After #2432 merged, all four of the placeholder's original call sites (3xnavigation-sidebar.svelte, 1xsearch-pane.svelte) were already consolidated into one function,NavigationService.focusOrOpenNode, whose stale doc comment ("viewers replace the placeholder on mount") is also corrected here to point atcomputeTabTitleinstead.Scoped out, with reasoning: "a node that fails to load leaves the tab stuck" — a node genuinely not found already closes its tab (
pane-content.svelte'shydrateNode), and a fetch that fails for daemon-connectivity reasons already retries viaonDaemonReconnect. No new failure mode is introduced by this PR, and I didn't find a concrete repro for an indefinitely-stuck tab beyond those two already-handled cases.Test plan
aiChatDisplayTitle/resolveChatTitleCommit(ai-chat-title.test.ts), each individually mutation-testedaiChatsData.updateChatContent, each individually mutation-testedcomputeTabTitletest re-verified via mutation testing (reverting to the old buggy fallback makes exactly the intended test fail, and only that one)bun run test— 233 files / 4908 tests passsvelte-check/tsc --noEmit/eslint— cleantest:all+cargo build --bin nodespaced+test:e2e) — green (took several retries due to unrelated system-load flakiness from 4 parallel agents doing heavy builds on this machine — 3 different failures across 3 unrelated subsystems never touched by this diff:model-store/browser-sync-servicefake-timer runaway,architecture-benchmarkstiming thresholds,packages/agent'spty::managerpruning timeout — all confirmed unrelated by file scope and by passing in isolation)🤖 Generated with Claude Code