Skip to content

Reduce Claude parser OOM risk (0.9.9)#335

Merged
iamtoruk merged 1 commit into
mainfrom
fix/oom-compact-entries
May 15, 2026
Merged

Reduce Claude parser OOM risk (0.9.9)#335
iamtoruk merged 1 commit into
mainfrom
fix/oom-compact-entries

Conversation

@iamtoruk
Copy link
Copy Markdown
Member

Summary

  • Compact JournalEntry objects immediately after JSON.parse, dropping text/thinking/tool_result blocks and retaining only fields needed for aggregation
  • Remove redundant hydrateCache() from status --format json and terminal status paths
  • Clear session cache between period parses in status --format json to avoid pinning both result sets
  • Harden compactEntry against malformed JSONL (null content elements, non-array content, non-string Skill inputs)

This is an emergency mitigation, not a full architecture fix. Very large month ranges still materialize full ProjectSummary.turns arrays. The streaming single-pass parser refactor remains the real fix.

Test plan

  • npm test -- --run (715/715)
  • codeburn status (terminal)
  • codeburn status --format json --provider claude
  • codeburn status --format menubar-json --period today --provider all --no-optimize
  • Menubar app refresh cycle
  • Low-heap smoke: node --max-old-space-size=1536 ... status --format json

Strip heavy fields from JournalEntry immediately after JSON.parse in the
JSONL hot loop. Keeps only what downstream consumers need: type, timestamp,
sessionId, cwd, compacted user text (2000 char total cap), assistant
model/usage/id, tool_use names with Skill and Bash inputs, and MCP
inventory attachments. Text, thinking, and tool_result blocks are dropped.

Also removes redundant hydrateCache() from status --format json and
terminal status paths, and clears the session cache between period
parses to avoid pinning both today and month result sets.

This is a mitigation, not a full fix. Very large month ranges still
materialize full ProjectSummary.turns arrays. The real fix is the
streaming single-pass parser refactor.
@iamtoruk iamtoruk merged commit 041d933 into main May 15, 2026
3 checks passed
@iamtoruk iamtoruk deleted the fix/oom-compact-entries branch May 15, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant