Description
The OpenCode provider discovers sessions correctly but fingerprintFile2() fails to stat() them because the source path format includes a colon-separated session ID suffix (e.g. opencode.db:ses_abc123). This causes all sessions to be silently skipped, reporting $0.00 / 0 calls.
Root Cause
In parseProviderSources() → fingerprintFile2(), the path is passed directly to fs.stat(). For SQLite-based providers (OpenCode, potentially Cursor), the source path format is dbPath:sessionId (set in discoverFromDb2):
// discoverFromDb2 sets path as:
return {
path: `${dbPath}:${row.id}`, // e.g. "/path/to/opencode.db:ses_xxx"
...
};
fingerprintFile2 tries stat("/path/to/opencode.db:ses_xxx") which fails → returns null → if (!fp) continue skips the session.
Workaround / Fix
In fingerprintFile2, add a fallback that strips the :sessionId suffix when stat() fails:
async function fingerprintFile2(filePath) {
try {
const s = await stat21(filePath);
return { dev: s.dev, ino: s.ino, mtimeMs: s.mtimeMs, sizeBytes: s.size };
} catch {
// Fallback for SQLite-based providers with colon-separated session IDs
const lastColon = filePath.lastIndexOf(":");
if (lastColon > 0) {
try {
const basePath = filePath.slice(0, lastColon);
const s2 = await stat21(basePath);
return { dev: s2.dev, ino: s2.ino, mtimeMs: s2.mtimeMs, sizeBytes: s2.size };
} catch {}
}
return null;
}
}
Environment
- codeburn v0.9.9 (npm)
- Node.js v22.18.0 (node:sqlite available)
- macOS 15 / darwin
- OpenCode SQLite DB:
~/.local/share/opencode/opencode.db (~1 GB, 16K+ sessions)
Impact
- OpenCode provider shows $0.00 for all periods
- After patch: correctly reports Today $0.39 / 198 calls, Month $34.83 / 1,642 calls
Description
The OpenCode provider discovers sessions correctly but
fingerprintFile2()fails tostat()them because the source path format includes a colon-separated session ID suffix (e.g.opencode.db:ses_abc123). This causes all sessions to be silently skipped, reporting$0.00 / 0 calls.Root Cause
In
parseProviderSources()→fingerprintFile2(), the path is passed directly tofs.stat(). For SQLite-based providers (OpenCode, potentially Cursor), the source path format isdbPath:sessionId(set indiscoverFromDb2):fingerprintFile2triesstat("/path/to/opencode.db:ses_xxx")which fails → returnsnull→if (!fp) continueskips the session.Workaround / Fix
In
fingerprintFile2, add a fallback that strips the:sessionIdsuffix whenstat()fails:Environment
~/.local/share/opencode/opencode.db(~1 GB, 16K+ sessions)Impact