mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:45:22 +00:00
[GH-ISSUE #4348] [Bug] Member-mutation pass exhausts the heap on React bundles since #4243 (initializer-level alias cycles) #1720
Closed
opened 2026-10-16 21:09:27 +00:00 by bsakaguchi
·
5 comments
No Branch/Tag specified
main
codex/procedure-reference-stacked
release-please--branches--main--components--rea-agents
release-please--branches--main--components--rea-agents--release-notes
codex/kuna-independent-retry
codex/byte-search-overlay-coverage
codex/open-failure-target-receipt
codex/kuna-xref-evidence
codex/ghidra-ambiguous-procedure-recovery
codex/function-source-bundle
codex/trace-function-integration-prototype
codex/snapshot-source-closure
codex/recorded-evidence-array-pages
codex/evidence-recovery-redesign
codex/trace-feature-address-scope
codex/call-discovery-scope
codex/ghidra-literal-candidate-evidence
codex/decompile-directory-independent-retry
codex/retry-provenance-base
codex/value-flow-capability-experiment
codex/ghidra-containing-instruction
cursor/readme-discord-button-ef9f
dependabot/github_actions/actions/setup-node-7.1.0
dependabot/github_actions/actions/upload-artifact-7.0.2
dependabot/npm_and_yarn/npm-minor-and-patch-d8d97ce6df
codex/kuna-1989
fix/8559-native-ui-fixture-ownership
fix/8555-go-verifier-mcp-ownership
codex/provider-capability-recovery
fix/8642-rizin-target-stdin
codex/ghidra-memory-effect-scope
codex/ghidra-annotation-entry-selector
codex/ghidra-readonly-recovery
codex/ghidra-regex-verifier-recovery
codex/evidence-discovery-view-guidance
fix/8545-bulk-append-overflow
fix/8428-navigation-refusal-alternatives
codex/address-context-recovery
codex/matching-member-limitations
codex/unknown-scope-contract
codex/evidence-view-guidance
feat/8373-native-trace-views
codex/ghidra-snapshot-verifier-binding
codex/elf-export-visibility
codex/evidence-view-recovery
codex/native-reference-cli-help
codex/provider-candidate-observation-scope
codex/kuna-session-verification
codex/ghidra-switch-lifetime-guidance
codex/pseudocode-paging-discovery
codex/clarify-evidence-view-support
codex/kuna-xrefs-selector-recovery
codex/context-capacity-recovery
codex/evidence-closure-large-links
codex/same-function-evidence-identity
codex/ghidra-verifier-inspected-jdk
codex/audit-guided-workflows
codex/crash-prompt-retained-dossiers
codex/analysis-view-error-recovery
codex/kuna-verifier-target-selection
codex/ghidra-selected-project-call-coverage
codex/docs-native-analysis-scope
codex/ghidra-java-socket-boundary
codex/ghidra-retained-snapshot-verifier
codex/ghidra-search-inventory-facts
fix/8284-zero-argument-parameter-bindings
fix/8198-ui-action-handler-offset
fix/8257-elf-entry-label-identity
fix/8304-deferred-output-schema-projection
fix/8277-call-path-computed-target-uncertainty
fix/pr-8089-conflicts
fix/ci-static-duplicate-export
dependabot/npm_and_yarn/lint-staged-17.6.0
dependabot/github_actions/actions/download-artifact-8.0.2
dependabot/npm_and_yarn/write-file-atomic-8.0.0
dependabot/npm_and_yarn/canonicalize-5.1.0
dependabot/github_actions/actions/cache/restore-6.1.0
dependabot/npm_and_yarn/toon-format/toon-4.4.0
dependabot/github_actions/actions/deploy-pages-5.0.1
codex/review-fixes-pr-2403
codex/review-fixes-pr-2400
codex/process-terminal-width
codex/test-brittleness-cleanup
verify/7167-browser-connect-macos
fix/7167-browser-connect
feat/native-matching-allowance-setting
feat/browser-scenario-dry-run
test/managed-caller-parameters-20261024
codex/parser-fortythird-boundaries
fix/6926-pinvoke-platform-decorations-20261023
fix/6889-har-body-encoding-20261023
fix/6888-sqlite-schema-budget-20261023
fix/dependency-security-gates-6708
cursor/evidence-overwrite-rebase-b4ac
feat/4057-verify-native-exports
fix/windows-acl-observer-overhead-20261022
cursor/erlang-beam-restack-4476
cursor/pe-certificate-review-bf32
fix/6116-javascript-application-fs-errors
fix/6061-unmapped-runtime-script-unknown
feat/browser-scenario-summary
fix/pe-certificates
codex/verify-3407
cursor/rebase-5699
cursor/rebase-5352
cursor/rebase-5600
cursor/fix-cli-schema-omission-10a8
codex/audit-hopper-shutdown-reasons-20261021
fix/demangle-swift-omitted-record
fix/nib-boolean-value-types
cursor/cancellation-partial-observation-a5ac
fix/ib-object-limit-reasons
fix/electron-fuse-limit-advice
fix/kuna-doctor-dangling-cache
fix/fixed-budget-refusal-advice
fix/js-ipc-listener-dedup
fix/js-return-member-provenance
fix/dmg-integrity-retry-advice
fix/ida-doctor-readiness
fix/kuna-version-probe-output-drain
fix/legacy-swift-runtime-name-matching
fix/dylib-lazy-load-commands
fix/browser-scenario-startup-cancel
fix/swift-nested-punycode-classification
fix/compare-unselected-scopes
fix/objc-method-budget-coverage
fix/dmg-mounted-root-observations
audit/ci-tests-20261019-round2
release/6.7.0
fix/wabt-cleanup-retry-resolution
fix/electron-fuse-elf-pe-architecture
fix/native-plist-descriptor-ownership
fix/kuna-caller-cleanup-ownership
experiment/atomic-codemode-20261016
review/first-contributor-3776
fix/call-resolution-full-read-cycles
fix/member-mutation-selection-repeat
experiment/atomic-re-tools-20261015
perf/member-mutation-lazy-origins
perf/static-network-mutation-index
fix/hopper-startup-lifecycle
audit/3050-windows-proof-20261015
feat/windows-window-capture-2183
audit/3049-windows-proof-20261015
audit/3735-macos-fixtures-20261015
fix/batch-decompile-null-pseudocode
fix/kuna-inventory-honors-jobs
experiment/browser-codemode-tool-design-20261015
fix/hopper-clean-runtime-argv
codex/review-2049-27f1b367
review-fixes/pr-2787-routing
fix/3360-scoped-this-emitters
fix/3367-replaced-global-effects
fix/3838-compact-any-value-items
test/hopper-download-probe-20261015
codex/windows-runtime-creation-red-green-20261015
codex/windows-readonly-root-red-green-20261015
codex/windows-root-share-red-green-20261015
codex/exp-1685-win-mcp-startup
codex/bug-sweep-20261015
investigate/2190-windows-package-phases
investigate/3543-macos-cli-deadline
perf/3281-reverse-tools-feedback-quality
fix/3406-hopper-doctor-fixture
fix/3341-wrapper-require-test-context
fix/3301-owned-uninstall-fixtures
fix/3164-compiler-input-ownership
fix/pcap-cleanup-stdout-newline-20261014
perf/interface-builder-summary
codex/review-fixes-pr-1977
fix/ghidra-effective-jvm-platform
fix/docs-turkish-rust-link-20261013
fix/main-maintenance-ci-20261010
fix/recover-binary-session-process-effects
codex/review-fixes-pr-2457
codex/ci-required-cancellation-gate
fix/main-format-baseline-20261013
fix/setup-preserve-entry-fields
cursor/restore-main-checks-1ffc
fix/ghidra-bridge-hashmap-import
codex/shared-ci-jadx-json-default-20261013
codex/shared-ci-ghidra-test-groups-20261013
codex/shared-ci-java-fixture-format-20261013
codex/fix-intrinsic-invocation-boundaries
test/release-preflight-reusable-jobs
test/js-parameter-provenance-expectation
fix/linux-hopper-verification-current
test/2419-ghidra-elf-probe-size
followup/pr-1544-native-ida
codex/fold-pr-2230-contribution
docs/readme-responsible-use
fix/issue-2064
fix/issue-2050
fix/issue-2053
fix/issue-1968
fix/issue-1945
experiment/codemode-bridge-20261011
fix/tool-effects-negative-wording-1904-20261012
fix/1842-electron-interop-provenance
feat/recover-javascript-multi-input
refactor/website-i18n-prep
fix/nativeaot-pe-virtual-extent
fix/browser-verifier-ci-hang
fix/pe-resources-input-selection
docs/beginner-friendly-guides
docs/beginner-setup-guide
fix/javascript-analysis-worker-1563
fix/1649-ghidra-duplicate-names
fix/javascript-export-keys-integration-1369
test/maintenance-boundary-contracts-20261011
review/javascript-export-keys-1369
review/process-live-progress-1483
test/javascript-1495-growth-ratio
fix/ci-escape-timing
docs/normalized-terminal-geometry-1450
release/6.3.0
archive/release-6.3.0-pr1381
release/6.2.0
fix/electron-preload-dynamic-override
fix/javascript-self-referential-bundler-edges
release/6.1.0
cursor/grok-client-cherry-pick-0b56
feat/signature-posture
feat/dyld-shared-cache
feat/artifact-integrity-policy
feat/pkg-inventory
release/6.0.0
chore/sync-release-5.0.0
release/5.0.0
cursor/cloud-agent-node-787e
fix/javascript-xhr-open-endpoints
review/pr-711-realpath-fallback-wording
cleanup/replay-confinement
codex/test-suite-performance
codex/issue-foundations
codex/address-open-issues-2026-07-20
agent/javascript-vite-rollup-esbuild-adapters
agent/process-cleanup
agent/triage-integration
agent/unknown-commands-registry
feat/mcp-identity-metadata
morlvps/issue_cleanup
codex/installer-redesign
morl/roadmap-investigation-core
morl/roadmap-investigation-docs
release-please--branches--main--components--rea
rea-agents-6.8.0
rea-agents-6.7.0
rea-agents-6.6.0
experiment/atomic-codemode-wait-runtime-20261016
rea-agents-6.5.0
rea-agents-6.4.0
rea-agents-6.3.0
rea-agents-6.2.0
rea-agents-6.1.0
rea-agents-6.0.0
rea-agents-5.0.0
rea-agents-4.1.0
rea-agents-4.0.1
rea-agents-4.0.0
rea-agents-3.2.1
rea-agents-3.2.0
rea-agents-3.1.0
rea-agents-3.0.0
rea-agents-2.7.0
rea-agents-2.6.0
rea-agents-2.5.1
rea-agents-2.5.0
rea-agents-2.4.0
rea-agents-2.3.0
rea-agents-2.2.0
rea-agents-2.1.0
rea-agents-2.0.0
rea-agents-1.7.0
rea-agents-1.6.0
rea-agents-1.5.0
rea-agents-1.4.0
rea-agents-1.3.0
rea-agents-1.2.0
rea-agents-1.1.0
rea-agents-1.0.0
rea-agents-0.5.0
rea-agents-0.4.0
rea-agents-0.3.0
rea-0.2.1
rea-0.2.0
Labels
Clear labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
Mirrored from GitHub Pull Request
question
roadmap
triage
No labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
question
roadmap
triage
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
morluto/rea#1720
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kaoru0822-kitauji on GitHub (Oct 16, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/4348
Summary
Since #4243 (
42fc6c53a), the JavaScript member-mutation pass exhausts the worker heap on twoplaywright-core@1.58.2bundles that took about 1.5 s before. Both are React builds:lib/vite/recorder/assets/index-BhTWtUlo.jsandlib/vite/traceViewer/assets/defaultSettingsView-CJSZINFr.js. #4243 moved cycle detection inresolveLocalCallablesandcreateSemanticReturnedReferencesfrom bindings to individual initializers. Results inside alias cycles arecycleDependent, so they are never memoized, and the search enumerates initializer orders.Observed (executed; macOS 26 arm64, Node 26.5.0)
1bd5c5c87(before #4243)42fc6c53a(after)index-BhTWtUlo.js(363,108 B, SHA-256c909272a…7ace4), semantic phase in-processdefaultSettingsView-CJSZINFr.js(640,870 B, SHA-256212b6c02…51f18), samerea analyze-javascript-application <dir with index-BhTWtUlo.js>(defaults)Owned JavaScript worker exhausted its heap while analyzing index-BhTWtUlo.js during staticSynthetic reproduction for the call-resolution part (semantic phase, in-process):
Source-derived cause
resolveLocalCallables(javascriptSemanticCallResolution.ts). Each initializer is cut only when it is already inseenInitializers. Insiderun, every read ofa/bhas unresolved ordering, sosemanticBindingAtReadreturns the whole binding. The resolver then walks every simple path over the initializers. A CPU profile of n=12 puts 90% of the time inresolveIdentifier→resolveBindingCallables.createSemanticReturnedReferences(javascriptSemanticReturnedReferences.ts). The two playwright bundles spend their time here, called from the member-mutation traversal. An instrumented trace shows a few leafCallExpressioninitializers reached ~390 k times each, through parentIdentifierframes re-expanded under different initializer contexts (chains up to 54 keys). The hot code is React-reconciler style: a fiber localtreassigned dozens of times acrossswitchcases (t = gd(null, t, e, a, n)…). Those reads are position-narrowed, so the completed-expansion cache, which needs the new context to contain every cached blocker, rarely hits.Proposed checks / fix directions
x = x.next) terminate, which is #4243's design decision. Bounding the playwright bundles needs that decision.Not done
@kaoru0822-kitauji commented on GitHub (Oct 16, 2026):
More affected real inputs (executed; macOS 26 arm64, Node 26.5.0; static + semantic phases in-process, one child per file, 1 GiB heap as the worker default):
Notion 7.37.1
app.asar: 8 of 97 packed sources now exhaust the heap in about 8.5 s each. All are React renderer bundles under.webpack/renderer/:tabs,sqlite_browser,activity_monitor,internal_settings,client_placeholder,meeting_notification_pill,speaker_and_microphone_status,windows_and_tabs(index.jseach).For
renderer/tabs/index.js(985,489 B, SHA-256 prefixfdb07bdecadfd5a4):1bd5c5c87(before #4243)42fc6c53a(main)So part 2 (returned-reference expansion) is the remaining cause here as well. The other 122 Tabby/Notion sources complete.
On part 2, the constraint I see is this. Exactly enumerating walks that use each initializer at most once is inherently exponential. A polynomial bound therefore has to choose between under-approximating (dropping returned references, which loses effects) and over-approximating (adding references, which changes some results on inputs that terminate today). That choice seems to belong with #4243's design. I haven't changed it. If reverting #4243's
createSemanticReturnedReferencescycle model to binding-level is acceptable as a stopgap, I can measure that next.@Hahaa909 commented on GitHub (Oct 16, 2026):
Thanks for the additional reproductions. I understand that #4349 addresses the full-read alias-cycle case, while the remaining heap exhaustion is in
createSemanticReturnedReferencesfor position-narrowed reads.Before proposing an implementation, could maintainers clarify the accepted trade-off for part (2)? In particular, should the fix preserve all currently observable returned references and introduce a bounded approximation, or is a conservative under-approximation acceptable for pathological cycles such as the React bundles?
I would avoid duplicating #4349 and can focus on the remaining returned-reference expansion once the intended cycle semantics are confirmed.
@Patchouli-CN commented on GitHub (Oct 16, 2026):
Part 2 update: #4364 proposes bounding the returned-reference expansion per call-target query (following the
getter-expansionresource-limit precedent) and disclosing the bound through coverage. On the two playwright-core bundles from this issue the member-mutation phase now completes in ~3 s under 500 MiB instead of exhausting the heap; digests over 311 real files are byte-identical with no limit triggered. Budget value and fallback semantics are flagged in the PR for the design decision noted above. (AI-assisted; human owner @Patchouli-CN has signed off the readiness declarations.)@morluto commented on GitHub (Oct 19, 2026):
Fixed on main in
e4c3d7239.Both causes are addressed at their producers. Callback reads selecting a complete binding now close repeated binding re-entry; position-narrowed reads retain initializer-cycle semantics. Returned-reference effects join projections at each concrete source read, replacing initializer-history and complete-path enumeration with a finite conservative may-target analysis. Joins can add candidates. Static limitations, typed worker/module coverage, semantic unknowns at callee coordinates, and affected web-script keys disclose that precision loss. No query visit cap drops references.
Executed against the official npm sources matching this issue's digests on Node 24.18.0, macOS arm64. The two Playwright bundles previously exhausted the default 1 GiB worker heap during static analysis. They now return 2 parsed files, 306,326 examined AST nodes and 41 findings, without worker failure. Their semantic graph remains explicitly partial under the existing 20,000-node-per-file limit and records 365 widened-query unknowns. The exact React DOM CJS source from #5138 also recovers 44,701 AST nodes and 16 findings.
Validation: 2,479 focused tests across 98 files, including actual CLI/MCP workflows and worker/transfer boundaries; full static/architecture checks, docs and discovery passed. Six completed small CLI controls retained identical results and estimated reply tokens with similar costs. This qualifies inert-source analysis; browser/Electron runtime and native Windows remain unverified. Separate web host-process containment in #5132 remains open.
Adapted #4349 at
a262e1c, credited to @kaoru0822-kitauji and its original coauthor. Reviewed #4364 atd32a703b; its cap was not adopted, and its React-shaped regression informed the new test, credited to @Patchouli-CN. Neither PR was merged by this change.@JamenDavis commented on GitHub (Oct 20, 2026):
The fix holds on another React build. The npm release still has the bug.
rea-agents@6.7.0from npm (the currentlatest) runs out of heap on the React 18.2.0 production renderer that Next.js ships as itsframework-*.jschunk (140,953 bytes, SHA-2568b219e2882c6c3918baca761cc2f4b4212b90d1664a43608155b1200013939ca).mainat58d6043analyzes the same file.Owned JavaScript worker exhausted its heap while analyzing framework-4ed89e9640adfb9e.js during staticmain58d6043Each row is one CLI run of
rea analyze-javascript-application <dir holding only the chunk> --jsonon macOS 26.3.1 arm64 with Node 22.22.2. I also ran 6.7.0's static phase in-process twice, and both runs died at a 1 GiB heap. The same phase onmaintakes 1.6 s and peaks at 46 MB of heap.In 6.7.0 the time goes to one
createSemanticReturnedReferencescall, for the callee(9===t.nodeType?t:t.ownerDocument).createTextNodeat column 88140. I added counters to a copy of the module. It passed 5.8 million visits before I stopped it, across only 10 bindings with 92 initializers between them. That's the initializer-order enumeration this issue describes. A bigger heap won't save it. At--max-old-space-size=8192the static phase was still running after 150 s, at 4.4 GB RSS.Could this go out in a release? The bundled skill's setup and CLI fallback steps run
npx rea-agents@latest, so until then any Next.js or React 18 page analyzed with the npm build loses its React chunk.