[GH-ISSUE #2184] macOS: make the swiftc helper compile deadline (hard-coded 60 s) configurable #728

Closed
opened 2026-10-15 18:27:45 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @athosmartins on GitHub (Oct 12, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/2184

Version: rea-agents 6.4.0, macOS (Node 22, Xcode command line tools present).

DarwinProcessRunTokenReader compiles the Swift helper (bridge/process/ProcessRunTokenReader*.swift) with xcrun swiftc the first time it needs process ownership. The compile is run with a hard-coded timeout: 60_000 (dist/process/DarwinProcessRunTokenReader.js, around line 135 in 6.4.0). We could not find an environment variable or CLI option that changes it; on current main there is an injectable compileTimeoutMs, but it does not seem to be reachable from the CLI or the environment.

On a heavily loaded machine (load average several times the core count) that compile can take longer than 60 s and the command then fails with a timeout, so the same command succeeds on an idle machine and fails on a busy one. We hit this once on a busy host. To be upfront, we have not been able to reproduce a >60 s compile since: a single later compile took about 15 s while the machine was still heavily loaded, so we cannot give you a reliable repro, only the shape of the problem.

Request: expose the deadline, e.g. REA_SWIFTC_COMPILE_TIMEOUT_MS (mirroring the existing REA_GHIDRA_STARTUP_TIMEOUT_MS), keeping 60000 as the default so nothing changes for anyone who does not set it.

Current workaround: a one-line local patch (60_000 -> 300_000) re-applied after each install, which is fragile because npm install --global drops it.

Happy to send a PR for the env var if that direction is acceptable.

Originally created by @athosmartins on GitHub (Oct 12, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/2184 **Version:** rea-agents 6.4.0, macOS (Node 22, Xcode command line tools present). `DarwinProcessRunTokenReader` compiles the Swift helper (`bridge/process/ProcessRunTokenReader*.swift`) with `xcrun swiftc` the first time it needs process ownership. The compile is run with a hard-coded `timeout: 60_000` (`dist/process/DarwinProcessRunTokenReader.js`, around line 135 in 6.4.0). We could not find an environment variable or CLI option that changes it; on current main there is an injectable `compileTimeoutMs`, but it does not seem to be reachable from the CLI or the environment. On a heavily loaded machine (load average several times the core count) that compile can take longer than 60 s and the command then fails with a timeout, so the same command succeeds on an idle machine and fails on a busy one. We hit this once on a busy host. To be upfront, we have not been able to reproduce a >60 s compile since: a single later compile took about 15 s while the machine was still heavily loaded, so we cannot give you a reliable repro, only the shape of the problem. **Request:** expose the deadline, e.g. `REA_SWIFTC_COMPILE_TIMEOUT_MS` (mirroring the existing `REA_GHIDRA_STARTUP_TIMEOUT_MS`), keeping `60000` as the default so nothing changes for anyone who does not set it. **Current workaround:** a one-line local patch (`60_000` -> `300_000`) re-applied after each install, which is fragile because `npm install --global` drops it. Happy to send a PR for the env var if that direction is acceptable.
Author
Owner

@matbrgz commented on GitHub (Oct 12, 2026):

Implementation & Configuration Review

Making the Swift helper compilation deadline configurable via an explicit environment variable resolves compilation timeouts under loaded CI/CD workers or low-spec hosts:

  • Config Proposal: Expose REA_SWIFTC_COMPILE_TIMEOUT_MS (with default 60000, bounded between 10_000 and 300_000), wiring it into DarwinProcessRunTokenReader.
  • Precompilation Option: In release builds (npm run build:cached), precompiling the helper into dist/ or caching the built binary by content-hash in ~/.cache/rea/ would remove the xcrun swiftc latency on the user's first command entirely.
<!-- gh-comment-id:6134401444 --> @matbrgz commented on GitHub (Oct 12, 2026): ### Implementation & Configuration Review Making the Swift helper compilation deadline configurable via an explicit environment variable resolves compilation timeouts under loaded CI/CD workers or low-spec hosts: - **Config Proposal:** Expose `REA_SWIFTC_COMPILE_TIMEOUT_MS` (with default `60000`, bounded between `10_000` and `300_000`), wiring it into `DarwinProcessRunTokenReader`. - **Precompilation Option:** In release builds (`npm run build:cached`), precompiling the helper into `dist/` or caching the built binary by content-hash in `~/.cache/rea/` would remove the `xcrun swiftc` latency on the user's first command entirely.
Sign in to join this conversation.
No milestone
No project
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#728
No description provided.