Repository navigation
Description
Problem
On a fresh codeburn install (or after clearing ~/.cache/codeburn/session-cache.json), the OpenCode provider reports $0.00 / 0 calls despite having thousands of messages in the database.
Existing users with a pre-populated session cache are unaffected because cached data bypasses the fingerprint step.
Root Cause
SQLite-based providers (OpenCode, Goose) represent discovered sessions as compound paths:
/Users/me/.local/share/opencode/opencode.db:ses_abc123
In parseProviderSources, each source passes through fingerprintFile2(source.path), which calls stat() on the full compound path. No file exists at opencode.db:ses_abc123, so stat throws ENOENT, the function returns null, and the session is silently skipped:
const fp = await fingerprintFile2(source.path);
if (!fp) continue;
Since nothing ever gets parsed, nothing gets cached, and subsequent runs repeat the same failure indefinitely.
Why it's not widely reported
Once sessions are cached in ~/.cache/codeburn/session-cache.json, codeburn serves from cache and never calls fingerprintFile2 again for those entries. Users who:
- Built up their cache on a prior version before this regression, or
- Happen to have a populated cache from another install method
...never hit this path. Only fresh installs (e.g. Homebrew first-time users) or cache clears expose the bug.
Impact
- OpenCode provider is completely non-functional on fresh installs
- Goose provider likely has the same issue (uses identical compound path pattern)
- No error or warning is emitted — appears as if there's simply no data
- Distinct from codeburn does not report opencode #341 / Fix OpenCode router calls with missing usage #342, which addresses zero-usage messages inside the parser; this bug prevents sessions from reaching the parser at all
Suggested Fix
When stat() fails on the full path, strip the :sessionId suffix and stat the underlying DB file:
async function fingerprintFile2(filePath) {
try {
const s = await stat21(filePath);
return { dev: s.dev, ino: s.ino, mtimeMs: s.mtimeMs, sizeBytes: s.size };
} catch {
const colonIdx = filePath.lastIndexOf(':');
if (colonIdx > 0) {
const dbPart = filePath.slice(0, colonIdx);
try {
const s = await stat21(dbPart);
return { dev: s.dev, ino: s.ino, mtimeMs: s.mtimeMs, sizeBytes: s.size };
} catch {
return null;
}
}
return null;
}
}
Reproduction
- Install codeburn 0.9.9 fresh (e.g. brew install codeburn)
- Ensure ~/.cache/codeburn/session-cache.json has no pre-existing opencode entries (or delete it)
- Have OpenCode data at ~/.local/share/opencode/opencode.db
- Run codeburn status --provider opencode → $0.00, 0 calls
- Apply the fix → shows actual usage
Environment
- codeburn 0.9.9 (Homebrew)
- Node.js v26.0.0
- macOS
- OpenCode DB: 5000+ messages, 100+ sessions
Activity
Fix OpenCode/Goose returning 0 sessions on fresh install (#347)
iamtoruk commentedon May 18, 2026
Fixed in #347. The compound paths that SQLite providers (OpenCode, Goose) use for session discovery were failing stat() on fresh installs since no file exists at
db.path:sessionId. Now falls back to stat on the DB file itself.Please retry on main and let us know if it works for you.
aaguerreberre-indtx commentedon May 18, 2026
It worked.
Thank you!