mirror of
https://github.com/morluto/rea.git
synced 2026-11-06 06:46:10 +00:00
fix(process): name the Swift compile deadline (#6071)
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: Cursor Agent <cursoragent@cursor.com> Co-authored-by: morluto <morluto@users.noreply.github.com>
This commit is contained in:
26 files changed
+321
-95
No files matched your search
@@ -7,6 +7,7 @@ import { z } from "zod";
|
||||
|
||||
import {
|
||||
DEFAULT_SWIFTC_COMPILE_TIMEOUT_MS,
|
||||
MAX_PROVIDER_STARTUP_TIMEOUT_MS,
|
||||
providerStartupTimeoutSchema,
|
||||
} from "../config/providerStartupTimeout.js";
|
||||
import { err, ok, type Result } from "../domain/result.js";
|
||||
@@ -105,7 +106,9 @@ export const SWIFTC_INTERRUPT = "SIGINT";
|
||||
* Swift SDK cache on the supported Intel macOS VM (about 88s), so compilation
|
||||
* stays bounded independently of short provider version probes. Invalid ambient
|
||||
* values fall back to the default; `parseConfig` still rejects them at CLI/MCP
|
||||
* admission.
|
||||
* admission. The resolved value is captured when the reader is created.
|
||||
* Production creates that reader from the launch environment at process start,
|
||||
* so a change applies after REA restarts, on the next ownership-helper compile.
|
||||
*/
|
||||
export const resolveSwiftcCompileTimeoutMs = (
|
||||
options: {
|
||||
@@ -121,6 +124,10 @@ export const resolveSwiftcCompileTimeoutMs = (
|
||||
return parsed.success ? parsed.data : DEFAULT_SWIFTC_COMPILE_TIMEOUT_MS;
|
||||
};
|
||||
|
||||
/** Name the existing swiftc deadline when a helper compile times out. */
|
||||
export const swiftcCompileTimeoutRecovery = (timeoutMs: number): string =>
|
||||
`The effective REA_SWIFTC_COMPILE_TIMEOUT_MS value is ${String(timeoutMs)} ms (integer range 1..${String(MAX_PROVIDER_STARTUP_TIMEOUT_MS)}; omitted default ${String(DEFAULT_SWIFTC_COMPILE_TIMEOUT_MS)} ms). Set it in the environment that starts REA and restart REA; the next ownership-helper compile uses the new value.`;
|
||||
|
||||
/** Bound on compiler diagnostics embedded in the inspection failure text. */
|
||||
const STDERR_EXCERPT_LIMIT = 512;
|
||||
|
||||
@@ -272,8 +279,11 @@ const compilerOutcomeDescription = (
|
||||
if (outcome === undefined) return `compiler result: ${String(fallbackCode)}`;
|
||||
if (outcome.outcome === "exited")
|
||||
return `compiler result: exit code ${String(outcome.code)}`;
|
||||
if (outcome.outcome === "timed_out")
|
||||
return `compiler result: timed out after ${String(outcome.timeoutMs)} ms`;
|
||||
if (outcome.outcome === "timed_out") {
|
||||
if (outcome.timeoutMs === undefined)
|
||||
return "compiler result: timed out. The effective REA_SWIFTC_COMPILE_TIMEOUT_MS value was not reported.";
|
||||
return `compiler result: timed out after ${String(outcome.timeoutMs)} ms. ${swiftcCompileTimeoutRecovery(outcome.timeoutMs)}`;
|
||||
}
|
||||
if (outcome.outcome === "signaled")
|
||||
return `compiler result: stopped by signal ${outcome.signal ?? "an unknown signal"}`;
|
||||
return `compiler result: ${String(outcome.code)}`;
|
||||
@@ -302,8 +312,13 @@ const compilerInspectionError = (
|
||||
stderr.truncated ||
|
||||
outcome?.stderrTruncated === true ||
|
||||
outcome?.outputTruncated === true;
|
||||
const truncationNote = !truncated
|
||||
? ""
|
||||
: stderr.truncated
|
||||
? `… [diagnostics truncated at ${String(STDERR_EXCERPT_LIMIT)} bytes; this release has no runtime override]`
|
||||
: "… [diagnostics truncated; this release has no runtime override]";
|
||||
const suffix = diagnostics
|
||||
? `: ${diagnostics}${truncated ? "… [diagnostics truncated]" : ""}`
|
||||
? `: ${diagnostics}${truncationNote}`
|
||||
: outcome === undefined
|
||||
? `: ${cause instanceof Error ? cause.message : String(cause)}`
|
||||
: ": no compiler diagnostics were captured";
|
||||
|
||||
Reference in new issue
Block a user