diff --git a/src/renderer/src/components/tab-bar/tab-agent-types-by-tab-id.test.ts b/src/renderer/src/components/tab-bar/tab-agent-types-by-tab-id.test.ts index acaa5c86b77..727624abbef 100644 --- a/src/renderer/src/components/tab-bar/tab-agent-types-by-tab-id.test.ts +++ b/src/renderer/src/components/tab-bar/tab-agent-types-by-tab-id.test.ts @@ -146,6 +146,10 @@ describe('selectTabAgentTypesByTabId', () => { ).toEqual({ 'tab-1': 'claude' }) }) + it('treats a missing layout map as no unsafe split evidence during hydration', () => { + expect(selectNativeChatTabWideFallbackUnsafeTabsById()).toEqual({}) + }) + it('resolves the active leaf through nested splits and ignores expanded siblings', () => { const layout: TerminalLayoutSnapshot = { root: { diff --git a/src/renderer/src/components/tab-bar/tab-agent-types-by-tab-id.ts b/src/renderer/src/components/tab-bar/tab-agent-types-by-tab-id.ts index c97e373cea2..68d78a43ab3 100644 --- a/src/renderer/src/components/tab-bar/tab-agent-types-by-tab-id.ts +++ b/src/renderer/src/components/tab-bar/tab-agent-types-by-tab-id.ts @@ -64,8 +64,10 @@ export function selectTabAgentTypesByTabId( } export function selectNativeChatTabWideFallbackUnsafeTabsById( - terminalLayoutsByTabId: Record + terminalLayoutsByTabId: Record = {} ): Record { + // Why: legacy and hydrating store shapes may not expose layout state yet; + // absence carries no unsafe split evidence and must not crash tab rendering. const unsafeTabs: Record = {} for (const [tabId, layout] of Object.entries(terminalLayoutsByTabId)) { if (!isNativeChatTabWideFallbackSafe(layout)) {