Repository navigation
feat(process): make the regex worker heap request configurable - #6301
Conversation
REA_REGEX_WORKER_HEAP_REQUEST_MIB keeps the 128 MiB default and refuses values outside 8 to 16384 MiB. A positive Node --max-old-space-size still overrides the request and is not clamped by the setting. Co-authored-by: morluto <[email protected]>
… bound On Node 22.23.4 a 5 MiB old-generation request aborts the regex worker during startup, and 6 MiB starts it and returns a match. The setting floor is that measured bound. Co-authored-by: morluto <[email protected]>
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. |
[Medium impact] The PR appears safe to merge; the previous minimum-heap issue is addressed and no new blocking issue was found. SummaryMakes
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
Environment[Selected environment] --> Parser[Validate heap request]
Parser --> Config[Resolved request and source]
Config --> Hopper[Hopper]
Config --> Kuna[Kuna]
Hopper --> Matcher[RegexMatcher]
Kuna --> Matcher
Matcher --> Worker[Worker heap request]
Flags[Positive Node heap flag] --> Override[Overrides worker request]
Worker --> Override
Reviews (2) · Last reviewed commit: "fix(process): raise the regex worker hea..." · Reviewed by Greptile |
6 MiB passes configuration but returns ERR_WORKER_OUT_OF_MEMORY for a trivial match on supported Linux Node 24 and Node 26.0.0. 7 MiB returned that match on the measured 22, 24, and 26 lines. A clean-process test runs the production worker at the floor. Co-authored-by: morluto <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Integrate origin/main, including the regex worker heap request from #6301. Doctor and client-configuration tests keep both invalid-value cases. Co-authored-by: morluto <[email protected]>
* fix(mcp)!: return a compact binary_session status by default
binary_session {} with no target open returned about 66 KB, most of it
provider rejection diagnostics and candidate capability sets that the
skill's recovery flow re-reads on every retry. 6.8.0 grew it by 21%
because the shared regex capability limitation began repeating setting
bounds and step-by-step recovery for every search operation of every
provider (#6099, #6267, #6301, #7049) and IDA gained that limitation for
its two search operations (#4862).
The regex limitation now states the effective deadline and heap, their
sources and where to change them; the deadline and heap errors keep the
full recovery. binary_session gains detail: summary (default) or
complete. The summary keeps open state, target identity, the binding,
route capabilities, run, activity and health status, each candidate's
availability and target-support status, code and reason, and every
tool's availability, reason, remediation and modes, and lists the
fields it leaves out in omitted_fields. Complete detail returns the
previous shape. The CLI capabilities and providers commands keep
complete provider facts through the same application projection.
BREAKING CHANGE: binary_session {} no longer returns
analysis_provider_candidates[].availability.diagnostics,
target_support.diagnostics or capabilities, or tool_availability group
surface, effects and annotations. Pass {"detail": "complete"} to get
them.
Fixes #7109
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* fix(mcp): key binary_session output fields by detail
The output schema accepted detail: "complete" with summary candidates or
tool groups, and a summary without omitted_fields, so detail did not
tell callers which fields existed. Each session kind is now crossed
with a detail-specific shape: a summary requires omitted_fields and
summary-only candidates and tool groups; complete requires diagnostics,
candidate capabilities and static tool flags and forbids omitted_fields.
Both the canonical schema and the SDK-validated advertised schema reject
mismatched shapes.
The verifier helper accepts summary candidates only for a validated MCP
summary; CLI provider output still requires candidate capabilities.
Regex limitation tests check values, sources and setting names instead
of whole sentences.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
Part of #6176. The regex worker old-generation request is now
REA_REGEX_WORKER_HEAP_REQUEST_MIB. Unset still requests 128 MiB. This does not cover the issue's decoder heap or MCP startup budgets.Problem and expected behavior
The regex worker requested a fixed 128 MiB old generation, and capability and recovery text said that request had no runtime override. Callers need a named setting whose default is that constant. Invalid values must fail configuration and name the setting. A positive Node
--max-old-space-size, includingNODE_OPTIONS, still overrides the request and is not clamped by the setting.Unset behavior stays a 128 MiB request. A value from 7 to 16384 MiB is the request. Any other value fails startup, doctor, and client-registration configuration and names
REA_REGEX_WORKER_HEAP_REQUEST_MIB. It does not fall back to 128. Setup copies a caller-selected value throughSELECTED_REGISTRATION_SETTINGS.Recovery, capability, and limitation text name the setting, the effective request, the source (
defaultorsetting), the default, the floor, the maximum, and how to change it. They also name the process effective heap when launch flags establish it.Change and scope
src/config/regexWorkerHeapRequest.tsowns the setting. Startup (parseConfig) and doctor (parseEnvironment) resolve it with the same schema. The effective request is stored onAppConfigand passed into Hopper and Kuna, which pass it toRegexMatcher. A directKunaProviderresolves the selected environment instead of ambientprocess.env. An omitted matcher request means the 128 MiB default, not ambientprocess.env.Setup keeps
REA_REGEX_WORKER_HEAP_REQUEST_MIBinSELECTED_REGISTRATION_SETTINGS. A present value is copied into the generated registration. An unset value is omitted.The floor is 7 MiB. On Linux, the production worker (
^aagainst["a"], noNODE_OPTIONS) returnsERR_WORKER_OUT_OF_MEMORYat 6 MiB on Node 24.21.0 and 24.22.1, and on most runs of Node 24.11.0, 24.18.0, and 26.0.0. 7 MiB returned that match on Node 22.19.0, 22.23.4, 24.11.0, 24.18.0, 24.21.0, 24.22.1, 26.0.0, and 26.12.1, so a smaller request is not a matching bound on every supported Node line. The maximum is 16384 MiB, the same ceiling REA already uses for one isolated JavaScript analysis worker. Node starts with a larger flag; this maximum bounds only the REA request. A positive--max-old-space-sizeis reported as the effective heap and is not limited by this floor or maximum.Follow the contribution scope. This is configuration of an existing regex worker request. It does not add a provider or a capability that executes, injects, mutates, or recovers a target. Maintainer scope decision: not applicable. The product decision to make this ceiling a setting is recorded in #6176.
Contract and boundary impact
src/config/regexWorkerHeapRequest.tsparses the setting;parseConfigresolves it before providers match.explicitSetupRegistrationEnvironmentpreserves a caller-selected value when setup writes a registration.search_proceduresandsearch_stringsdescriptions nameREA_REGEX_WORKER_HEAP_REQUEST_MIB, the 128 MiB default, the 7 MiB floor, and the 16384 MiB maximum. Capability and heap failures name the effective request and source.--max-old-space-size, includingNODE_OPTIONS, still overrides it. Percentage,--max-heap-size, env-file, and experimental config-file launches still leave the effective heap unestablished.requested_worker_heap_sourcebesiderequested_worker_heap_mib.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): tool descriptions changed in source contracts. No authored skill text claimed the heap request had no override.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
6; Hopper/Kuna capability text for a 256 MiB request while ambientprocess.envis8; a selected request of 256 stays in effect, and--max-old-space-size=64still overrides it to 64 MiB without clamping. A clean Node process, withNODE_OPTIONSremoved and without--import tsxonexecArgv, calls productionmatchRegexValuesat the floor and matches^aagainst["a"].ERR_WORKER_OUT_OF_MEMORYat 6 MiB (5/5) and{ok:true, indices:[0]}at 7 MiB (5/5). The same 7 MiB production call matched on Node 22.19.0, 22.23.4, 24.11.0, 24.18.0, 26.0.0, and 26.12.1 (3/3 each). Raw worker repeats at 6 MiB were 0/10 matches on 24.21.0 and 24.22.1, 1/10 on 24.11.0 and 24.18.0, and 2/10 on 26.0.0; 7 MiB was 10/10 on those builds.The effective REA_REGEX_WORKER_HEAP_REQUEST_MIB value is 128 MiB (source default; default 128 MiB, floor 7 MiB, maximum 16384 MiB). Set REA_REGEX_WORKER_HEAP_REQUEST_MIB in the environment that starts REA to a decimal integer from 7 to 16384, then restart REA.A 256 MiB setting usessource settingand256 MiB.resolveRegexWorkerHeapand capability text, not by exhausting a 256 MiB worker.For evidence-bearing changes:
Validation performed
npm run check:fast— typecheck and lint, 2 tasks successful (6.695s).npm run format:check— all matched files use the correct format (4944 files).npm run test:local -- src/config/regexWorkerHeapRequest.test.ts src/process/RegexMatcher.test.ts src/application/Doctor.test.ts— 124 passed.npm run test:focused -- tests/boundary/process/regexMatcher.test.ts tests/boundary/filesystem/clientConfigurationEnvironment.test.ts— 43 passed, 10 skipped. The real-worker floor test is in the process-boundary file.Compatibility, safety, and release
REA_REGEX_WORKER_HEAP_REQUEST_MIB=6is now a configuration error. It previously passed configuration and then failed regex search on supported Node 24 and Node 26.0.0. A positive--max-old-space-sizestill overrides the request.resourceLimits.maxOldGenerationSizeMb. The setting changes only that REA request. It does not raise a Node--max-old-space-sizealready applied to the process, and it does not change target memory.Author readiness
Human owner: @morluto
Before merge
type(scope): outcome.