From 75eff6e704a452aec9ca6a92b3ffc1cd01e79467 Mon Sep 17 00:00:00 2001 From: Resham Joshi <65915470+iamtoruk@users.noreply.github.com> Date: Mon, 5 Oct 2026 23:40:45 +0200 Subject: [PATCH] fix(compare): skip a provider whose discovery fails instead of exiting (#1643) compare's self-correction scan called discoverSessions() directly, so a provider that throws on purpose (Warp without Full Disk Access, a busy or locked SQLite store) killed the whole command with exit 1. The desktop Compare section then showed an error on every poll. Route it, the TUI compare and the dashboard provider probe through safeDiscoverSessions like every other command. --- src/compare.tsx | 4 ++-- src/dashboard.tsx | 4 ++-- src/main.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compare.tsx b/src/compare.tsx index 0012a215..0424462b 100644 --- a/src/compare.tsx +++ b/src/compare.tsx @@ -5,7 +5,7 @@ import type { ModelStats, ComparisonRow, CategoryComparison, WorkingStyleRow } f import { aggregateModelStats, computeComparison, computeCategoryComparison, computeWorkingStyle, findModelStat, projectSessionIds, scanSelfCorrections } from './compare-stats.js' import { formatCost, formatTokens } from './format.js' import { filterProjectsByName, parseAllSessions, setInteractiveScanUI } from './parser.js' -import { getAllProviders } from './providers/index.js' +import { getAllProviders, safeDiscoverSessions } from './providers/index.js' import type { ProjectSummary, DateRange } from './types.js' import { patchStdoutForWindows } from './ink-win.js' import { startUserTimingGuard } from './user-timing-guard.js' @@ -420,7 +420,7 @@ export function CompareView({ projects, onBack, presetModels, scopeToProjects }: const providers = await getAllProviders() const dirs: string[] = [] for (const p of providers) { - const sessions = await p.discoverSessions() + const sessions = await safeDiscoverSessions(p) for (const s of sessions) dirs.push(s.path) } const corrections = await scanSelfCorrections(dirs, scopeToProjects ? projectSessionIds(projectsRef.current) : undefined) diff --git a/src/dashboard.tsx b/src/dashboard.tsx index db1fef08..1924e962 100644 --- a/src/dashboard.tsx +++ b/src/dashboard.tsx @@ -14,7 +14,7 @@ import { aggregateModelTotals } from './model-breakdown.js' import { buildDurableOverviewFromNormalizedIndex, buildDurablePeriod, hydrateDailyCacheFromNormalizedProjects, type ExcludedGatewayTotals } from './usage-aggregator.js' import { loadDailyCache, type DailyCache } from './daily-cache.js' import { exitAfterCacheCleanup } from './session-cache.js' -import { getAllProviders } from './providers/index.js' +import { getAllProviders, safeDiscoverSessions } from './providers/index.js' import { classHeaderLine, classTotals, findingBasis, findingClass, scanAndDetect, type FindingClass, type WasteFinding, type WasteAction, type OptimizeResult } from './optimize.js' import { appliedFixGlyph, formatAppliedFix, type AppliedFix } from './act/types.js' import { aggregateFileChurn, buildCoachingNotes, computePricingCoverage, medianTimeToFirstEditMs, scanUserCorrections, worstOneShotCategory, type ReworkedFile } from './workflow-insights.js' @@ -1707,7 +1707,7 @@ export function InteractiveDashboard({ initialProjects, initialDailyHistoryProje let cancelled = false async function detect() { const found: string[] = [] - for (const p of await getAllProviders()) { const s = await p.discoverSessions(); if (s.length > 0) found.push(p.name) } + for (const p of await getAllProviders()) { const s = await safeDiscoverSessions(p); if (s.length > 0) found.push(p.name) } if (!cancelled) setDetectedProviders(found) } detect() diff --git a/src/main.ts b/src/main.ts index 636c691b..1e0a716e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,7 +8,7 @@ import { reportUnmatchedProjectPatterns } from './project-filter-warnings.js' import { getVercelGatewayApiKey } from './providers/vercel-gateway.js' import { BILLING_FILTER_VALUES, ROUTE_FILTER_VALUES, filterProjectsByBillingRoute } from './billing-filter.js' import { AGGREGATE_ONLY_PROVIDER, aggregateOnlyCostUSD, excludesAggregateOnlyProviders, parseAllSessions, filterProjectsByName, filterProjectsByDateRange, clearSessionCache, setInteractiveScanUI, computeCorpusFingerprint, isSessionHydrationComplete, startProgressKeepalive, stopProgressKeepalive, withLoadWindow } from './parser.js' -import { allProviderNames, getAllProviders } from './providers/index.js' +import { allProviderNames, getAllProviders, safeDiscoverSessions } from './providers/index.js' import { getProvider } from './providers/index.js' import { getClaudeConfigDirs, getDesktopSessionsDirs } from './providers/claude.js' import { convertCost, formatCost } from './currency.js' @@ -2546,7 +2546,7 @@ program const providers = await getAllProviders() const dirs: string[] = [] for (const provider of providers) { - const sessions = await provider.discoverSessions() + const sessions = await safeDiscoverSessions(provider) for (const session of sessions) dirs.push(session.path) } const scope = opts.project.length > 0 || opts.exclude.length > 0 ? projectSessionIds(projects) : undefined