Skip to content

fix(javascript): preserve graphs within parent capacity - #1921

Merged
morluto merged 1 commit into
mainfrom
fix/1911-javascript-checkpoint-reserve
Oct 11, 2026
Merged

morluto merged 1 commit into
mainfrom
fix/1911-javascript-checkpoint-reserve

Conversation

@N0zoM1z0

@N0zoM1z0 N0zoM1z0 commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Two JavaScript source files could lose the earlier file's completed semantic graph because the parent reserved 80% of its original result budget while another source remained. Reserve the next sequential static checkpoint using the existing protocol bound and retention accounting, so useful graphs survive within the available capacity. Fixes #1911.

Problem and expected behavior

An inert 400-function ES module followed by a small module returned no semantic functions for the earlier source. A directory with ten later small sources has the same problem. Admission should protect the next checkpoint and enforce actual retained/live-heap capacity rather than an arbitrary fraction of the original budget.

Change and scope

The worker owner reserves one maximum 8-MiB checkpoint at its existing retained expansion of six, matching the sequential producer. Previously retained facts stay charged to the existing ledger. Remove the superseded static-reserve ledger. Genuine parent-side rejections now report effective available capacity and module/graph retention estimates, and point callers to the facts that survived.

Contract and boundary impact

  • Semantic owner and earliest changed stage: JavaScriptAnalysisWorker, at parent checkpoint and transfer admission.
  • CLI and MCP/tool-catalog contract: unchanged requests and schemas; additive diagnostic limit fields and producer-specific recovery guidance.
  • Provider, bridge, target-format, or platform compatibility: existing JavaScript worker protocol and execution limits retained.
  • Evidence, artifact, provenance, or reconstruction contract: preserve exact artifact identities, existing static/module facts, explicit partial coverage and semantic unknowns.
  • Process execution, authorization, cleanup, or containment impact: existing owned-process, heap, decode, transfer, cancellation and cleanup protections retained.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Add public CLI cases for one and ten later sources, plus a 600-function source under a 448-MiB parent heap that must reject the graph while preserving static/module facts and accurate recovery guidance. The negative case exceeds even the otherwise-empty parent's available budget, so acceptance cannot depend on GC timing.

  • Base replay fails the earlier-source semantic preservation assertion.

  • Representative failure now includes parent_available_result_budget_bytes, module_retention_estimate_bytes and graph_retention_estimate_bytes; remediation explains that increasing the worker heap alone does not increase parent capacity.

  • Real Linux CLI and fresh stdio MCP checks on two generated modules of 439,680 and 438,705 bytes complete without worker-heap failure or parent-budget rejection. CLI retains 20,000 semantic nodes from each source. Semantic coverage remains explicitly partial.

  • Remaining proof gaps: the manual resource-limited workflow was run on Linux/Node, not Bun or other operating systems. The heap-specific CLI cases explicitly skip Bun, whose runtime does not enforce the V8 flags.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • Public CLI capacity, worker lifecycle, stdio MCP resource/cancellation and tool-effects wording tests: 21 passed across six files on the refreshed main base.
  • Actual generated-module CLI analysis on the final rebased source: completed in 35.35 seconds, process-tree peak 1,002,668,032 bytes, zero OOM events, unchanged input digests.
  • Fresh stdio MCP summary, retained module views, Evidence bundle and subsequent ping on the final rebased source: passed in 32.02 seconds with unchanged input digests.
  • npm run check — typecheck, lint, formatting, unused-code, metadata and architecture guards passed.
  • npm run verify:test-discovery — all 862 test files discovered exactly once; final CLI cases also passed after test typing corrections and deterministic capacity sizing.
  • Initial CI identified the main-base static-tool wording failure, independently fixed upstream by fix(test): audit static Wasm and Harmony tool wording #1917. This branch includes that main fix; no tool-effects change is included in this PR.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: Linux Node.js 24.18.0 JavaScript CLI/MCP; native/browser providers are outside this change.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: inert source analysis; no target execution, new authority, installation, or increased worker heap limits.

Review checklist

  • This PR addresses a concrete problem or an agreed enhancement.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed; no request/schema change requires regenerated documentation.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T18:07:33.494401Z e11aa90 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Reserve the next sequential static checkpoint using its protocol size and
existing retained-expansion accounting instead of 80% of the parent budget.
Preserve total/live heap protections and explain parent admission failures
with effective capacity, retention estimates and usable retained facts.

Fixes #1911

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build Build, CI, packaging, and publishing bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] JavaScript admission reserves 80% of parent capacity for any later file

2 participants