Classify prelaunch native artifact platform failures safely

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-10 08:50:57 -05:00
1 parent f4f085b83d
commit 142fdf6847
2 files changed
+38

No files matched your search

@@ -331,6 +331,7 @@ import {
retainedNativeCleanupJournalMatches,
nativeProviderUsageLimitFromEvent,
nativeSessionFailureSourceCode,
nativeProviderRecoveryEvidence,
nativeSessionRecoveryProjection,
nativeGovernedWaitResult,
nativeConversationReplyResult,
@@ -9338,6 +9339,37 @@ describe("native session bounded recovery", () => {
).toBe("native_current_wake_comments_changed_after_read");
});
it.each([
[{}, [], "bootstrap_retry"],
[{ uncertain: true }, [], "ambiguous_state"],
[{}, [{ eventType: "turn.started" }], "ambiguous_state"],
])("classifies a platform mismatch without weakening persisted recovery evidence", async (checkpoint, events, mode) => {
const code = nativeSessionFailureSourceCode(
new Error("runner_remote_artifact_platform_mismatch: configure the remote binary"),
);
expect(code).toBe("runner_remote_artifact_platform_mismatch");
expect(nativeSessionFailureDisposition(1, new Date(), code)).toMatchObject({
phase: "terminal_failure",
failureCode: code,
nextAttemptAt: null,
});
let reads = 0;
const db = {
select: () => ({
from: () => ({
where: () => ({
limit: async () => ++reads === 1
? [{ runnerProfileJson: { sessionCheckpoint: checkpoint } }]
: events,
}),
}),
}),
};
expect(await nativeProviderRecoveryEvidence({
db: db as never, runId: "run", sourceFailureCode: code,
})).toMatchObject({ recoveryMode: mode });
});
it("requires operator action without retrying an approval-required terminal", () => {
const code = nativeSessionFailureSourceCode(
new NativeProviderTerminalFailure("approval_required", false, "Approval required"),
@@ -6243,6 +6243,7 @@ export function nativeSessionFailureDisposition(
sourceFailureCode === "native_provider_approval_required" ||
sourceFailureCode === "native_event_replay_conflict" ||
sourceFailureCode === "runner_remote_provider_artifact_incompatible" ||
sourceFailureCode === "runner_remote_artifact_platform_mismatch" ||
sourceFailureCode === "native_provider_terminal_failed" ||
sourceFailureCode === "native_current_wake_comments_unread" ||
sourceFailureCode === "native_current_wake_comments_changed_after_read" ||
@@ -6299,6 +6300,7 @@ export function nativeSessionFailureSourceCode(
| "native_session_cleanup_quarantined"
| "native_adopted_runner_authentication_timeout"
| "runner_remote_provider_artifact_incompatible"
| "runner_remote_artifact_platform_mismatch"
| "provider_process_exited"
| "provider_stdout_closed"
| "provider_process_output_closed"
@@ -6339,6 +6341,9 @@ export function nativeSessionFailureSourceCode(
if (/native_adopted_runner_authentication_timeout/i.test(message)) {
return "native_adopted_runner_authentication_timeout";
}
if (/^runner_remote_artifact_platform_mismatch(?::|$)/.test(message)) {
return "runner_remote_artifact_platform_mismatch";
}
if (/runner_remote_provider_artifact_incompatible/i.test(message)) {
return "runner_remote_provider_artifact_incompatible";
}
@@ -6466,6 +6471,7 @@ export async function nativeProviderRecoveryEvidence(input: {
ReturnType<typeof nativeSessionFailureSourceCode>
>([
"runner_remote_provider_artifact_incompatible",
"runner_remote_artifact_platform_mismatch",
"provider_process_exited",
"provider_stdout_closed",
"provider_process_output_closed",