Skip to content

fix(miner): add blocked_own_open_pr to the AttemptCliResult union (#9331) - #9384

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-attemptcli-blocked-own-open-pr-9331
Jul 27, 2026
Merged

fix(miner): add blocked_own_open_pr to the AttemptCliResult union (#9331)#9384
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-attemptcli-blocked-own-open-pr-9331

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Problem

Closes #9331.

runAttempt in packages/loopover-miner/lib/attempt-cli.ts builds a blocked_own_open_pr result object (the #8808 crash-retry idempotency guard) and casts it to AttemptCliResult, but the exported AttemptCliResult union had no blocked_own_open_pr member. Since loop-cli.ts re-exposes AttemptCliResult["outcome"], this is real .d.ts drift.

Fix

Add a blocked_own_open_pr member with the exact field shape of the real duplicateResult object: CommonAttemptResultFields (already covering repoFullName, issueNumber, minerLogin, base, mode, attemptId) plus reason: string and existingPullRequestNumber: number.

The as AttemptCliResult cast at the call site is kept — verified via tsc: the const duplicateResult = { outcome: "blocked_own_open_pr", … } object literal widens outcome to string, which is not assignable without the cast. This is the uniform pattern at every sibling result site, including in-union outcomes like dry_run.

Test

Adds a compile-time guard in test/unit/miner-attempt-cli.test.ts: an AttemptCliResult value with the exact blocked_own_open_pr shape is assignable without a cast, so removing the union member makes it a type error and the drift can't silently return.

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 27, 2026 15:29
@superagent-security

Copy link
Copy Markdown
Contributor

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

runAttempt builds and casts a blocked_own_open_pr result (the JSONbored#8808
idempotency guard) but AttemptCliResult's union had no matching member, so
loop-cli.ts's re-exported AttemptCliResult["outcome"] drifted from the real
runtime outcome. Add the member with duplicateResult's exact shape
(CommonAttemptResultFields + reason + existingPullRequestNumber). The
as-AttemptCliResult cast stays: tsc confirms it is still required because the
object literal's outcome widens to string, identical to every sibling result
cast site (including in-union outcomes like dry_run).

Adds a compile-time guard test asserting the outcome is assignable without a
cast, so the .d.ts drift cannot silently return.
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.50%. Comparing base (83b6867) to head (cddc847).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9384      +/-   ##
==========================================
+ Coverage   75.38%   75.50%   +0.12%     
==========================================
  Files         275      276       +1     
  Lines       58023    58314     +291     
  Branches     6181     6278      +97     
==========================================
+ Hits        43739    44030     +291     
  Misses      14014    14014              
  Partials      270      270              
Flag Coverage Δ
backend 100.00% <ø> (?)

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

Files with missing lines Coverage Δ
packages/loopover-miner/lib/attempt-cli.ts 100.00% <ø> (ø)

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

loopover-orb Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-27 15:35:38 UTC

2 files · 1 AI reviewer · no blockers · readiness 95/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This is a narrow, correct type-drift fix: it adds the missing `blocked_own_open_pr` member to the `AttemptCliResult` union with the exact field shape (`CommonAttemptResultFields` + `reason: string` + `existingPullRequestNumber: number`) that the runtime `duplicateResult` object in `runAttempt` already builds and casts. The added compile-time test correctly demonstrates the fix works by assigning the exact shape without a cast, and would fail to compile if the union member were removed, which is a legitimate regression guard for `.d.ts` drift rather than a fabricated runtime test. The change is minimal, self-contained, and directly closes the linked issue #9331.

Nits — 3 non-blocking
  • The PR description says this closes ams: attempt-cli's blocked_own_open_pr outcome is missing from the exported AttemptCliResult type #9331, but I can't independently verify the referenced issue's exact scope from the diff alone — worth double-checking the issue text matches this narrow union-drift fix and isn't asking for something broader.
  • test/unit/miner-attempt-cli.test.ts:143-165 — the new describe block is a pure type-level assertion; consider a one-line comment noting it has zero runtime assertions purpose beyond `expect(result.outcome)` (already present) so future readers don't mistake it for behavioral coverage of `runAttempt` itself.
  • Consider verifying the other blocked_* variants (e.g. `blocked_max_concurrent_claims` and `blocked_worktree_preparation_failed`) referenced elsewhere in the file don't have similar undocumented drift, since `attempt-cli.ts`'s own comments call out `blocked_max_concurrent_claims` as omitted from the union — that might be a good follow-up issue rather than in scope here.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #9331
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low 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: 270 registered-repo PR(s), 115 merged, 37 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 270 PR(s), 37 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Partially addressed
The PR adds a `blocked_own_open_pr` union member matching the duplicateResult shape and adds a compile-time test guard, satisfying the first deliverable, but explicitly keeps the `as AttemptCliResult` cast at the call site rather than removing it as the issue requires once the type is corrected.

Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, Ruby, TypeScript, Svelte, Cuda, JavaScript, Markdown, MDX
  • Official Gittensor activity: 270 PR(s), 37 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
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://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.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

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.

ams: attempt-cli's blocked_own_open_pr outcome is missing from the exported AttemptCliResult type

1 participant