From f50d8eb90efff2c18c59c9be5999218ef79fe7a0 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Wed, 25 Mar 2026 10:26:35 -0700 Subject: [PATCH] Deduplicate repos in loadAll to prevent repeated sessions Symlinks or multiple entries can resolve to the same repoRoot, causing duplicate sessions in the returned list. --- src/state.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/state.ts b/src/state.ts index fbbbf56..af1436f 100644 --- a/src/state.ts +++ b/src/state.ts @@ -61,6 +61,7 @@ export interface GlobalSession extends Session { export async function loadAll(): Promise { const sandlotDir = join(homedir(), ".sandlot") const all: GlobalSession[] = [] + const seen = new Set() let repoDirs try { @@ -89,7 +90,8 @@ export async function loadAll(): Promise { } } - if (repoRoot) { + if (repoRoot && !seen.has(repoRoot)) { + seen.add(repoRoot) try { const st = await load(repoRoot) for (const session of Object.values(st.sessions)) {