diff --git a/src/config/hopperCallerScanBudget.test.ts b/src/config/hopperCallerScanBudget.test.ts index ae00aa16ac..f59ebb0f17 100644 --- a/src/config/hopperCallerScanBudget.test.ts +++ b/src/config/hopperCallerScanBudget.test.ts @@ -3,7 +3,7 @@ import { expect, it } from "vitest"; import { explicitSetupRegistrationEnvironment } from "../application/SetupRegistrationEnvironment.js"; import { DEFAULT_HOPPER_CALLER_SCAN_BUDGET_MS, - MAXIMUM_HOPPER_CALLER_SCAN_BUDGET_MS, + MAX_NODE_TIMER_DELAY_MS, MINIMUM_HOPPER_CALLER_SCAN_BUDGET_MS, } from "../domain/analysisResourceLimits.js"; import { @@ -35,7 +35,7 @@ it("records the default caller-scan budget and forwards an explicit setting", () milliseconds: DEFAULT_HOPPER_CALLER_SCAN_BUDGET_MS, source: "default", floorMilliseconds: MINIMUM_HOPPER_CALLER_SCAN_BUDGET_MS, - maximumMilliseconds: MAXIMUM_HOPPER_CALLER_SCAN_BUDGET_MS, + maximumMilliseconds: MAX_NODE_TIMER_DELAY_MS, }); const selected = parseConfig({ [HOPPER_CALLER_SCAN_BUDGET_SETTING]: "250", @@ -66,7 +66,7 @@ it("explains the time budget and that fixed byte allowances have no override", ( `The default is ${String(DEFAULT_HOPPER_CALLER_SCAN_BUDGET_MS)} ms`, ); expect(time).toContain( - `from ${String(MINIMUM_HOPPER_CALLER_SCAN_BUDGET_MS)} to ${String(MAXIMUM_HOPPER_CALLER_SCAN_BUDGET_MS)} ms`, + `from ${String(MINIMUM_HOPPER_CALLER_SCAN_BUDGET_MS)} to ${String(MAX_NODE_TIMER_DELAY_MS)} ms`, ); expect(time).toContain("no runtime override"); expect(time).toContain( diff --git a/src/config/hopperCallerScanBudget.ts b/src/config/hopperCallerScanBudget.ts index d4eab9f564..68af956a91 100644 --- a/src/config/hopperCallerScanBudget.ts +++ b/src/config/hopperCallerScanBudget.ts @@ -1,6 +1,6 @@ import { DEFAULT_HOPPER_CALLER_SCAN_BUDGET_MS, - MAXIMUM_HOPPER_CALLER_SCAN_BUDGET_MS, + MAX_NODE_TIMER_DELAY_MS, MINIMUM_HOPPER_CALLER_SCAN_BUDGET_MS, } from "../domain/analysisResourceLimits.js"; import { @@ -28,7 +28,7 @@ export const defaultHopperCallerScanBudget = (): HopperCallerScanBudget => ({ source: "default", defaultMilliseconds: DEFAULT_HOPPER_CALLER_SCAN_BUDGET_MS, floorMilliseconds: MINIMUM_HOPPER_CALLER_SCAN_BUDGET_MS, - maximumMilliseconds: MAXIMUM_HOPPER_CALLER_SCAN_BUDGET_MS, + maximumMilliseconds: MAX_NODE_TIMER_DELAY_MS, }); /** Record whether the launch environment supplied the budget. */ diff --git a/src/config/providerStartupTimeout.ts b/src/config/providerStartupTimeout.ts index 0398120d33..6fc9d922cf 100644 --- a/src/config/providerStartupTimeout.ts +++ b/src/config/providerStartupTimeout.ts @@ -1,5 +1,5 @@ import { - MAX_PROVIDER_STARTUP_TIMEOUT_MS, + MAX_NODE_TIMER_DELAY_MS, MAX_GHIDRA_DECOMPILE_TIMEOUT_SECONDS, } from "../domain/analysisResourceLimits.js"; import { z } from "zod"; @@ -20,4 +20,4 @@ export const providerStartupTimeoutSchema = z .string() .regex(/^[1-9]\d*$/u, "must be a positive decimal integer") .transform(Number) - .pipe(z.int().min(1).max(MAX_PROVIDER_STARTUP_TIMEOUT_MS)); + .pipe(z.int().min(1).max(MAX_NODE_TIMER_DELAY_MS)); diff --git a/src/domain/analysisResourceLimits.ts b/src/domain/analysisResourceLimits.ts index e6c7a2985c..806e48ef34 100644 --- a/src/domain/analysisResourceLimits.ts +++ b/src/domain/analysisResourceLimits.ts @@ -45,21 +45,14 @@ export const MINIMUM_HOPPER_CALLER_SCAN_BUDGET_MS = 1; * Largest delay Node schedules exactly. Delays above this signed 32-bit * boundary become a 1 ms timer, so startup and swiftc timeouts stop here. */ -export const MAX_PROVIDER_STARTUP_TIMEOUT_MS = 2_147_483_647; - -/** - * Largest caller-scan budget Node can schedule exactly. A delay above this - * signed 32-bit bound becomes 1 ms, so the setting stops here. - */ -export const MAXIMUM_HOPPER_CALLER_SCAN_BUDGET_MS = - MAX_PROVIDER_STARTUP_TIMEOUT_MS; +export const MAX_NODE_TIMER_DELAY_MS = 2_147_483_647; /** * Ghidra 12.1.4 converts whole seconds to a signed int millisecond delay. * Keep that multiplication positive and exact rather than imposing a day cap. */ export const MAX_GHIDRA_DECOMPILE_TIMEOUT_SECONDS = Math.floor( - MAX_PROVIDER_STARTUP_TIMEOUT_MS / 1000, + MAX_NODE_TIMER_DELAY_MS / 1000, ); /** Matching deadline used when the setting is unset. Today's fixed constant. */ diff --git a/src/domain/analysisSettingDefinitions.ts b/src/domain/analysisSettingDefinitions.ts index 1769e79614..95712f7cbe 100644 --- a/src/domain/analysisSettingDefinitions.ts +++ b/src/domain/analysisSettingDefinitions.ts @@ -5,7 +5,7 @@ import { MAXIMUM_ASAR_MAX_HEADER_BYTES, DEFAULT_GHIDRA_STARTUP_TIMEOUT_MS, DEFAULT_HOPPER_STARTUP_TIMEOUT_MS, - MAX_PROVIDER_STARTUP_TIMEOUT_MS, + MAX_NODE_TIMER_DELAY_MS, MAX_GHIDRA_DECOMPILE_TIMEOUT_SECONDS, DEFAULT_REGEX_MATCHING_DEADLINE_MS, MAXIMUM_REGEX_MATCHING_DEADLINE_MS, @@ -42,7 +42,7 @@ interface SettingDefinition { } const timer = { minimum: 1, - maximum: MAX_PROVIDER_STARTUP_TIMEOUT_MS, + maximum: MAX_NODE_TIMER_DELAY_MS, unit: "ms", appliesAt: "next_operation", } as const; diff --git a/src/domain/hopperStartupFailure.ts b/src/domain/hopperStartupFailure.ts index d85ae9fdff..b9c8340ef8 100644 --- a/src/domain/hopperStartupFailure.ts +++ b/src/domain/hopperStartupFailure.ts @@ -1,4 +1,4 @@ -import { MAX_PROVIDER_STARTUP_TIMEOUT_MS } from "./analysisResourceLimits.js"; +import { MAX_NODE_TIMER_DELAY_MS } from "./analysisResourceLimits.js"; export type HopperPrivateDisplayStrategy = | "direct" @@ -19,8 +19,7 @@ export const MINIMUM_HOPPER_DEMO_DIALOG_TIMEOUT_MS = 1; * Largest accepted dialog watch. Delays above this signed 32-bit bound are * the same ceiling REA uses for its other millisecond settings. */ -export const MAXIMUM_HOPPER_DEMO_DIALOG_TIMEOUT_MS = - MAX_PROVIDER_STARTUP_TIMEOUT_MS; +export const MAXIMUM_HOPPER_DEMO_DIALOG_TIMEOUT_MS = MAX_NODE_TIMER_DELAY_MS; /** Rejected dialog-timeout setting retained with the adapter diagnostic. */ export type DialogTimeoutRejection = { diff --git a/src/jeb/JebMcpDeadline.ts b/src/jeb/JebMcpDeadline.ts index 0ad49f7560..31a2ece7f7 100644 --- a/src/jeb/JebMcpDeadline.ts +++ b/src/jeb/JebMcpDeadline.ts @@ -7,7 +7,7 @@ import { AnalysisCancelledError, AnalysisTimeoutError, } from "../domain/analysisErrorCore.js"; -import { MAX_PROVIDER_STARTUP_TIMEOUT_MS } from "../domain/analysisResourceLimits.js"; +import { MAX_NODE_TIMER_DELAY_MS } from "../domain/analysisResourceLimits.js"; import { ProviderStartupDeadline } from "../process/ProviderDeadline.js"; /** Which JEB MCP phase consumed `REA_JEB_MCP_TIMEOUT_MS`. */ @@ -19,7 +19,7 @@ export const jebMcpTimeoutGuidance = ( timeoutMs: number, ): { readonly userMessage: string; readonly remediationAction: string } => ({ userMessage: `This request reached REA's configured JEB ${phase === "discovery" ? "catalog discovery" : phase} deadline of ${String(timeoutMs)} ms (deadlineExpired).`, - remediationAction: `Increase REA_JEB_MCP_TIMEOUT_MS in REA's launch environment to an integer from 1 to ${String(MAX_PROVIDER_STARTUP_TIMEOUT_MS)} milliseconds (omitted means ${String(DEFAULT_REQUEST_TIMEOUT_MSEC)} ms) and restart and reconnect REA to apply it. The same setting raises catalog discovery and each tools/call. Allow execution, cleanup and delivery headroom in the outer MCP client deadline. Confirm outstanding work and cleanup before retrying.`, + remediationAction: `Increase REA_JEB_MCP_TIMEOUT_MS in REA's launch environment to an integer from 1 to ${String(MAX_NODE_TIMER_DELAY_MS)} milliseconds (omitted means ${String(DEFAULT_REQUEST_TIMEOUT_MSEC)} ms) and restart and reconnect REA to apply it. The same setting raises catalog discovery and each tools/call. Allow execution, cleanup and delivery headroom in the outer MCP client deadline. Confirm outstanding work and cleanup before retrying.`, }); /** SDK 2.3.1 preserves an SdkError abort reason by identity. */ diff --git a/src/process/DarwinProcessRunTokenReader.timeout.test.ts b/src/process/DarwinProcessRunTokenReader.timeout.test.ts index f807d5ce22..339a0642fa 100644 --- a/src/process/DarwinProcessRunTokenReader.timeout.test.ts +++ b/src/process/DarwinProcessRunTokenReader.timeout.test.ts @@ -4,7 +4,7 @@ import { resolveSwiftcCompileTimeoutMs, swiftcCompileTimeoutRecovery, } from "./DarwinProcessRunTokenReader.js"; -import { MAX_PROVIDER_STARTUP_TIMEOUT_MS } from "../domain/analysisResourceLimits.js"; +import { MAX_NODE_TIMER_DELAY_MS } from "../domain/analysisResourceLimits.js"; describe("resolveSwiftcCompileTimeoutMs", () => { it("keeps the historical default when unset", () => { @@ -40,7 +40,7 @@ describe("resolveSwiftcCompileTimeoutMs", () => { const recovery = swiftcCompileTimeoutRecovery(300_000); expect(recovery).toContain("REA_SWIFTC_COMPILE_TIMEOUT_MS"); expect(recovery).toContain("300000 ms"); - expect(recovery).toContain(`1..${String(MAX_PROVIDER_STARTUP_TIMEOUT_MS)}`); + expect(recovery).toContain(`1..${String(MAX_NODE_TIMER_DELAY_MS)}`); expect(recovery).toContain("120000 ms"); expect(recovery).toContain("restart REA"); expect(recovery).toContain("next ownership-helper compile"); diff --git a/src/process/DarwinProcessRunTokenReader.ts b/src/process/DarwinProcessRunTokenReader.ts index c54ee09350..333c70a68c 100644 --- a/src/process/DarwinProcessRunTokenReader.ts +++ b/src/process/DarwinProcessRunTokenReader.ts @@ -10,7 +10,7 @@ import { DEFAULT_SWIFTC_COMPILE_TIMEOUT_MS, providerStartupTimeoutSchema, } from "../config/providerStartupTimeout.js"; -import { MAX_PROVIDER_STARTUP_TIMEOUT_MS } from "../domain/analysisResourceLimits.js"; +import { MAX_NODE_TIMER_DELAY_MS } from "../domain/analysisResourceLimits.js"; import { err, ok, type Result } from "../domain/result.js"; import { ProviderCleanupError } from "../domain/providerCleanupError.js"; import type { @@ -132,7 +132,7 @@ export const resolveSwiftcCompileTimeoutMs = ( /** 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.`; + `The effective REA_SWIFTC_COMPILE_TIMEOUT_MS value is ${String(timeoutMs)} ms (integer range 1..${String(MAX_NODE_TIMER_DELAY_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;