Skip to content
Closed
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
5 changes: 4 additions & 1 deletion packages/loopover-miner/bin/loopover-miner.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ try {
loadMinerFileSecrets();
} catch (error) {
console.error(error instanceof Error ? error.message : String(error));
process.exit(1);
// Exit 2, not 1: a broken secret mount is a real startup failure, and docs/unattended-scheduling.md's
// exit-code contract is 0 (success) / 2 (failure — "Alert on this"). Exiting 1 here would slip past an
// operator whose alerting keys strictly on exit code 2 (#6162).
process.exit(2);
}

// Opt-in Sentry (#6011): a complete no-op unless the operator sets LOOPOVER_MINER_SENTRY_DSN themselves. Must
Expand Down
5 changes: 3 additions & 2 deletions test/unit/miner-env-file-indirection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe("loadMinerFileSecrets (#5178)", () => {
expect(result.stderr).not.toContain("ghp_end_to_end_value");
});

it("fails the process fast with a clear error when GITHUB_TOKEN_FILE points at a missing file", () => {
it("fails the process fast with the documented failure exit code (2) when GITHUB_TOKEN_FILE points at a missing file (#6162)", () => {
const result = spawnSync("node", [bin, "status"], {
encoding: "utf8",
env: {
Expand All @@ -159,7 +159,8 @@ describe("loadMinerFileSecrets (#5178)", () => {
},
});

expect(result.status).toBe(1);
// Exit 2 (not 1) so it matches docs/unattended-scheduling.md's 0/2 contract and an operator's exit-code-2 alerting.
expect(result.status).toBe(2);
expect(result.stderr).toContain("GITHUB_TOKEN_FILE");
expect(result.stderr).toContain("/definitely/does/not/exist/github_token");
});
Expand Down