Repository navigation
fix(javascript): name heap and semantic ceilings - #6022
Conversation
Refs #5910. Heap exhaustion names max_heap_mb with its effective value, range, and next-analysis worker restart. Semantic ceiling coverage names the four max_semantic_* arguments. Wakaru and transfer ceilings say this release has no runtime override. Co-authored-by: morluto <morluto@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea76f6eeac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
[Medium impact] The PR appears safe to merge; no blocking issue remains. SummaryThis PR names the controls behind JavaScript resource failures and distinguishes adjustable allowances from fixed limits.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Application room remaining] --> C[Smaller offered budget]
B[Per-file ceiling] --> C
C --> D[Project one file]
D --> E{Records omitted?}
E -->|Yes| F[Mark the ceiling that bound the offer]
F --> G[Name reached controls in limitations]
G --> H[List both effective values in coverage]
Reviews (4) · Last reviewed commit: "fix(javascript): limit the old-space pla..." · Reviewed by Greptile |
The effective transfer file ceiling and the parent result budget follow the CLI/MCP process heap, so recovery names NODE_OPTIONS instead of denying an override. A provenance report over 8 MiB keeps the fixed allowance guidance, and the Wakaru deadline says an unchanged retry may hit it again. Refs #5910 Co-authored-by: morluto <morluto@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a8fec6406b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Bun heap-exhaustion exits no longer claim the ignored max_heap_mb V8 old-space limit. Checkpoint decode names the parent heap and Node NODE_OPTIONS, the same control as the parent result budget. Refs #5910 Co-authored-by: morluto <morluto@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21b55f9817
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…ached Truncated semantic retention names the total and per-file controls as effective ceilings. Callers only know that retention was truncated, so the limitation no longer says both ceilings were reached. Refs #5910 Co-authored-by: morluto <morluto@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 579feb0bae
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Semantic ceiling limitations claimed both the application total and the per-file control whenever either one truncated the graph. Record which offered budget stopped node and unknown retention, and name only those controls. Coverage limits still list both effective values. Co-authored-by: morluto <morluto@users.noreply.github.com>
A bare --max-old-space-size is an illegal V8 flag and prevents Node from starting. Parent-heap and transfer-ceiling recovery now share --max-old-space-size=<MiB>, and the Kuna heap remediation uses the same complete form. Co-authored-by: morluto <morluto@users.noreply.github.com>
…very The review covers the CLI/MCP NODE_OPTIONS example and the transfer-ceiling copy. The Kuna heap-headroom sentence stays unchanged. Co-authored-by: morluto <morluto@users.noreply.github.com>
Summary
Refs #5910 (parent #5808). JavaScript analysis failures now name the existing controls an agent can change, and fixed ceilings say this release has no runtime override.
On Node, heap exhaustion names
max_heap_mb: the effective mebibytes, the inclusive range 128 to 16384 (default 1024), that a change applies on the next analysis by starting a new worker, and that it does not raise the parent result budget, the transfer record ceiling, the 2 GiB transfer file maximum, the CLI/MCP process heap, or fixed parser limits. On Bun, a worker exit whose stderr matches heap exhaustion is not attributed to that V8 old-space limit, because Bun ignores the flag.Semantic ceiling coverage keeps
semantic_graph_*_ceilingand also namesmax_semantic_nodes,max_semantic_nodes_per_file,max_semantic_unknowns, andmax_semantic_unknowns_per_file(each an integer from 1 to 1000000). The limitation names only the ceiling that stopped retention: the application total, the per-file ceiling, or both when each one stopped a file.coverage.limitsstill lists both effective argument values and both ceiling names. The transfer record ceiling (8388608 bytes) and the 2 GiB transfer file maximum have no runtime override. The effective transfer file ceiling follows the parent offered result budget, so on Node a larger CLI/MCP process heap (NODE_OPTIONS, for example--max-old-space-size=<MiB>, after restarting that process) can raise it up to 2 GiB. Selecting fewersource_pathscan also raise that effective allowance. The parent result budget and parent checkpoint decode follow that same parent V8 heap. Wakaru's 120000 ms deadline has no runtime override; an unchanged retry may hit it again.analysis_timeout_ms(default 300000) was already named on the timeout path and was left unchanged.Problem and expected behavior
A worker that exhausted its V8 old-space heap reported the exhaustion without naming
max_heap_mb, the effective value, the valid range, or when a different value takes effect. The generic memory remediation talked about host memory and did not say what raising the worker heap does not raise.Truncated semantic graphs reported
semantic_graph_node_ceiling,semantic_graph_file_node_ceiling,semantic_graph_unknown_ceiling, andsemantic_graph_file_unknown_ceilingwithout the caller arguments that set those ceilings.Transfer, checkpoint, and worker-request failures fell through to the generic transport remediation (
get_evidence_bundle). Wakaru's fixed 120000 ms deadline and fixed input, output, and diagnostic allowances did not say this release has no runtime override. Explicit-value redaction rebuilt a timeout error withoutuserMessageorremediationAction, so the existinganalysis_timeout_mssentence was dropped on that path.Review of the first revision: the effective transfer file ceiling and the parent result budget were described as having no runtime override. Both follow the CLI/MCP process heap. A
provenance.jsonover 8 MiB lost the fixed-allowance guidance whenparseWakaruReportswrapped the size refusal. The Wakaru deadline said an unchanged retry fails the same way, which is stronger than an elapsed-time check supports. A later review: Bun heap-exhaustion exits still namedmax_heap_mb, and checkpoint decode named the parent heap without the NodeNODE_OPTIONScontrol. Truncated semantic retention then said both the total and the per-file ceiling were reached even when only one of them stopped retention.Change and scope
Wording and projection only. Numeric defaults and schema bounds are unchanged. No new setting was added.
javaScriptWorkerHeapRemediation. At 16384 MiB the text says not to increasemax_heap_mbfurther. The Windows Bun commit-limit path still uses that remediation, because that limit ismax_heap_mbplus a 512 MiB reserve. A Bun exit whose stderr matches heap exhaustion does not attribute the failure to the configured V8 old-space and does not say to increasemax_heap_mb.sameLimitscomparesheapMbandtimeoutMsonly, and#startapplies--max-old-space-sizeat worker launch. The sentence therefore says a changedmax_heap_mbapplies on the next analysis, which starts a new worker. It does not change a worker that is already running, and it does not require restarting the REA server.max_heap_mbdoes not raise that budget. On Node,NODE_OPTIONS(for example--max-old-space-size=<MiB>) in the environment that starts the CLI or MCP server raises the parent V8 heap, and therefore this budget, after that process restarts.JAVASCRIPT_PARENT_HEAP_NODE_OPTIONSowns that sentence. A bare--max-old-space-sizeis an illegal V8 option and prevents Node from starting. Parent checkpoint decode uses the same parent-heap control: increasingmax_heap_mbdoes not raise it, and on Node thatNODE_OPTIONSrestart can admit the checkpoint.analyze_javascript_applicationcall without restarting the worker or the REA server.JavaScriptSemanticGraphBuilderrecords which offered budget stopped node and unknown retention. The offer is the minimum of the per-file ceiling and the remaining application total. The limitation names only that smaller ceiling, or both when the two offers are equal, and tells the caller to set only those arguments.coverage.limitsstill lists both effective argument values and both ceiling names. At 1000000 the text says not to increase that reached control further. Unknown coverage keeps the omission-counting sentence. The same attribution covers direct projection, adopted file projections, and unavailable-file unknown omissions.max_heap_mbdoes not raise them. The effective file ceiling follows the parent offered result budget. On Node, the sameNODE_OPTIONSsentence (--max-old-space-size=<MiB>, then restart the CLI or MCP process) can raise it up to the maximum. Selecting fewersource_pathscan also raise that effective allowance, because earlier retained results and the reserve for remaining sources reduce the offered budget. Neither change raises the record ceiling or the maximum. When the effective ceiling is already the maximum, the text says not to expectsource_pathsto raise it. The parent reattaches that remediation when the worker protocol forwards onlymessageandlimits. The 8388608-byte static checkpoint and the 65536-byte worker request ceiling keep the no-override sentence.analysis_timeout_msuser text is unchanged. Redaction copiesuserMessageandremediationAction, including when those fields contain an explicit sensitive value, and still keepsanalysis_timeout_ms.analysis_timeout_msormax_heap_mbdoes not raise it. An unchanged retry may hit the deadline again. Input allowance (maximum_input_bytes, 67108864 bytes), output entries (10000), output bytes (134217728), and the 8388608-byte diagnostic allowance say no runtime override. Aprovenance.jsonover 8388608 bytes applieswakaruFixedLimitRecovery, andparseWakaruReportskeeps thatuserMessageandremediationActionon theProviderAdapterError. Malformed reports stay the generic adapter failure.Web bundles, MCP response/startup naming (#6005), provider
command_timeout_ms(#6014), Android, native, engines, and ASAR are out of scope. The 1 GiB Wakaru address-space ceiling has no dedicated error and was not given a new detector. Success-pathRECOVERY_LIMITATIONSwas left unchanged so successful recoveries keep their evidence identity.Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.
Not applicable. This is recovery and coverage text for existing JavaScript analysis and Wakaru limits. It does not add a provider, target execution, injection, mutation, or protection recovery.
Contract and boundary impact
javaScriptAnalysisResourceControlsSchemaownsmax_heap_mband the fourmax_semantic_*arguments.JavaScriptAnalysisWorkerowns heap, parent-budget, checkpoint-decode, and worker-request recovery.JavaScriptAnalysisTransferowns transfer ceilings.JavaScriptSemanticGraphBuilderowns semantic coverage limits and which ceiling stopped retention. Wakaru recovery owns the fixed adapter deadline and allowances. The worker protocol still forwards onlymessageandlimits; the parent reattaches remediation from those limit keys.max_heap_mb128..16384 default 1024 (CLI--max-heap-mb);max_semantic_nodesdefault 100000;max_semantic_nodes_per_filedefault 20000;max_semantic_unknownsdefault 100000;max_semantic_unknowns_per_filedefault 20000; each semantic argument is an integer from 1 to 1000000 (CLI--max-semantic-nodes,--max-semantic-nodes-per-file,--max-semantic-unknowns,--max-semantic-unknowns-per-file);analysis_timeout_ms1..2147483647 default 300000. No catalog or tool-schema change.--max-old-space-sizewas exhausted. Parent-heap guidance names NodeNODE_OPTIONSand does not claim Bun honors--max-old-space-size.graph_idincludeslimitationsandcoverage.limits, so a truncated graph's id changes. Graphs that are not truncated do not gain that limitation. Wakaru success-path limitations are unchanged.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): none. Skill text was not changed.docs/javascript-artifact-reconstruction.mdanddocs/javascript-recovery.mddescribe the named controls, the adjustable file ceiling, and the no-override sentences for fixed ceilings. The reconstruction doc says truncated coverage lists both effective ceilings and that the limitation names only the ceiling that stopped retention.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
src/domain/javascript/javascriptAnalysisResourceControls.test.ts,src/application/javascript/JavaScriptSemanticGraphBuilder.test.ts,src/application/javascript/JavaScriptSemanticUnknownCapacity.test.ts,src/javascript/analysis/JavaScriptAnalysisTransfer.recovery.test.ts,src/javascript/recovery/WakaruCommand.test.ts,src/javascript/recovery/WakaruReport.test.ts,src/domain/explicitSensitiveFailure.test.ts,tests/boundary/javascript/workerOrderAudit.test.ts,tests/boundary/cli/javascriptApplicationJsonOutput.test.ts.max_heap_mbis applied only in#startvia--max-old-space-size.prepareForAnotherAnalysiskeeps the heap selected at launch, andsameLimitstreats a differentheapMbas a different worker. Semantic budgets are per-requestnode_budget/unknown_budget, not launch flags.javaScriptTransferByteBudgetismax(512 MiB, offered result budget / 8)capped at 2 GiB.#refreshResultBudgetand checkpoint decode both readgetHeapStatistics().heap_size_limit.WORKER_HEAP_FLAGS_ENFORCEDis true only whenjavaScriptRuntimeis Node. Remaining sources reserve one next static checkpoint (checkpointBytes * 6, 48 MiB). Node truncation is attributed from the early exit whenstate.nodes.size >= nodeCeiling, fromfileNodesDroppedagainst the file offer, and fromnodesTruncatedon an adopted projection. Unknown omissions are attributed the same way for direct projection, adopted omissions, and unavailable files.rea analyze-javascript-applicationJSON for a truncated semantic graph includes coverage limits{ name: "max_semantic_nodes", value: 50 }and{ name: "max_semantic_nodes_per_file", value: 30 }beside the existing ceiling names, and a limitation containingmax_semantic_nodesand1 to 1000000. That CLI fixture hits both ceilings (30 nodes in the first file, then the remaining 20 of the total). That CLI assertion was run on an earlier revision; this revision did not repeat it.For evidence-bearing changes:
Validation performed
npm run check:fast— typecheck and lint succeeded (2 tasks). Repeated after rebasing onto the branch; the second run was a cache hit.npm run test:focused -- src/domain/javascript/javascriptAnalysisResourceControls.test.ts src/application/javascript/JavaScriptSemanticGraphBuilder.test.ts src/application/javascript/JavaScriptSemanticUnknownCapacity.test.ts— 86 tests passed, including per-file-only, total-only, and both-reached node and unknown limitations. Repeated after the rebase; 86 tests passed again.npx oxfmt --writeon the five edited TypeScript files, then the formatter left them matching.Earlier revisions also ran the worker-order, CLI JSON, Wakaru, and redaction focused tests. Those files are unchanged by the
NODE_OPTIONSexample fix and were not re-run for it. The semantic-ceiling revision above ran on Node v22.23.3.The
NODE_OPTIONSrevision (7d3dc248e), rebased on65d4a570, ran on Node v24.18.0:npm run check:fast— typecheck and lint succeeded (2 tasks, 4.173s, 0 cached).npm run test:focused -- src/domain/javascript/javascriptAnalysisResourceControls.test.ts src/javascript/analysis/JavaScriptAnalysisTransfer.recovery.test.ts— 8 tests passed. Parent-budget, checkpoint, and adjustable transfer remediations require--max-old-space-size=<MiB>.Real Hopper, Ghidra, browser, or Wakaru provider workflows were not required. These paths are JavaScript analysis projection and the existing worker boundary.
Compatibility, safety, and release
graph_idchanges. Failure strings change. Limits, defaults, and configuration parsing are unchanged.NODE_OPTIONSwith--max-old-space-size=<MiB>for the parent heap and does not ask the agent to patch REA source. A Bun heap-exhaustion exit does not ask the caller to raisemax_heap_mb. Explicit-value redaction still redacts timeoutuserMessageandremediationAction; the test placesexplicit-secretin both fields and requiresanalysis_timeout_msto remain.Author readiness
Human owner: @morluto
Before merge
type(scope): outcome.