fix(process): classify GDB, Apktool and Java-probe launch failures through the shared launch owner (#11631)

* fix(process): classify GDB, Apktool and Java-probe launch failures through the shared launch owner

GDB session start, the Apktool version probe and the Jadx and Ghidra Java
probes read a launcher's error with launcherFailureOf and report host
capacity (EAGAIN, ENOMEM, EMFILE, ENFILE) and E2BIG through the shared
classifyLaunchFailure, keeping their own unavailable reports for refusals.
Only a launcher-raised errno counts as a launch failure, and a GDB launch
failure no longer retries the MI2 dialect. The refusal-only
classifyLaunchFailure helper is removed.

Refs #11614

* fix(process): name the environment as the E2BIG repair for fixed-argument launches

GDB, the Apktool version probe and the Jadx and Ghidra Java probes launch
fixed arguments, so selecting less input cannot shrink an oversized launch.
The shared launch report takes fixedArguments and then tells the caller to
shrink the environment REA runs with. Launch tests check structured facts
and guidance delivery instead of whole sentences.

* fix(process): report which launch input an E2BIG refusal leaves to shrink as a structured fact
This commit is contained in:
morluto authored and GitHub committed 2026-11-15 20:55:29 -05:00
1 parent 0035d8edb3
commit e5cf021ca6
13 files changed
+371 -56

No files matched your search

+30 -2
View File
@@ -1,6 +1,7 @@
import { capturedProviderOutput } from "../process/capturedProviderOutput.js";
import type { ProcessInspectionFailure } from "../process/ProcessInspectionCleanup.js";
import { classifyLaunchFailureCode } from "../process/launchFailure.js";
import { launcherFailureOf } from "../process/launchFailure.js";
import { classifyLaunchFailure } from "../process/classifyProviderOutcome.js";
import { randomUUID } from "node:crypto";
import type { RetainedResourceScope } from "../ports/AnalysisProvider.js";
import {
@@ -164,6 +165,7 @@ export const inspectJadxJava = async (
"jadx",
operation,
);
const hostConstraint = hostLaunchConstraint(command, cause);
let primary: AnalysisError;
if (observed !== undefined && !observed.ok) {
if (cleanups.length === 0) return observed;
@@ -244,6 +246,21 @@ export const inspectJadxJava = async (
cause,
...(output === undefined ? {} : { capturedOutput: output }),
});
} else if (hostConstraint !== undefined) {
// The host, not the selected Java runtime, refused this launch.
primary = classifyLaunchFailure(hostConstraint, {
providerId: "jadx",
operation,
fixedArguments: true,
command: java,
details: {
cause,
diagnostics: {
java_executable: java,
phase: "module-inspection",
},
},
});
} else {
const failure = commandProbeRefusal(
java,
@@ -273,6 +290,17 @@ export const inspectJadxJava = async (
}
};
/** A launch the host refused for capacity or argument size, not the runtime's fault. */
const hostLaunchConstraint = (
command: Pick<OwnedCommandFailure, "processError"> | undefined,
cause: unknown,
) => {
const launch = launcherFailureOf(command?.processError ?? cause);
return launch?.kind === "host-exhausted" || launch?.kind === "argument-list"
? launch
: undefined;
};
const commandProbeRefusal = (
java: string,
command:
@@ -289,7 +317,7 @@ const commandProbeRefusal = (
command?.processError ?? (cause instanceof Error ? cause : undefined);
const systemCode =
processError === undefined ? undefined : Reflect.get(processError, "code");
const missing = classifyLaunchFailureCode(systemCode)?.kind === "missing";
const missing = launcherFailureOf(processError)?.kind === "missing";
const limited = command?.reason === "output-limit";
const timedOut = command?.reason === "timeout";
return {