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.
This commit is contained in:
Resham Joshi 2026-10-05 23:40:45 +02:00 • committed by GitHub
parent 3afcbd9480
commit 75eff6e704
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View file

@ -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)

View file

@ -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()

View file

@ -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