fix(gateway): ignore NODE_OPTIONS in the SEA binary to keep the V8 code cache valid#710
Merged
Conversation
…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.
Contributor
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 5877 uncovered lines. 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 +2Generated by Codecov Action |
Contributor
|
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The standalone
lorebinary emitsWarning: Code cache data rejectedatstartup — 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 verycommon 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_OPTIONSchangeFlagList::Hash()atruntime, 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 withNODE_OPTIONSV8 flags;env -u NODE_OPTIONS loremade the warning disappear. (It was not the chip /macOS version — both were Apple-silicon, same macOS.)
Fix
fossilizeto^0.10.0.ignoreNodeOptions: truetofossilize()inrunFossilize().fossilize then patches the binary to ignore
NODE_OPTIONS(equivalent tobuilding Node with
--without-node-options): it renames the.rodataNODE_OPTIONSlookup constant sogetenv()returns null and no V8 flags areapplied. The runtime flag-hash matches the build-time default → the embedded
code cache is accepted (kept; not disabled).
process.envis untouched, soprocess.env.NODE_OPTIONSstays set and theagent lore launches (e.g. claude) still inherits the user's flags.
Upstream: BYK/fossilize#31 (released in fossilize 0.10.0).
Verification
acceptance under
NODE_OPTIONSon macOS/Linux/Windows.