fix(miner): retain a crashed attempt's worktree for post-mortem - #6867
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6867 +/- ##
=======================================
Coverage 93.65% 93.65%
=======================================
Files 685 685
Lines 68247 68250 +3
Branches 18707 18707
=======================================
+ Hits 63914 63917 +3
Misses 3348 3348
Partials 985 985
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-17 09:45:48 UTC
Review summary Nits — 4 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk 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.
Full command reference: https://loopover.ai/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.
|
Closes #6759
Problem
attempt-cli.jsonly setworktreeResult.attemptOk = result.outcome === "submitted"afterrunAttemptPipelinereturned normally. When it throws, execution jumps straight to the outer catch and that line never runs, leavingattemptOkundefined. Thefinallyblock then calls:so the
?? truedefault deletes the worktree of a genuinely crashed attempt — precisely the one that most needs post-mortem inspection.shouldRetainWorktree(attemptOk)(packages/loopover-engine/src/miner/worktree-plan.ts) returns!attemptOk, and its header explicitly states a FAILED attempt's worktree is retained for inspection. The existing throw-path test exercised this route but only asserted the claim release, never whatcleanupAttemptWorktreereceived.Fix
runAttemptPipelinecall so an uncaught exception recordsattemptOk = false(retain) before rethrowing. The?? truedefault is left intact for the earlier blocked paths (rejection / worktree-prep-failure / infeasible) it was actually written for — nothing ran in those worktrees to postmortem.finally-block comment, which described only the "earlier blocked path" cases and never the exception case.Tests
test/unit/miner-attempt-cli.test.tsadds a regression test assertingcleanupAttemptWorktreeis called withattemptOk === falsewhenrunMinerAttemptthrows. It fails before the fix (the call arrived withtrue).Validation
npx vitest run test/unit/miner-attempt-cli.test.ts→ 68 passed, 70 total. The 2 failures are pre-existing on Windows only and byte-identical to the pristine baseline (2 failed | 67 passedbefore this change,2 failed | 68 passedafter) — zero net-new failures, +1 new passing test.npm run typecheck→ clean (0 errors)