Skip to content

fix(miner): exit 2 (not 1) on a secret-mount failure to match the documented 0/2 exit-code contract#6249

Closed
real-venus wants to merge 1 commit into
JSONbored:mainfrom
real-venus:fix/miner-bin-secret-mount-exit-code
Closed

fix(miner): exit 2 (not 1) on a secret-mount failure to match the documented 0/2 exit-code contract#6249
real-venus wants to merge 1 commit into
JSONbored:mainfrom
real-venus:fix/miner-bin-secret-mount-exit-code

Conversation

@real-venus

Copy link
Copy Markdown
Contributor

Summary

bin/loopover-miner.js's loadMinerFileSecrets() catch block exited with code 1 on failure, but docs/unattended-scheduling.md's documented exit-code contract is 0 (success) / 2 (failure -- "Alert on this"). An operator wiring alerting strictly to exit code 2 would miss a real, reachable startup failure -- a broken GITHUB_TOKEN_FILE (or any secret-mount) misconfiguration.

Changes

  • bin/loopover-miner.js: the secret-mount-failure catch now process.exit(2) (was 1), matching the documented contract.
  • This is the only literal exit(1) startup path in the file (all other exits are 0, a command's own return code, or exitCode), so no other path needed the same fix.
  • lib/env-file-indirection.js's loadMinerFileSecrets throw behavior is unchanged -- only the exit-code translation at the CLI boundary.

Validation

  • node --check bin/loopover-miner.js; npm run typecheck.
  • Updated the existing CLI regression test (test/unit/miner-env-file-indirection.test.ts) that spawns the real bin with a missing GITHUB_TOKEN_FILE to assert exit code 2 (was 1) -- 13 passed.
  • git diff --check clean; rebased onto latest main, mergeable-clean.

Safety

  • No secrets/private terms. The failing path already redacts the secret value; only the exit code changed.

Closes #6162

@real-venus real-venus requested a review from JSONbored as a code owner July 15, 2026 23:35
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.35%. Comparing base (d64f887) to head (9ad886e).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6249   +/-   ##
=======================================
  Coverage   95.35%   95.35%           
=======================================
  Files         598      598           
  Lines       47121    47121           
  Branches    14993    14993           
=======================================
  Hits        44932    44932           
  Misses       1464     1464           
  Partials      725      725           
Flag Coverage Δ
shard-1 43.97% <ø> (-0.08%) ⬇️
shard-2 36.77% <ø> (+0.19%) ⬆️
shard-3 32.22% <ø> (+<0.01%) ⬆️
shard-4 34.12% <ø> (-0.29%) ⬇️
shard-5 31.82% <ø> (+0.22%) ⬆️
shard-6 45.23% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 15, 2026
@loopover-orb

loopover-orb Bot commented Jul 15, 2026

Copy link
Copy Markdown

Caution

🛑 LoopOver review result - reject/close recommended

Review updated: 2026-07-15 23:55:30 UTC

2 files · 1 AI reviewer · 1 blocker · CI green · clean

🛑 Suggested Action - Reject/Close

Review summary
This is a small, well-targeted fix: the secret-mount-load catch block now exits with code 2 instead of 1, matching the documented 0/2 exit-code contract in docs/unattended-scheduling.md, and the corresponding CLI regression test is updated to assert exit code 2. The change is narrow, correctly scoped to the single literal exit(1) path described in the PR, and the accompanying test change directly exercises the real bin via spawnSync against the actual failure path (missing GITHUB_TOKEN_FILE), so it's a genuine (not fabricated) regression test.

Nits — 4 non-blocking
  • The inline comment in bin/loopover-miner.js is fairly long for a one-line exit-code change; could be trimmed since the PR description already explains the rationale in full.
  • Consider a quick grep across the repo for other operator-facing docs or scripts that might assume exit code 1 on miner startup failure, to make sure no other tooling silently breaks.
  • Pull request duplicates other open work — Check for an existing pull request or issue covering this change and coordinate or consolidate before continuing.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.

Why this is blocked

  • Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.

Decision drivers

  • ❌ Code review — 1 blocker (1 reviewer)
  • ❌ Gate result — Blocking (Repo-configured hard blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #6162
Related work ⚠️ Same linked issue: #6248 Another open PR references the same linked issue.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 139 registered-repo PR(s), 75 merged, 21 issue(s).
Contributor context ✅ Confirmed Gittensor contributor real-venus; Gittensor profile; 139 PR(s), 21 issue(s).
Improvement ✅ Minor risk: low · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The diff changes the secret-mount-failure catch to process.exit(2) matching the documented 0/2 contract, updates the existing CLI test to assert exit code 2, and leaves env-file-indirection.js untouched as required; the PR also explains it checked for other exit(1) paths in the file and found none.

Review context
Contributor next steps
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://gittensory.aethereal.dev/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb

loopover-orb Bot commented Jul 15, 2026

Copy link
Copy Markdown

LoopOver is closing this pull request on the maintainer's behalf (Linked issue overlaps another open PR; duplicate of another open PR). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(miner): bin/loopover-miner.js exits 1 on a secret-mount failure, outside the documented 0/2 exit-code contract

1 participant