Skip to content

fix(gateway): ignore NODE_OPTIONS in the SEA binary to keep the V8 code cache valid#710

Merged
BYK merged 2 commits into
mainfrom
fix/sea-ignore-node-options
Jun 11, 2026
Merged

fix(gateway): ignore NODE_OPTIONS in the SEA binary to keep the V8 code cache valid#710
BYK merged 2 commits into
mainfrom
fix/sea-ignore-node-options

Conversation

@BYK

@BYK BYK commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Problem

The standalone lore binary emits Warning: Code cache data rejected at
startup — and silently recompiles its main script — for any user who has V8
flags in NODE_OPTIONS (e.g. NODE_OPTIONS=--max-old-space-size=8192, a very
common Claude Code setup).

The binary is a Node SEA with an embedded V8 code cache generated on CI with
default flags. V8 flags from NODE_OPTIONS change FlagList::Hash() at
runtime, so the runtime hash no longer matches the build-time default and V8
rejects the cache.

Diagnosed from a real report (Onur): same binary accepted on a machine with
no NODE_OPTIONS, rejected on one with NODE_OPTIONS V8 flags;
env -u NODE_OPTIONS lore made the warning disappear. (It was not the chip /
macOS version — both were Apple-silicon, same macOS.)

Fix

  • Bump fossilize to ^0.10.0.
  • Pass ignoreNodeOptions: true to fossilize() in runFossilize().

fossilize then patches the binary to ignore NODE_OPTIONS (equivalent to
building Node with --without-node-options): it renames the .rodata
NODE_OPTIONS lookup constant so getenv() returns null and no V8 flags are
applied. The runtime flag-hash matches the build-time default → the embedded
code cache is accepted (kept; not disabled).

process.env is untouched, so process.env.NODE_OPTIONS stays set and the
agent lore launches (e.g. claude) still inherits the user's flags.

Upstream: BYK/fossilize#31 (released in fossilize 0.10.0).

Verification

  • Reproduced + fixed on a real linux-x64 code-cache SEA; fossilize CI proves
    acceptance under NODE_OPTIONS on macOS/Linux/Windows.
  • Full typecheck + Biome clean.

…de cache valid

The standalone `lore` binary emitted `Warning: Code cache data rejected` at
startup (and silently recompiled) for any user with V8 flags in NODE_OPTIONS
(e.g. `NODE_OPTIONS=--max-old-space-size=8192`, common for Claude Code). Those
flags change V8's FlagList::Hash() at runtime, so V8 rejected the embedded code
cache that was generated on CI with default flags.

Bump fossilize to ^0.10.0 and pass `ignoreNodeOptions: true`, which patches the
binary to ignore NODE_OPTIONS (equivalent to `--without-node-options`). The
flag-hash then matches the build-time default and the cache is accepted — no
warning, cache kept. process.env.NODE_OPTIONS is untouched, so the agent lore
launches (e.g. claude) still inherits the user's flags.

See BYK/fossilize#31.
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 5877 uncovered lines.
✅ Project coverage is 61.58%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    61.58%    61.58%        —%
==========================================
  Files          101       101         —
  Lines        15296     15296         —
  Branches     10489     10489         —
==========================================
+ Hits          9419      9419         —
- Misses        5877      5877         —
- Partials      1189      1191        +2

Generated by Codecov Action

@BYK BYK merged commit 971ca24 into main Jun 11, 2026
28 of 30 checks passed
@BYK BYK deleted the fix/sea-ignore-node-options branch June 11, 2026 19:57
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-06-11 19:58 UTC

@craft-deployer craft-deployer Bot mentioned this pull request Jun 11, 2026
6 tasks
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