Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/loopover-miner/lib/attempt-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1073,11 +1073,14 @@ export async function runAttempt(args: string[], options: RunAttemptOptions = {}
}
options.onResult?.(finalResult as AttemptCliResult);

// Terminal attempt outcome exit codes: submitted=0, abandon=7, stale=8, blocked=9, governed=10, verification_failed=12.
switch (result.outcome) {
case "submitted":
return 0;
case "abandon":
return 7;
case "verification_failed":
return 12;
case "stale":
return 8;
case "blocked":
Expand Down
3 changes: 2 additions & 1 deletion packages/loopover-miner/lib/attempt-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ import type {
import { prepareOpenPrSubmission } from "./harness-submission-trigger.js";
import { captureMinerError } from "./sentry.js";

export const ATTEMPT_OUTCOMES: readonly ["abandon", "stale", "blocked", "governed", "submitted"] = Object.freeze([
export const ATTEMPT_OUTCOMES: readonly ["abandon", "verification_failed", "stale", "blocked", "governed", "submitted"] = Object.freeze([
"abandon",
"verification_failed",
"stale",
"blocked",
"governed",
Expand Down
20 changes: 20 additions & 0 deletions test/unit/miner-attempt-cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,26 @@ describe("runAttempt (#5132)", () => {
expect(String(error.mock.calls[0]?.[0])).toContain("target_not_found");
});

it("REGRESSION (#10337): verification_failed has the dedicated exit code 12", async () => {
const { allocator, claimLedger, eventLedger, attemptLog, governorLedger } = tempLedgers();
vi.spyOn(console, "log").mockImplementation(() => undefined);

const exitCode = await runAttempt(["acme/widgets", "7", "--miner-login", "alice", "--json"], {
env: { MINER_CODING_AGENT_PROVIDER: "noop" },
openWorktreeAllocator: () => allocator,
openClaimLedger: () => claimLedger,
initEventLedger: () => eventLedger,
initAttemptLog: () => attemptLog,
initGovernorLedger: () => governorLedger,
...readyPipelineOptions({
runMinerAttempt: async () =>
({ outcome: "verification_failed", verification: { status: "failed" }, loopResult: fakeLoopResult() }) as never,
}),
});

expect(exitCode).toBe(12);
});

it("REGRESSION: an unexpected runMinerAttempt outcome falls through to exit 2", async () => {
const { allocator, claimLedger, eventLedger, attemptLog, governorLedger } = tempLedgers();
vi.spyOn(console, "log").mockImplementation(() => undefined);
Expand Down
Loading