mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-12-03 12:32:02 +00:00
fix(parser): isolate Claude per-file parse failures
The per-file failure isolation #441 added to the provider path was missing on the Claude path: a throw in groupIntoTurns/canonicalization propagated up and emptied the whole daily-history backfill. Wrap the per-file parse in try/catch + a failed marker, mirroring the provider path; one bad file no longer wipes the trend.
This commit is contained in:
parent
e7c0e21846
commit
f0768d4c32
1 changed files with 25 additions and 14 deletions
|
|
@ -1526,22 +1526,33 @@ async function scanProjectDirs(
|
|||
for (const { filePath, info } of changedFiles) {
|
||||
delete section.files[filePath]
|
||||
|
||||
const tracker = { lastCompleteLineOffset: 0 }
|
||||
const entries = await parseClaudeEntries(filePath, tracker)
|
||||
if (!entries) continue
|
||||
try {
|
||||
const tracker = { lastCompleteLineOffset: 0 }
|
||||
const entries = await parseClaudeEntries(filePath, tracker)
|
||||
if (!entries) continue
|
||||
|
||||
const turns = groupIntoTurns(dedupeStreamingMessageIds(entries), seenMsgIds)
|
||||
const cwd = extractCanonicalCwd(entries)
|
||||
const canonical = (cwd && !isCoworkSession(cwd, filePath)) ? await resolveCanonicalProjectPath(cwd) : undefined
|
||||
section.files[filePath] = {
|
||||
fingerprint: info.fp,
|
||||
lastCompleteLineOffset: tracker.lastCompleteLineOffset,
|
||||
canonicalCwd: canonical?.path,
|
||||
canonicalProjectName: canonical?.isWorktree ? projectNameFromPath(canonical.path, info.dirName) : undefined,
|
||||
mcpInventory: extractMcpInventory(entries),
|
||||
turns: turns.map(parsedTurnToCachedTurn),
|
||||
const turns = groupIntoTurns(dedupeStreamingMessageIds(entries), seenMsgIds)
|
||||
const cwd = extractCanonicalCwd(entries)
|
||||
const canonical = (cwd && !isCoworkSession(cwd, filePath)) ? await resolveCanonicalProjectPath(cwd) : undefined
|
||||
section.files[filePath] = {
|
||||
fingerprint: info.fp,
|
||||
lastCompleteLineOffset: tracker.lastCompleteLineOffset,
|
||||
canonicalCwd: canonical?.path,
|
||||
canonicalProjectName: canonical?.isWorktree ? projectNameFromPath(canonical.path, info.dirName) : undefined,
|
||||
mcpInventory: extractMcpInventory(entries),
|
||||
turns: turns.map(parsedTurnToCachedTurn),
|
||||
}
|
||||
;(diskCache as { _dirty?: boolean })._dirty = true
|
||||
} catch (err) {
|
||||
// A single malformed Claude session file must not abort the whole run — that
|
||||
// would empty the daily-cache backfill and wipe the trend/history (issue #441,
|
||||
// same isolation the provider path already has). Record a failure marker keyed
|
||||
// by the current fingerprint so it isn't re-read and re-thrown every run; it
|
||||
// re-parses only if the file changes.
|
||||
section.files[filePath] = { fingerprint: info.fp, mcpInventory: [], turns: [], failed: true }
|
||||
;(diskCache as { _dirty?: boolean })._dirty = true
|
||||
warnProviderParseFailure('claude', filePath, err)
|
||||
}
|
||||
;(diskCache as { _dirty?: boolean })._dirty = true
|
||||
}
|
||||
|
||||
if (dirs.length > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue