The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): branches of a collapsed stale tip nest under the live tip
brooklyn!83ee4bcba1dd
diff --git a/apps/desktop/src/lib/session-branch-tree.test.ts b/apps/desktop/src/lib/session-branch-tree.test.tsindex 15cce5de235..e79b753d780 100644--- a/apps/desktop/src/lib/session-branch-tree.test.ts+++ b/apps/desktop/src/lib/session-branch-tree.test.ts@@ -68,6 +68,17 @@ describe('flattenSessionsWithBranches', () => {])})+ it('nests a branch of a collapsed stale tip under the live tip', () => {+ const oldTip = session('old-tip', { _lineage_root_id: 'root', last_active: 30 })+ const tip = session('tip', { _lineage_root_id: 'root', last_active: 90, parent_session_id: 'old-tip' })+ const branch = session('branch', { last_active: 70, parent_session_id: 'old-tip' })++ expect(flattenSessionsWithBranches([oldTip, tip, branch])).toEqual([+ { session: tip },+ { branchStem: '└─ ', session: branch }+ ])+ })+it('keeps same-lineage ids from different profiles apart', () => {const work = session('tip', { _lineage_root_id: 'root', last_active: 20, profile: 'work' })const home = session('tip-home', { _lineage_root_id: 'root', last_active: 10, profile: 'home' })diff --git a/apps/desktop/src/lib/session-branch-tree.ts b/apps/desktop/src/lib/session-branch-tree.tsindex 40bedf33963..6448458d723 100644--- a/apps/desktop/src/lib/session-branch-tree.ts+++ b/apps/desktop/src/lib/session-branch-tree.ts@@ -82,6 +82,17 @@ export function flattenSessionsWithBranches(}}+ // A collapsed stale tip still names its conversation: its /branch children nest under the survivor.+ const survivorByLineage = new Map(sessions.map(session => [lineageKey(session), session]))++ for (const session of input) {+ const survivor = survivorByLineage.get(lineageKey(session))++ if (survivor && !byVisibleId.has(session.id)) {+ byVisibleId.set(session.id, survivor)+ }+ }+const childrenByParent = new Map<string, SessionInfo[]>()const nestedIds = new Set<string>()