fix: report provider admission failures as typed codes (#8066)

* fix: report provider admission failures as typed codes

* fix(evm): keep limiter path on admission diagnostics

* fix: assert WABT and CBOR admission codes

* fix: keep admission details on returned failures

* fix(evm): detect repeated CBOR keys in the decoder

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
morlutoandCursor Agent authored and GitHub committed 2026-10-30 06:48:01 +08:00
1 parent 3b647132c6
commit 317bf3fe23
63 files changed
+1021 -432

No files matched your search

+5 -5
View File
@@ -1,3 +1,4 @@
import { ProcessAdmissionError } from "./ProcessAdmissionError.js";
import { spawn, type ChildProcess } from "node:child_process";
import type { EventEmitter } from "node:events";
import type { Readable, Writable } from "node:stream";
@@ -263,7 +264,7 @@ export const spawnOwnedProviderProcess = async (
if (sweepTokenOwnedProcesses) {
const capture = systemProcessOwnershipHost.captureBaseline;
if (capture === undefined)
throw new Error("Process ownership baseline is unavailable on this host");
throw new ProcessAdmissionError("baseline_unavailable");
captureBaseline = await capture(options.signal);
options.signal?.throwIfAborted();
}
@@ -306,9 +307,7 @@ export const spawnOwnedProviderProcess = async (
};
}
if (options.memoryLimitBytes !== undefined)
throw new Error(
"Owned process memory limits require the Windows Job Object launcher; no limit can be enforced on this host.",
);
throw new ProcessAdmissionError("memory_limit_unsupported");
const child = spawn(options.command, [...options.arguments], {
shell: false,
windowsHide: true,
@@ -320,7 +319,8 @@ export const spawnOwnedProviderProcess = async (
});
await waitForSpawn(child);
const pid = child.pid;
if (pid === undefined) throw new Error("Provider launcher has no process ID");
if (pid === undefined)
throw new ProcessAdmissionError("launcher_pid_missing");
const ownership: OwnedProcessGroup = {
runId: options.runId,
leaderPid: pid,