fix: pin frontend dev server heap ceiling (#91) - #93
Merged
Conversation
The nextjs agent starts the dev server with `npm run dev`, so the dev process inherits Node's ~2 GB old-space default. Under Turbopack + reactCompiler + transpiled plugin workspaces the dev compiler grows past that ceiling and OOMs within minutes, taking the port with it and presenting as an unreachable site after a successful start. Set an explicit --max-old-space-size on the `next dev` invocation — the one in-repo layer the agent runs — so the ceiling is asserted rather than inherited by every consumer following the documented dogfood command. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Address review of the dev heap ceiling: - Append to NODE_OPTIONS instead of replacing it, so any options the codefly runtime injects into the dev process (tracing loaders, source maps) survive rather than being clobbered by the inline assignment. - Replace the brittle exact-adjacency assertion with a behavioral test: run the dev script's real env prefix with a probe standing in for `next dev` and assert the process sees both a pre-set NODE_OPTIONS and the appended ceiling. This fails on the old replacing form. - Resolve package.json via import.meta.dirname; the previous new URL() form threw under the vitest transform. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Closes #91.
Summary
npm run dev(run logs:> npm run prepare:frontend && next dev -p <port>), so the dev process inherits Node's ~2 GB old-space default — the OOM GC lines show it dying at a~2048 MBceiling (1944.0 (2060.0) MB), well below the4288 MBthe same Node reports unconstrained. Nothing in the repo sets a limit, so under Turbopack +reactCompiler+ transpiled plugin workspaces the dev compiler grows past that ceiling and OOMs within minutes, taking the port with it and reading as an unreachable site after a successful start.devscript is the one in-repo layer the agent runs, so pinning an explicit--max-old-space-size=8192there makes the ceiling asserted rather than inherited by every consumer following the documented dogfood command — instead of an invisibleNODE_OPTIONSon each person's shell.reactCompilerandtranspilePackagesare deliberate (plugin HMR, product decision); reducing them would regress behavior, so this only lifts the ceiling.Test plan
node --test module/tools/base-integrity.test.mjs— 20/20 pass, including "the committed canonical manifest matches the tree it ships with" (manifest regenerated viabase-integrity.mjs genfor the edited basepackage.json+ new test file).scripts/dev-heap-ceiling.test.mjs(vitestpureproject) asserts thedevscript pins an explicit old-space ceiling above the inherited 2048 MB default and applies it tonext dev. Verified the assertions pass against the realpackage.json(deps not installed in this worktree, so validated with plain Node rather than a fullnpm ci).Notes for the reviewer
codefly run service --env local-dogfoodis the manual confirmation.8192is a generous headroom ceiling (matches the value that was already stabilizing runs), not a tuned minimum —--max-old-space-sizeis a cap, not a reservation.🤖 Generated with Claude Code