Repository navigation
fix(process): name the Swift compile deadline - #6071
Conversation
Name REA_SWIFTC_COMPILE_TIMEOUT_MS, its effective milliseconds, the 1..2147483647 range, and the omitted 120000 ms default when a Darwin ownership-helper compile times out. A change applies after REA restarts, on the next ownership-helper compile. Producer SIGXCPU and SIGXFSZ recovery says REA retains the tighter inherited limit. Agent-visible fixed caps in this theme say this release has no runtime override. Numbers are unchanged. Refs #5910 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: 8dac533fd5
ℹ️ 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".
| const WORKER_HEAP_MIB = 128; | ||
| /** Shared capability text for the supervised ECMAScript matching boundary. */ | ||
| export const REGEX_MATCHING_LIMITATION = `Regex mode uses ECMAScript Unicode semantics in a cancellable worker with a ${String(MATCHING_DEADLINE_MS / 1000)}-second matching deadline; matching failure leaves the service available.`; | ||
| export const REGEX_MATCHING_LIMITATION = `Regex mode uses ECMAScript Unicode semantics in a cancellable worker with a ${String(MATCHING_DEADLINE_MS / 1000)}-second matching deadline and a ${String(WORKER_HEAP_MIB)} MiB worker heap. This release has no runtime override for either cap; matching failure leaves the service available.`; |
There was a problem hiding this comment.
Do not advertise the worker heap as an unchangeable cap
When REA is launched with --max-old-space-size—including through NODE_OPTIONS—Node gives that flag precedence over resourceLimits.maxOldGenerationSizeMb, as documented by the Node Worker API. Consequently, the worker can exceed the advertised 128 MiB setting and may not produce ERR_WORKER_OUT_OF_MEMORY at that budget, so both “fixed” and “no runtime override” misstate the effective resource bound. Either reject/neutralize the overriding flag or describe and report the effective limit instead.
AGENTS.md reference: AGENTS.md:L37-L39
Useful? React with 👍 / 👎.
| detail, | ||
| { | ||
| ...detail, | ||
| remediationAction: `${reported} REA retains the tighter inherited limit. This release has no runtime override for that ceiling. A smaller artifact may finish inside the retained limit. Repeating the unchanged request fails the same way.`, |
There was a problem hiding this comment.
Keep retries uncertain when the signal cause is unknown
When a producer self-raises or externally receives SIGXCPU/SIGXFSZ rather than actually exhausting the reported rlimit, an unchanged retry may succeed. This branch explicitly states that the signal's exact cause is not independently established, so asserting that the retry “fails the same way” converts that unknown into an unsupported deterministic conclusion and can discourage a useful retry; reserve this sentence for a proven limit breach or keep the retry outcome uncertain.
AGENTS.md reference: AGENTS.md:L5-L5
Useful? React with 👍 / 👎.
[Medium impact] The changes reach user-facing messages across several bounded workflows. The PR appears safe to merge, with a non-blocking correction to the regex heap guidance.
|
| { worker_heap_mib: WORKER_HEAP_MIB }, | ||
| { | ||
| cause, | ||
| remediationAction: `The regex worker heap is ${String(WORKER_HEAP_MIB)} MiB and this release has no runtime override. Inherited limits and additional host memory do not raise it. Simplify the pattern or use literal mode.`, |
There was a problem hiding this comment.
Regex heap guidance ignores flags
The new claim that the regex heap cannot be overridden is incorrect. Node.js lets --max-old-space-size override resourceLimits.maxOldGenerationSizeMb. REA even recommends that startup flag in KunaJsonStream.ts. Users who start REA with a larger heap therefore receive misleading fixed-128-MiB wording and recovery advice.
Describe the heap as a default that startup flags can override. Update the matching capability text and docs too.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/process/RegexMatcher.ts
Line: 45
Comment:
**Regex heap guidance ignores flags**
The new claim that the regex heap cannot be overridden is incorrect. Node.js lets `--max-old-space-size` override `resourceLimits.maxOldGenerationSizeMb`. REA even recommends that startup flag in `KunaJsonStream.ts`. Users who start REA with a larger heap therefore receive misleading fixed-128-MiB wording and recovery advice.
Describe the heap as a default that startup flags can override. Update the matching capability text and docs too.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
Names the existing
REA_SWIFTC_COMPILE_TIMEOUT_MScontrol on a Darwin ownership-helper compile timeout, and says when REA retains a tighter inherited producer limit. Agent-visible fixed caps in the process/swiftc theme say this release has no runtime override. Part of #5910 (parent #5808). Numbers are unchanged.Problem and expected behavior
A timed-out
swiftchelper reported milliseconds without the setting name, the allowed range, the omitted default, or when a change applies. SIGXCPU and SIGXFSZ recovery did not say that REA keeps the tighter inherited ceiling. Other agent-visible process caps in this theme omitted the no-override sentence.A timeout now names the effective
REA_SWIFTC_COMPILE_TIMEOUT_MSvalue in milliseconds, the integer range 1..2147483647, and the omitted default of 120000 ms. The reader captures that value when it is created. Production createssystemProcessOwnershipHostfrom the launch environment at process start, so a change applies after REA restarts, on the next ownership-helper compile. Invalid ambient values still fall back to 120000 in the reader;parseConfigstill rejects them at CLI/MCP admission.Change and scope
Wording and error projection only. The timeout sentence is built from
resolveSwiftcCompileTimeoutMsandMAX_PROVIDER_STARTUP_TIMEOUT_MS(the same schema bound asproviderStartupTimeoutSchema). SIGXCPU and SIGXFSZ name the reported inherited address-space, file, and CPU ceilings and say REA retains the tighter inherited limit. Fixed producer command, input, and output allowances, the 512-byte compiler diagnostic excerpt, regex deadline and heap, terminal cell budget, debugger detach, and process-group revalidation say there is no runtime override.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 stays inside existing process, capture, and signal error text. No new provider, target execution, injection, mutation, or protection recovery.
Out of scope: MCP (#6005), providers (#6014), JavaScript (#6022), Android (#6024), browser (#6036), native (#6059), engines, and ASAR. No settings tool. Internal poll intervals and stored bounds that are not an agent sentence are unchanged.
Contract and boundary impact
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): docs updated indocs/installation.md,docs/mcp-contracts.md,docs/process-capture.md,docs/kuna-provider.md, anddocs/native-investigation.md. No package or catalog source change.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
resolveSwiftcCompileTimeoutMs,createDarwinProcessRunTokenReader, andsystemProcessOwnershipHost. The control isREA_SWIFTC_COMPILE_TIMEOUT_MSinsrc/config/environment.ts, parsed byproviderStartupTimeoutSchema(1..2147483647, default120000).The effective REA_SWIFTC_COMPILE_TIMEOUT_MS value is <ms> ms (integer range 1..2147483647; omitted default 120000 ms). Set it in the environment that starts REA and restart REA; the next ownership-helper compile uses the new value.swiftc, Xcode, orprlimitrun. Linux fixture compilers and projected errors only. A successful compile remains cached for the process, so the captured deadline also covers retries in that process.For evidence-bearing changes:
Validation performed
npm run check:fast— typecheck and lint succeeded (turbo 2.11.7, 2 tasks, 5.723s).npm run format:check— oxfmt reported all matched files correctly formatted.npm run test:focused --the ten process, swiftc, capture, and signal tests listed below — 10 files passed, 250 tests passed, 7 skipped.Source:
DarwinProcessRunTokenReader.timeout.test.ts,ArtifactAnalysisResources.test.ts,ProcessOwnership.validation.test.ts,processScenario.test.ts,fixedAllowanceRemediation.test.ts. Boundary:darwinProcessRunTokenReader.test.ts,ownedDebuggerSession.test.ts,regexMatcher.test.ts,captureProvider.test.ts,recordingProvider.test.ts.Compatibility, safety, and release
swiftcor liveprlimitproducer.Author readiness
Human owner: @morluto
Before merge
type(scope): outcome.