Skip to content

fix(process): name the Swift compile deadline - #6071

Merged
morluto merged 1 commit into
mainfrom
cursor/swiftc-compile-deadline-19d7
Oct 21, 2026
Merged

morluto merged 1 commit into
mainfrom
cursor/swiftc-compile-deadline-19d7

Conversation

@morluto

@morluto morluto commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Summary

Names the existing REA_SWIFTC_COMPILE_TIMEOUT_MS control 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 swiftc helper 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_MS value in milliseconds, the integer range 1..2147483647, and the omitted default of 120000 ms. The reader captures that value when it is created. Production creates systemProcessOwnershipHost from 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; parseConfig still rejects them at CLI/MCP admission.

Change and scope

Wording and error projection only. The timeout sentence is built from resolveSwiftcCompileTimeoutMs and MAX_PROVIDER_STARTUP_TIMEOUT_MS (the same schema bound as providerStartupTimeoutSchema). 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

  • Semantic owner and earliest changed stage: process ownership and producer command projection; the swiftc deadline is read when the Darwin token reader is constructed.
  • Contribution scope fit and linked maintainer decision: not applicable. Wording within existing boundaries.
  • CLI and MCP/tool-catalog contract: recovery text and tool descriptions change. No new arguments or settings.
  • Provider, bridge, target-format, or platform compatibility: Darwin helper timeout text; Linux producer SIGXCPU/SIGXFSZ and sigrok/tshark limitation text. No behavior change on either platform.
  • Evidence, artifact, provenance, or reconstruction contract: none. Compiler outcome facts stay the same; the timeout message names the deadline that was already applied.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): cleanup still uses the same intervals. Failure reasons now include the fixed count and a no-override sentence.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): docs updated in docs/installation.md, docs/mcp-contracts.md, docs/process-capture.md, docs/kuna-provider.md, and docs/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.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: Darwin timeout unit and boundary tests, producer command projection, process-group revalidation, debugger detach, regex matcher, terminal cell budget, and sigrok/tshark SIGXFSZ recovery.
  • Base reproduction or other evidence: source inspection of resolveSwiftcCompileTimeoutMs, createDarwinProcessRunTokenReader, and systemProcessOwnershipHost. The control is REA_SWIFTC_COMPILE_TIMEOUT_MS in src/config/environment.ts, parsed by providerStartupTimeoutSchema (1..2147483647, default 120000).
  • User-visible CLI/MCP output (if applicable): a timeout includes 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.
  • Remaining proof gaps: no real swiftc, Xcode, or prlimit run. 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:

  • 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

  • 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

  • Breaking changes or migration steps: none. Recovery text is more specific. Callers that match old timeout or cleanup sentences need to expect the added sentences.
  • Real Hopper/Ghidra, browser, or OS coverage: not run. No macOS swiftc or live prlimit producer.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no authority change. The SIGXCPU/SIGXFSZ sentence still says the signal's exact cause is not independently established. Inherited address space, file size, and CPU time stay clamped; command, input, and output budgets stay REA fixed caps.

Author readiness

Human owner: @morluto

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.
Open in Web Open in Cursor 

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>
@morluto
morluto merged commit d8a9673 into main Oct 21, 2026
42 checks passed
@morluto
morluto deleted the cursor/swiftc-compile-deadline-19d7 branch October 21, 2026 15:46
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-21T15:52:10.812528Z 8dac533 PR opened
ℹ️ 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.

@github-actions github-actions Bot mentioned this pull request Oct 21, 2026
3 tasks done

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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.`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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.`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5 Tier: plus

[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.

Fix All in CodexFindings

  1. P2 Regex heap guidance ignores flags ▶
Fix with agent prompt
### Issue 1
src/process/RegexMatcher.ts:45
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.

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!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Names REA_SWIFTC_COMPILE_TIMEOUT_MS in Darwin helper timeout errors, including its effective value, range, default, and restart requirement.

  • Swift helper timeouts name the deadline and when a change takes effect.
  • Producer failures identify fixed deadlines and inherited resource limits.
  • Regex search reports its fixed deadline and worker heap.
  • Process capture calls out its fixed terminal cell budget.
  • Cleanup failures state the fixed bounds they reached.

Reviews (1) · Last reviewed commit: "fix(process): name the Swift compile dea..." · Reviewed by Greptile

{ 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.`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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!

Fix in Codex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants