Revert "ci(runner): classify ACPX admission stages"

This reverts commit ae25fd4466.
This commit is contained in:
Dotta committed 2026-09-02 23:59:34 -05:00
1 parent 3445a26a04
commit cd5b353b52
3 files changed
+26 -110

No files matched your search

@@ -677,15 +677,6 @@ fn response_error_classification(error: &ResponseError) -> &'static str {
"ACPX_MODEL_STATUS_UNAVAILABLE" => return "model_status_unavailable",
"ACPX_MODEL_SELECTION_UNAVAILABLE" => return "model_selection_unavailable",
"ACPX_EFFECTIVE_MODEL_MISMATCH" => return "effective_model_mismatch",
"PAPERCLIP_ACPX_ADMISSION_RECOVERY_BINDING" => return "admission_recovery_binding",
"PAPERCLIP_ACPX_ADMISSION_INSTALLATION" => return "admission_installation",
"PAPERCLIP_ACPX_ADMISSION_SANDBOX" => return "admission_sandbox",
"PAPERCLIP_ACPX_ADMISSION_CREDENTIAL" => return "admission_credential",
"PAPERCLIP_ACPX_ADMISSION_PROVIDER_LIFETIME" => return "admission_provider_lifetime",
"PAPERCLIP_ACPX_ADMISSION_COMMAND" => return "admission_command",
"PAPERCLIP_ACPX_ADMISSION_TOOL_BRIDGE" => return "admission_tool_bridge",
"PAPERCLIP_ACPX_ADMISSION_RUNTIME" => return "admission_runtime",
"PAPERCLIP_ACPX_ADMISSION_VERIFICATION" => return "admission_verification",
_ => {}
}
match error.message.as_str() {
@@ -37,7 +37,6 @@ export function acpxBootstrapBlockedError(
export function acpxSidecarErrorCode(error: Error): string {
const pending: Error[] = [error];
const observed = new Set<Error>();
let admissionStageCode: string | null = null;
while (pending.length > 0 && observed.size < 16) {
const current = pending.shift()!;
if (observed.has(current)) continue;
@@ -46,9 +45,6 @@ export function acpxSidecarErrorCode(error: Error): string {
if (code !== null) return code;
const details = current as Error & Record<string, unknown>;
admissionStageCode ??= acpxAdmissionStageCode(
details.paperclipAcpxAdmissionStage,
);
if (current instanceof AggregateError) {
for (const nested of current.errors) {
if (nested instanceof Error) pending.push(nested);
@@ -56,14 +52,7 @@ export function acpxSidecarErrorCode(error: Error): string {
}
if (details.cause instanceof Error) pending.push(details.cause);
}
return admissionStageCode ?? "acpx_sidecar_command_failed";
}
function acpxAdmissionStageCode(value: unknown): string | null {
if (typeof value !== "string" || !ACPX_ADMISSION_STAGES.has(value)) {
return null;
}
return `PAPERCLIP_ACPX_ADMISSION_${value.toUpperCase()}`;
return "acpx_sidecar_command_failed";
}
function directAcpxSidecarErrorCode(error: Error): string | null {
@@ -172,18 +161,6 @@ const GENERIC_ACPX_OUTPUT_CODES = new Set([
"USAGE",
]);
const ACPX_ADMISSION_STAGES = new Set([
"recovery_binding",
"installation",
"sandbox",
"credential",
"provider_lifetime",
"command",
"tool_bridge",
"runtime",
"verification",
]);
const STABLE_ACPX_SIDECAR_CODES = new Set([
"ACP_MODEL_UNSUPPORTED",
"ACP_SESSION_INIT_FAILED",
@@ -223,14 +200,5 @@ const STABLE_ACPX_SIDECAR_CODES = new Set([
"DIAGNOSTIC_ACPX_GUARDIAN_OWNERSHIP_TIMEOUT",
"DIAGNOSTIC_ACPX_GUARDIAN_START_FAILED",
"DIAGNOSTIC_ACPX_PROVIDER_EXIT_PROOF_MISSING",
"PAPERCLIP_ACPX_ADMISSION_RECOVERY_BINDING",
"PAPERCLIP_ACPX_ADMISSION_INSTALLATION",
"PAPERCLIP_ACPX_ADMISSION_SANDBOX",
"PAPERCLIP_ACPX_ADMISSION_CREDENTIAL",
"PAPERCLIP_ACPX_ADMISSION_PROVIDER_LIFETIME",
"PAPERCLIP_ACPX_ADMISSION_COMMAND",
"PAPERCLIP_ACPX_ADMISSION_TOOL_BRIDGE",
"PAPERCLIP_ACPX_ADMISSION_RUNTIME",
"PAPERCLIP_ACPX_ADMISSION_VERIFICATION",
...GENERIC_ACPX_OUTPUT_CODES,
]);
@@ -249,18 +249,15 @@ export class AcpxRuntimeHost {
);
}
const profile = resolveQualifiedAcpxProfile(options.agent, options.model);
const binding = await runAbortableAdmissionStage(
options.signal,
() =>
createAcpxRecoveryBinding({
runtimeDirectory: options.runtimeDirectory,
normalizedSessionId: options.normalizedSessionId,
workingDirectory: options.workingDirectory,
profile,
requestedModel: options.model,
permissionMode: options.permissionMode,
}),
"recovery_binding",
const binding = await runAbortableAdmissionStage(options.signal, () =>
createAcpxRecoveryBinding({
runtimeDirectory: options.runtimeDirectory,
normalizedSessionId: options.normalizedSessionId,
workingDirectory: options.workingDirectory,
profile,
requestedModel: options.model,
permissionMode: options.permissionMode,
}),
);
if (options.expectedIdentity) {
verifyExpectedAcpxIdentity(options.expectedIdentity, binding, null);
@@ -275,13 +272,10 @@ export class AcpxRuntimeHost {
);
}
const installation = await runAbortableAdmissionStage(
options.signal,
() =>
(dependencies.verifyInstallation ?? verifyQualifiedAcpxInstallation)(
profile,
),
"installation",
const installation = await runAbortableAdmissionStage(options.signal, () =>
(dependencies.verifyInstallation ?? verifyQualifiedAcpxInstallation)(
profile,
),
);
if (installation.commandDigest !== profile.commandDigest) {
throw new Error("Verified ACPX installation does not match its profile");
@@ -328,15 +322,12 @@ export class AcpxRuntimeHost {
retainRuntimeHostCleanup(ownedCleanup);
};
try {
const sandbox = await runAbortableAdmissionStage(
options.signal,
() =>
prepareAcpxRuntimeSandbox({
binding,
agent: options.agent,
environment: options.environment,
}),
"sandbox",
const sandbox = await runAbortableAdmissionStage(options.signal, () =>
prepareAcpxRuntimeSandbox({
binding,
agent: options.agent,
environment: options.environment,
}),
);
if (options.agent === "codex") {
credential = await acquireAbortableAdmissionResource({
@@ -452,7 +443,6 @@ export class AcpxRuntimeHost {
profile,
admissionVerificationTimeoutMs,
),
"verification",
);
const observedIdentity: AcpxExpectedSessionIdentity = {
kind: "acpx",
@@ -639,16 +629,11 @@ export class AcpxRuntimeHost {
async function runAbortableAdmissionStage<T>(
signal: AbortSignal | undefined,
operation: () => Promise<T>,
stage: string,
): Promise<T> {
try {
if (signal === undefined) return await operation();
signal.throwIfAborted();
const pending = Promise.resolve().then(operation);
return await raceAdmissionWithAbort(pending, signal);
} catch (error) {
throw attachAcpxAdmissionStage(error, stage);
}
if (signal === undefined) return await operation();
signal.throwIfAborted();
const pending = Promise.resolve().then(operation);
return await raceAdmissionWithAbort(pending, signal);
}
async function acquireAbortableAdmissionResource<T>(input: {
@@ -659,13 +644,7 @@ async function acquireAbortableAdmissionResource<T>(input: {
onAbortedPending?: (pending: Promise<T>) => void;
reportFailure: (failure: AcpxRetainedCleanupFailure) => void;
}): Promise<T> {
if (input.signal === undefined) {
try {
return await input.acquire();
} catch (error) {
throw attachAcpxAdmissionStage(error, input.resource);
}
}
if (input.signal === undefined) return await input.acquire();
input.signal.throwIfAborted();
const pending = Promise.resolve().then(input.acquire);
try {
@@ -687,29 +666,7 @@ async function acquireAbortableAdmissionResource<T>(input: {
);
}
}
throw attachAcpxAdmissionStage(error, input.resource);
}
}
function attachAcpxAdmissionStage(error: unknown, stage: string): Error {
const normalized =
error instanceof Error
? error
: new Error("ACPX admission rejected a non-error");
try {
Object.defineProperty(normalized, "paperclipAcpxAdmissionStage", {
configurable: true,
enumerable: false,
value: stage,
});
return normalized;
} catch {
return Object.assign(
new Error("ACPX admission stage failed", { cause: normalized }),
{
paperclipAcpxAdmissionStage: stage,
},
);
throw error;
}
}