mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:45:22 +00:00
[PR #1730] [MERGED] fix(bun): report the real runtime and enforce worker memory budgets on Windows #4779
Closed
opened 2026-10-31 00:54:58 +00:00 by bsakaguchi
·
0 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#4779
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?
📋 Pull Request Information
Original PR: https://github.com/morluto/rea/pull/1730
Author: @xeropresence
Created: 10/11/2026
Status: ✅ Merged
Merged: 10/11/2026
Merged by: @morluto
Base:
main← Head:fix/bun-runtime-limits📝 Commits (2)
2480121fix(bun): report the real runtime and enforce worker memory budgets on Windows169ca86fix(windows): drain memory notifications after observing exit📊 Changes
48 files changed (+1630 additions, -196 deletions)
View changed files
📝
.agents/skills/reverse-engineer-anything/references/javascript-applications.md(+4 -1)📝
docs/installation.md(+12 -0)📝
docs/javascript-artifact-reconstruction.md(+8 -1)📝
docs/testing.md(+3 -1)📝
docs/web-network-captures.md(+6 -0)📝
docs/web-source-location.md(+12 -3)📝
native/windows/README.md(+24 -1)📝
native/windows/src/authority.hpp(+5 -1)📝
native/windows/src/process.cc(+88 -9)➕
scripts/lib/windows-job-memory-limit.mjs(+180 -0)📝
scripts/lib/windows-protocol-input.mjs(+1 -1)📝
scripts/verify-windows-native.mjs(+5 -0)📝
src/application/Doctor.fixture.ts(+1 -1)📝
src/application/Doctor.test.ts(+53 -15)📝
src/application/Doctor.ts(+6 -2)📝
src/application/DoctorDiagnostics.ts(+28 -3)📝
src/application/WebSourceLocationService.test.ts(+46 -0)📝
src/application/WebSourceLocationService.ts(+18 -3)📝
src/browser/history/CaptureFailures.test.ts(+94 -0)📝
src/browser/history/CaptureFailures.ts(+27 -3)...and 28 more files
📄 Description
Summary
When REA runs on Bun, it describes a Node.js/V8 runtime it did not observe, and its JavaScript helper processes run with no memory bound. Bun reports
process.versions.node(its Node.js compatibility version, e.g.26.3.0) and V8-shapedgetHeapStatistics()values, but it is not V8 and ignores V8 flags such as--max-old-space-size. REA relies on those flags to bound three helpers it starts onprocess.execPath: the JavaScript source analyzer (--max-old-space-size=<max_heap_mb>, default 1024), the source-map codec (192 MiB) and the HAR decoder (192 MiB old generation).This PR:
process.versions(only Bun setsprocess.versions.bun) and records it truthfully. Under Bun,trace_web_source_locationnow works instead of always failing, and Evidence reports unenforced V8 heap limits asnull(or omits them) instead of inventing numbers.rea doctorsays it is running on Bun.resource_constraintfailure Node's V8 out-of-memory path returns.Node.js launches and outputs are unchanged, apart from a new
detailsobject on the doctornodecheck.No issue is linked; this was found while running REA under Bun on Windows.
Problem and expected behavior
Smallest triggers, all under Bun 1.4.2 on Windows x64:
rea trace-web-source-location <manifest> 0 <map> <url> 1 0 --jsonalways failed. The codec reportedruntime: { id: "node-v8", version: process.version, v8_heap_limit_bytes: getHeapStatistics().heap_size_limit }. Bun's synthetic heap limit (~470 MB) is above the decoder's 256 MiB check, so the decoder returnedAnalysisOutputError: Codec reported a V8 heap limit exceeding its independent process budget.Even had it passed, the Evidence would claim a V8 runtime and an enforced heap limit that did not exist.worker_old_space_mbandworker_heap_limit_bytes(Bun'sheap_size_limit) intoreported_limitsand coverage limits. Bun enforces neither.inspect_web_network_capturelimitations said "HAR uses a 192 MiB Node old-generation heap", and HAR memory failures reportedold_generation_heap_mib: 192. Bun does not enforce that heap.rea doctor --jsonreported{"name":"node","detail":"26.3.0"}with no sign that the runtime was Bun.@vue/compiler-sfcbrowser build) committed up to 50,537 MiB and then failed with a genericProviderAdapterError. A 34,098-entry HAR, which exhausts the 192 MiB heap on Node.js, committed 1,026 MiB.Expected: REA records the runtime it actually ran on, reports an unenforced limit as unavailable rather than as a number, and bounds each helper by the memory budget it already declares wherever the platform allows it.
Change and scope
Runtime identity
src/domain/runtimeVersion.ts: addsJavaScriptRuntimeandjavaScriptRuntime(process.versions), the single place that decides between Node.js and Bun. Adapters passprocess.versions; the domain module does not readprocess.Source-map trace (
TraceSourceMap.ts,webSourceLocation.ts,SourceMapDecoder.ts,WebSourceLocationService.ts):runtimeis a discriminated union:{ id: "node-v8", version, v8_heap_limit_bytes: <int> }(unchanged on Node.js){ id: "bun", version, node_compatibility_version, v8_heap_limit_bytes: null, process_memory_limit_bytes: <int> | null }The decoder applies the 256 MiB check only to V8 reports. It rejects a report whose runtime differs from the runtime that launched the codec (the codec always runs on
process.execPath; without this check abunreport would bypass the heap check), and a Bun report whoseprocess_memory_limit_bytesdiffers from the limit its launcher enforced. The final limitation states the budget that actually applied.JavaScript analysis worker: the
readyhandshake'sheap_limit_bytesis nullable; the worker server sendsnullunder Bun and the parent rejects a handshake that contradicts its own runtime. Under Bun,worker_heap_limit_bytesisnullandworker_old_space_mbis not reported.javaScriptAnalysisCoverageLimitsalready drops non-numeric values, so coverage omits the heap limit.HAR decoder (
CaptureRelease.ts,CaptureFailures.ts,HistoricalCaptureDecoder.ts):HAR_CAPTURE_HEAP_ENFORCEDgates the heap sizes in limitations,reported_limitsand remediation.Doctor:
DoctorHost.nodeVersionis replaced byruntime: JavaScriptRuntime. Thenodecheck keeps its name, becauseDoctorScopeandscripts/verify-package-discovery.mjsselect it by name. It carries structureddetails:{ runtime: "node", version }, or{ runtime: "bun", version, node_compatibility_version }with detailBun 1.4.2 (Node.js 26.3.0 compatibility). Under Bun the check passes when the Node.js compatibility version satisfiesSUPPORTED_NODE_VERSION_RANGE, the same version setup already gates on (SetupHostusesprocess.versions.node); the Windows native addon already supports Bun as a Node-API host (#1531).Audit of
srcforprocess.version,process.versions,node-v8,getHeapStatistics,heap_size_limit,nodeVersionandmax-old-space-size:TraceSourceMap.tsruntime record;SourceMapDecoder.tsheap checkWebSourceLocationService.tslimitation "192 MiB old-generation heap and one V8 worker"JavaScriptAnalysisWorkerServer.tsreadyheap_limit_bytes;JavaScriptAnalysisWorker.ts#limits()CaptureFailures.ts,HistoricalCaptureDecoder.tsHAR heap sizesDoctor.ts/DoctorDiagnostics.tsnodeVersionJavaScriptAnalysisWorker.tsparent result budget (heap_size_limit - heapUsed), checkpoint admission;JavaScriptAnalysisWorkerServer.tsGC trigger at halfheap_size_limitparent_result_budget_bytesis a derived admission budget, not a runtime claim, so it is still reported.JsonInputFile.tsnative-parse choice and assembly admission (total_available_size)total_available_sizeis ~33.6 GB, so these refusals are practically unreachable there.--max-old-space-sizeetc. passed to the codec, HAR decoder, EVM worker and analysis workerprlimitcap and does not report its 256 MiB value.NativeModuleResolver.ts--js-flags=--max-old-space-size=128JadxSession.tsheap_limit_mib;WindowsNativeLoader.tsprocess.versions.napiJob Object memory limit (Windows, Bun only)
Native addon (
native/windows/src/process.cc,authority.hpp):process_spawnaccepts an optional 6th argument: the job memory limit in bytes. It must be a positive safe integer and a whole number of pages; anything else fails withERROR_INVALID_PARAMETERbefore any process is created. Existing 4- and 5-argument calls are unchanged.createJob(limit)setsJOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE | JOB_OBJECT_LIMIT_JOB_MEMORYandJobMemoryLimit, then reads the policy back and requires the exact flags and exact limit. The page-alignment rule exists so the read-back can be exact, because the kernel stores the limit in pages.CreateProcessW. Eachprocess_polldrains it without waiting and records a stickymemoryLimitReachedwhenJOB_OBJECT_MSG_JOB_MEMORY_LIMIT(10) arrives. The drain runs before the exit observation, so an exit caused by a failed allocation is never reported without the notification. A limited job's poll also returnspeakJobMemoryBytes(PeakJobMemoryUsed). An unlimited job returns neither field, so the poll shape for existing launches is unchanged. The spawn result echoesjobMemoryLimitBytes.process_closereleases the port.inspect()creates a 64 MiB-limited probe job with a port, then reportsjobMemoryLimit: true.TypeScript plumbing:
WindowsNativeLoader:jobMemoryLimit: z.literal(true).optional(); optional because artifacts built before this change omit it.WindowsOwnedProcess: the trailing options are one object{ protocolStdin, memoryLimitBytes, authority }; the only other caller (scripts/lib/windows-protocol-input.mjs) is migrated. A requested limit fails closed: an artifact withoutjobMemoryLimitrefuses the launch instead of starting an unlimited process. The spawn read-back must equal the request. A limited job's poll is parsed with a strict schema that requires both new fields, and an unlimited job's poll rejects them.memoryLimitReachedis set beforeexitis emitted.ProviderProcess:OwnedProviderProcessSpawnOptions.memoryLimitBytesis honored only by the Windows owned-job launcher; every other launcher throws instead of ignoring it.memoryLimitReachedis passed through toProviderProcessSnapshot, andrunOwnedCommandcarries it via the spawn options.Policy (
src/process/JavaScriptWorkerMemoryLimit.ts, the single place this is decided):javaScriptWorkerMemoryLimitBytes(heapBudgetMiB)returnsheapBudgetMiB × 1 MiB + BUN_WORKER_RUNTIME_RESERVE_BYTESonly whenplatform === "win32"and the runtime is Bun; otherwisenull. Every call site spreadsmemoryLimitBytesand adds the new reporting fields only when it is non-null, so Node.js launch arguments, the native call, the poll schema, Evidence and limitations are unchanged by construction.Reserve derivation (
BUN_WORKER_RUNTIME_RESERVE_BYTES = 512 MiB):bun -e 1peaks at 52 MiB of job commit, but REA's workers commit far more before doing real work, because JavaScriptCore commits parsed and compiled module code. Peak job commit on trivial inputs, 5–8 uncapped runs each, on a 32-logical-processor host:512 MiB covers the largest observed baseline with about 40% margin. Resulting limits: 704 MiB for the codec and HAR decoder, and
max_heap_mb+ 512 MiB for the analyzer (1536 MiB by default).Classification relies on the job notification, not on exit status, because Bun reports a reached limit in several ways: exit 3 (panic), exit 1 (
RangeError: Out of memory), or0xC0000409(observed for the HAR decoder).AnalysisResourceConstraintError(…, "memory", …)from every path (exit, broken pipe or truncated frame, worker-caught exception, post-loop check). Completed static facts are retained, and the next source starts a fresh worker.worker_heap_limit_bytes: nullplusworker_process_memory_limit_bytes, which is also a coverage limitAnalysisResourceConstraintError; no partial resultcodec_process_memory_limit_bytes; Evidenceruntime.process_memory_limit_bytescaptureMemoryFailurefrom both the failed-exit path and a success path whose job reached the limitprocess_memory_limit_bytes, plus a remediation sentenceNot included: memory enforcement for Bun on Linux and macOS (they keep
null/ no-limit reporting), EVM (alreadyprlimit-capped), Bun support in installers orrea setup/rea update, and changes to therea doctorremediation wording.Docs:
installation.md,web-source-location.md,javascript-artifact-reconstruction.md,web-network-captures.md,testing.md,native/windows/README.md, and the skill referencejavascript-applications.md.Contract and boundary impact
src/domain/runtimeVersion.ts(runtime identity) andsrc/process/JavaScriptWorkerMemoryLimit.ts(limit policy); the nativeprocess_spawn/process_pollboundary, thenWindowsOwnedProcess, thenspawnOwnedProviderProcess. Producers: codec process, analysis worker server, HAR adapter, doctor host.trace_web_source_locationoutput schema'snormalized_result.runtimechanges from{ id: string, version: string, v8_heap_limit_bytes: int }to the two-variant union above; Node.js output is byte-identical. Themax_heap_mb/--max-heap-mbdescription states that Bun ignores V8 heap flags and that Windows limits committed memory instead.rea doctor --json'snodecheck gainsdetails; on Node.js,detailis unchanged.trace_web_source_locationworks instead of always failing. Under Bun on Windows the helpers require the matching native artifact; an older artifact refuses the launch with "does not support Job Object memory limits" instead of running unlimited.nullor omitted instead of fabricated. Enforced Job Object limits are reported (worker_process_memory_limit_bytes,codec_process_memory_limit_bytes,process_memory_limit_bytes) and limitations state which budget applied.docs/public/product-catalog.json), package, or installation impact: ignored catalogs andskills/regenerate from the changed schema, description and skill reference; no committed generated files changed (docs:check:builtandmcp-catalog:check:builtpass).native/windows/buildis rebuilt by CI.Evidence and regression coverage
Tests added or updated:
src/domain/runtimeVersion.test.tsprocess.versions-shaped input.src/application/Doctor.test.tsnodecheckdetailsfor Node.js; Bun passes with a supported compatibility version (26.3.0) and fails with an unsupported one (25.1.0).Doctor.fixture.tsandGhidraDoctor.test.tsmove to theruntimehost field.src/process/JavaScriptWorkerMemoryLimit.test.tssrc/windows/WindowsOwnedProcess.test.ts[false, limit], verifies the read-back and setsmemoryLimitReachedbeforeexit; rejects a limited poll missing the fields and a mismatched applied limit.src/windows/WindowsNativeLoader.test.tsjobMemoryLimitadmitted astrue, absent on earlier artifacts,falserejected.src/process/ProviderProcessOutput.test.tsmemoryLimitReachedonly when the handle observed it.src/browser/history/CaptureFailures.test.tsreported_limitsonly on Node.js; a reached limit after a Bun panic (exit 3) or exception (exit 1) → memoryresource_constraintwithprocess_memory_limit_bytes; the same exits without the notification stayexecution_failure.src/application/WebSourceLocationService.test.tstests/boundary/process/providerProcess.test.tstests/boundary/javascript/sourceMapDecoder.test.tstests/boundary/javascript/javascriptSourceAnalysisWorker.test.tsProviderAdapterError) by the notification, using a real child.tests/acceptance/webSourceLocationCli.test.tstests/acceptance/tools/historicalCaptureResources.test.tsscripts/verify-windows-native.mjs+scripts/lib/windows-job-memory-limit.mjsscripts/lib/windows-job-memory-limit.mjsasserts:inspect().jobMemoryLimit === true; invalid limits (0, negative, fractional,2**53,NaN,Infinity, non-page-aligned4097, a string,null) are rejected with Win32 87; an unlimited poll has neither new field; a 128 MiB-limited child allocating externalBuffermemory (which V8 flags cannot bound) exits nonzero without completing, reportsmemoryLimitReached, reachesactiveProcesses === 0, and peaks within [limit − 64 MiB, limit + 32 MiB]; a control child under the same limit exits 0 without reaching it; theWindowsOwnedProcesswrapper reports the reached limit; a missing capability is refused. Measured peaks exceed the limit by a few MiB of kernel-charged commit (512→520, 256→262, 704→708 MiB), hence the tolerance.Base reproduction or other evidence:
sourceMapDecodertest (Codec reported a V8 heap limit exceeding its independent process budget.),webSourceLocationCli(exit 1), and the HAR exhaustion acceptance test (nothing bounded the decoder).JOB_OBJECT_MSG_JOB_MEMORY_LIMIT(10), the runtime-independent signal this change relies on.AnalysisResourceConstraintError, static facts retained0xC0000409; memoryresource_constraintwithprocess_memory_limit_bytes: 738197504AnalysisResourceConstraintErrorUser-visible CLI/MCP output (Bun 1.4.2, Windows x64, built CLI with the CI-built native artifact):
bun scripts\rea.mjs doctor --json,nodecheck:bun scripts\rea.mjs trace-web-source-location <manifest> 0 <map> "https://app.test/app.js.map?v=1#context" 1 0 --json(inputs written fromtests/fixtures/webSourceLocation.ts) exits 0 with one match and: The last limitation ends: "The codec ran on Bun, which does not enforce REA's V8 heap flags; a Windows Job Object limited its committed memory to 738197504 bytes, which is not a heap or RSS limit."bun scripts\rea.mjs analyze-javascript-application <dir> --format jsonon a directory with the 1,732,994-byte@vue/compiler-sfcbrowser bundle (src/big.js) and a one-line module (src/small.js): exit 0 in about 5 seconds.src/big.jsreportsresource_constraint/memory, "reached its 1610612736-byte process memory limit while analyzing src/big.js during semantic", with"reported_limits":{"worker_heap_limit_bytes":null,"worker_process_memory_limit_bytes":1610612736,"worker_timeout_ms":300000}.src/small.jsand itssmallexport are still recovered by static analysis.--max-heap-mb 128on a two-file app whosemain.jshas 4000 imports reaches the parent result-budget path and exits 0 with partial coverage. Thetarget.jsfailure reports"reported_limits":{"worker_heap_limit_bytes":null,"worker_process_memory_limit_bytes":671088640,"worker_timeout_ms":300000,"semantic_result_budget_bytes":0}; coverage limits arejavascript_analysis_semantic_result_budget_bytes,javascript_analysis_worker_process_memory_limit_bytes,javascript_analysis_worker_timeout_msandjavascript_analysis_parent_result_budget_bytes, with no worker heap limit.Remaining proof gaps:
javascriptSourceAnalysisWorker.test.tscannot run under Vitest on Bun: every test in the file, including the three existing ones on base, fails with[module runner] "import.meta.resolve" is not supported. Its Bun-side behavior is covered by the analyzer CLI runs above; CI runs the file under Node.js.For evidence-bearing changes:
Validation performed
Local validation ran under Bun 1.4.2 on Windows x64 without Node.js installed. npm-based wrapper scripts cannot run here, so the underlying scripts were run with
bun --bun. The native artifact built by this commit's CI was installed in the ignorednative/windows/build; base runs used the artifact from the publishedrea-agents@6.4.0package, because base's loader rejects the newjobMemoryLimitinspection key.bun --bun run compile;artifacts:skills,artifacts:mcp-catalog,artifacts:product-catalog,artifacts:managed-evidence,artifacts:error-schemabun --bun run typecheckbun --bun run lintCaptureFailuresmapping (complexity 59→63),HistoricalCaptureDecoder#inspect(30→31),JavaScriptAnalysisWorker#analyze(47→48; file 710→756 lines),verify-windows-native.mjs(675→680 lines).oxfmt --checkon touched filesbun --bun run docs:check:built,bun --bun run mcp-catalog:check:builtbun --bun run test:local --onJavaScriptWorkerMemoryLimit,WindowsOwnedProcess,WindowsNativeLoader,ProviderProcessOutput,CaptureFailures,WebSourceLocationService,runtimeVersion,Doctor,GhidraDoctorGhidraDoctorWindows-authority tests that fail identically on base.bun scripts/verify-windows-native.mjs .(full native conformance, under Bun instead of Node.js)ok: true, no false control.processes.jobMemoryLimit: the 128 MiB-limited child exited 1 at a peak of 145,399,808 bytes with the limit reached; the control exited 0 at 56,586,240 bytes; invalid limits, unlimited poll shape, wrapper reporting and missing-capability refusal alltrue.bun --bun node_modules/vitest/vitest.mjs runonsrc/application src/domain src/browser/history src/javascript src/ghidra src/process src/windows tests/boundary/javascript tests/boundary/process, thewebSourceLocationMcp,javascriptAnalysisResources,outputSchemaSemanticConstraintsandcompactInputSchemaMcpMCP boundary tests,targetDiagnostics, and thewebSourceLocationCliandhistoricalCaptureResourcesacceptance tests, on this branch and on basesourceMapDecodertest,webSourceLocationCli, and the HAR exhaustion acceptance test. Failing only on this branch: the 4 new tests injavascriptSourceAnalysisWorker.test.ts, which fail like the file's existing tests because Vitest's module runner on Bun does not supportimport.meta.resolve. Every other failure is the same test on both and environment-specific under Bun on Windows (e.g. thatimport.meta.resolvelimitation, POSIX-mode process tests, Linux/macOS Hopper installers, Ghidra Windows authority).doctor --json,trace-web-source-location,analyze-javascript-application(twice)CI on this commit (fork push run, Node.js on GitHub-hosted runners):
Build bundled Windows x64 native controls(MinGW build and artifact verification): passed. Itsrea-windows-x64.nodeSHA-256 is5fa70a01…11aac, byte-identical to the artifact used in the local runs above.Windows capability and package lane(npm run verify:windows-nativeon windows-latest, including thejobMemoryLimitcontrols): passed.Real Apple artifact CLI/MCP E2E (native-regressions)failed in "Run native Apple and process boundary regressions", which also fails theCI requiredgate. The same step failed on upstreammainat this PR's base966dc3ac(morluto/rea run 38116233537), and upstream has since changed its macOS lanes (3f4ea321, "ci: reduce macOS runner contention"). On macOS this change only adds thememoryLimitReachedpass-through and the refusal of a requested limit, which the policy never requests outside Windows.Compatibility, safety, and release
detailsobject on the doctornodecheck. Consumers validatingtrace_web_source_locationagainst the old schema could not have received Bun output before (it always failed). Bun-on-Windows users need the matching package artifact; an older artifact refuses the helper launch instead of running it unbounded.native/windows/buildartifact.Review checklist
type(scope): outcome.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.