Skip to content

fix(artifacts): one parsed sidecar per project — the read side of the #318 OOM fix - #335

Merged
itsdestin merged 1 commit into
masterfrom
fix/oom-read-fanout
Aug 27, 2026
Merged

fix(artifacts): one parsed sidecar per project — the read side of the #318 OOM fix#335
itsdestin merged 1 commit into
masterfrom
fix/oom-read-fanout

Conversation

@itsdestin

Copy link
Copy Markdown
Owner

Destin's live app died 2026-08-27 01:01:56 after 12h32m (and 2026-08-23 after
60h): V8 heap OOM at 2,801/2,825 MB. The core dump held 477 parsed copies of
youcoded-dev/.youcoded/artifacts.json (6.4 MB, 21,311 versions) ≈ 3.0 GB.
PR #318 queued the sidecar WRITER; all 20 read sites stayed unguarded, and
one Edit costs ~11 full parses (LIST_SESSION, artifacts:get per visible card,
check-existence, the watcher's id map, every open tab at startup).

readSidecarShared: one parsed copy per project, validated by size + mtime,
concurrent callers share one in-flight parse, a committed writeSidecar seeds
it with the object just written, idle copies drop after 60 s. Read-only
handlers use it; the five mutate-and-write paths keep the private readSidecar.

casWrite: the CAS comparand is read from a 4 KB head probe (regex, no parse)
with a whole-file fallback — the old extractor JSON.parsed 6.4 MB to read one
timestamp on every write.

Reproduced against Destin's real file (now 6.9 MB / 22,017 versions), one
process, --max-old-space-size=2800:
old N=60: 60 parses, peak heap 1,188 MB
old N=477: FATAL ERROR: Ineffective mark-compacts near heap limit
new N=477: 1 parse, peak heap 25 MB

Guards: tests/artifacts/sidecar-cache.test.ts (burst = one parse, seeded
after write, external change re-parses, corrupt backed up once, idle drop),
cas-write.test.ts (head probe, fallback), artifact-store.test.ts (zero
JSON.parse on the CAS path). verify.sh green: tsc, full suite, knip, eslint,
ast-grep.

Investigation: docs/active/investigations/2026-08-27-artifacts-sidecar-oom-crash.md
The rest of the bug class (transcript replay, Android's missing write queue)
is specced and paused: docs/active/specs/2026-08-27-paged-history-and-read-hardening-design.md

🤖 Generated with Claude Code

https://claude.ai/code/session_01H7YhBJVwWP2iwohNEUSmyY

…318 OOM fix

Destin's live app died 2026-08-27 01:01:56 after 12h32m (and 2026-08-23 after
60h): V8 heap OOM at 2,801/2,825 MB. The core dump held 477 parsed copies of
youcoded-dev/.youcoded/artifacts.json (6.4 MB, 21,311 versions) ≈ 3.0 GB.
PR #318 queued the sidecar WRITER; all 20 read sites stayed unguarded, and
one Edit costs ~11 full parses (LIST_SESSION, artifacts:get per visible card,
check-existence, the watcher's id map, every open tab at startup).

readSidecarShared: one parsed copy per project, validated by size + mtime,
concurrent callers share one in-flight parse, a committed writeSidecar seeds
it with the object just written, idle copies drop after 60 s. Read-only
handlers use it; the five mutate-and-write paths keep the private readSidecar.

casWrite: the CAS comparand is read from a 4 KB head probe (regex, no parse)
with a whole-file fallback — the old extractor JSON.parsed 6.4 MB to read one
timestamp on every write.

Reproduced against Destin's real file (now 6.9 MB / 22,017 versions), one
process, --max-old-space-size=2800:
  old  N=60:  60 parses, peak heap 1,188 MB
  old  N=477: FATAL ERROR: Ineffective mark-compacts near heap limit
  new  N=477: 1 parse,  peak heap 25 MB

Guards: tests/artifacts/sidecar-cache.test.ts (burst = one parse, seeded
after write, external change re-parses, corrupt backed up once, idle drop),
cas-write.test.ts (head probe, fallback), artifact-store.test.ts (zero
JSON.parse on the CAS path). verify.sh green: tsc, full suite, knip, eslint,
ast-grep.

Investigation: docs/active/investigations/2026-08-27-artifacts-sidecar-oom-crash.md
The rest of the bug class (transcript replay, Android's missing write queue)
is specced and paused: docs/active/specs/2026-08-27-paged-history-and-read-hardening-design.md

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H7YhBJVwWP2iwohNEUSmyY
@itsdestin
itsdestin merged commit 9dc0d9c into master Aug 27, 2026
2 of 4 checks passed
@itsdestin
itsdestin deleted the fix/oom-read-fanout branch August 27, 2026 09:58
itsdestin added a commit that referenced this pull request Aug 27, 2026
docs(artifacts): the shared sidecar read (PR #335) — depth paragraph under Concurrency
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