Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(verifiers): align WABT operation timeout (#4117)

Ysopwnablecd64e24ff21a
diff --git a/scripts/lib/wabt-verifier-timeouts.mjs b/scripts/lib/wabt-verifier-timeouts.mjs
new file mode 100644
index 000000000..4ee3ab954
--- /dev/null
+++ b/scripts/lib/wabt-verifier-timeouts.mjs
@@ -0,0 +1,4 @@
+// A single inspection can include native admission plus several WABT commands.
+// The aggregate verifier covers seven complete fixtures and their failure paths.
+export const WABT_OPERATION_TIMEOUT_MS = 4 * 60_000;
+export const WABT_WORKFLOW_TIMEOUT_MS = 15 * 60_000;
diff --git a/scripts/verify-packaged-wasm-artifact.mjs b/scripts/verify-packaged-wasm-artifact.mjs
index d425ef924..95bdc138a 100644
--- a/scripts/verify-packaged-wasm-artifact.mjs
+++ b/scripts/verify-packaged-wasm-artifact.mjs
@@ -3,6 +3,7 @@ import { join } from "node:path";
import { mkdir } from "node:fs/promises";
import { PrivateRuntimeRoot } from "../dist/process/PrivateRuntimeRoot.js";
import { exec } from "./lib/verify-package-core.mjs";
+import { WABT_WORKFLOW_TIMEOUT_MS } from "./lib/wabt-verifier-timeouts.mjs";
import { verifyPackagePack } from "./verify-package-pack.mjs";
const root = await PrivateRuntimeRoot.create({
@@ -49,7 +50,11 @@ try {
const verified = await exec(
process.execPath,
["scripts/verify-wasm-artifact.mjs", entrypoint, "--require-tools"],
- { env: environment, timeout: 180_000, maxBuffer: 4 * 1024 * 1024 },
+ {
+ env: environment,
+ timeout: WABT_WORKFLOW_TIMEOUT_MS,
+ maxBuffer: 4 * 1024 * 1024,
+ },
);
process.stdout.write(verified.stdout);
} finally {
diff --git a/scripts/verify-wasm-artifact.mjs b/scripts/verify-wasm-artifact.mjs
index c05952118..9bc5436af 100644
--- a/scripts/verify-wasm-artifact.mjs
+++ b/scripts/verify-wasm-artifact.mjs
@@ -24,6 +24,7 @@ import {
requireMcpToolError,
} from "./lib/mcp-verifier-results.mjs";
import { createVerifierRun, completeVerifierRun } from "./lib/verifier-run.mjs";
+import { WABT_OPERATION_TIMEOUT_MS } from "./lib/wabt-verifier-timeouts.mjs";
const directory = process.env.REA_WABT_BIN_DIRECTORY;
if (!isAbsolute(directory ?? "")) {
@@ -76,6 +77,8 @@ try {
throw cause;
}
const client = new Client({ name: "wabt-artifact-verifier", version: "1" });
+const callTool = (request) =>
+ client.callTool(request, { timeout: WABT_OPERATION_TIMEOUT_MS });
const transport = new StdioClientTransport({
command: process.execPath,
args: [entrypoint, "mcp"],
@@ -128,7 +131,7 @@ try {
TMP: childTempRoot,
TEMP: childTempRoot,
},
- timeout: 120_000,
+ timeout: WABT_OPERATION_TIMEOUT_MS,
maxBuffer: 64 * 1024 * 1024,
},
)
@@ -238,7 +241,7 @@ try {
const cliValue = await inspectCli(input);
assert.equal(cliValue.category, undefined, JSON.stringify(cliValue));
const cli = parseEvidence(cliValue);
- const reply = await client.callTool({
+ const reply = await callTool({
name: "inspect_wasm_artifact",
arguments: input,
});
@@ -332,7 +335,7 @@ try {
},
);
}
- const bundleReply = await client.callTool({
+ const bundleReply = await callTool({
name: "get_evidence_bundle",
arguments: {},
});
@@ -362,7 +365,7 @@ try {
JSON.stringify(cliError),
);
const error = requireMcpToolError(
- await client.callTool({
+ await callTool({
name: "inspect_wasm_artifact",
arguments: invalidInput,
}),
@@ -370,7 +373,7 @@ try {
assert.equal(error.category, "invalid_input");
const partial = error.details.partial_observation;
assert.equal(partial.kind, "retained-evidence");
- const failedBundleReply = await client.callTool({
+ const failedBundleReply = await callTool({
name: "get_evidence_bundle",
arguments: {},
});