fix(miner): retry transient live-state fetch in checkSubmissionFreshness before failing closed#7129
Conversation
…ess before failing closed checkSubmissionFreshness called fetchLiveIssueSnapshot exactly once and treated any failed/null result as live_state_unavailable, aborting the whole candidate right before open_pr on a single transient blip (a brief 5xx or GraphQL-index propagation lag). Its sibling caller of the same fetch, claim-conflict-resolver.js's resolveClaimConflict (JSONbored#6058), already rides out exactly this window with a bounded retry-with-backoff. Wrap the pre-submission fetch in the same bounded retry: optional maxAttempts (default 3, matching DEFAULT_SNAPSHOT_MAX_ATTEMPTS), an injectable sleepFn, and an injectable backoffMs defaulting to http-retry.js's shared defaultRetryBackoffMs. The loop stops the instant a real, well-formed snapshot is obtained and never retries a snapshot's own staleness signals. Once the budget is exhausted with no usable snapshot it fails closed exactly as before (live_state_unavailable, fresh: false), logging the abort event once. The new options are optional, so every existing caller is unchanged. Closes JSONbored#7089
|
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 #7129 +/- ##
===========================================
+ Coverage 49.19% 93.75% +44.56%
===========================================
Files 692 692
Lines 68818 68829 +11
Branches 18781 18781
===========================================
+ Hits 33852 64532 +30680
+ Misses 32463 3302 -29161
+ Partials 2503 995 -1508
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 23:03:40 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
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.
|
fix(miner): retry transient live-state fetch in checkSubmissionFreshness before failing closed
checkSubmissionFreshness called fetchLiveIssueSnapshot exactly once and treated
any failed/null result as live_state_unavailable, aborting the whole candidate
right before open_pr on a single transient blip (a brief 5xx or GraphQL-index
propagation lag). Its sibling caller of the same fetch, claim-conflict-resolver.js's
resolveClaimConflict (#6058), already rides out exactly this window with a bounded
retry-with-backoff.
Wrap the pre-submission fetch in the same bounded retry: optional maxAttempts
(default 3, matching DEFAULT_SNAPSHOT_MAX_ATTEMPTS), an injectable sleepFn, and an
injectable backoffMs defaulting to http-retry.js's shared defaultRetryBackoffMs. The
loop stops the instant a real, well-formed snapshot is obtained and never retries a
snapshot's own staleness signals. Once the budget is exhausted with no usable
snapshot it fails closed exactly as before (live_state_unavailable, fresh: false),
logging the abort event once. The new options are optional, so every existing caller
is unchanged.
Closes #7089