Skip to content

fix(miner): bound the AMS export POST with a request timeout (#7237) - #7267

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
xfodev:fix/orb-export-fetch-timeout-7237
Jul 19, 2026
Merged

fix(miner): bound the AMS export POST with a request timeout (#7237)#7267
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
xfodev:fix/orb-export-fetch-timeout-7237

Conversation

@xfodev

@xfodev xfodev commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

orb-export.js's sendAmsExportBatch POSTed the anonymized telemetry batch to the AMS collector with no
request timeout
— a hung or black-holed collector could stall the export indefinitely (and, since the
export runs inside the miner loop, back-pressure it).

This bounds the single request with signal: AbortSignal.timeout(timeoutMs), added to the existing fetchFn
init object without touching method/headers/body. timeoutMs is a new option defaulting to a new
exported DEFAULT_ORB_EXPORT_TIMEOUT_MS (10_000 — matching this package's other default request timeouts in
live-issue-snapshot.js/opportunity-fanout.js), so every real invocation is bounded automatically without
runOrbExportCli passing anything. A timeout surfaces as a thrown AbortError/TimeoutError that the
existing catch already turns into { sent: 0, error } — no new catch branch, and no retry logic added.

Closes #7237

Scope

  • Conventional Commit title; focused (one module + its .d.ts + its test); no site//CNAME/lovable; no new dependency.
  • Linked a currently open issue (Closes #7237).

Validation

  • git diff --check
  • npm run typecheck (root — clean; .d.ts updated with the new export + timeoutMs option)
  • npm run test:coverage100% of the changed lines + branches covered. New regressions: the request
    init carries an AbortSignal (default and explicit timeoutMs), DEFAULT_ORB_EXPORT_TIMEOUT_MS === 10_000,
    and an aborted (timed-out) request is caught into { sent: 0, error } without throwing. Existing tests pass unchanged.
  • npm run build:miner (node --check passes).

If any required check was skipped, explain why:

  • Backend change confined to packages/loopover-miner/lib/**; CI runs the full suite.

Safety

  • No secrets, wallets, hotkeys, coldkeys, PATs, trust scores, or private data exposed.
  • Public GitHub text stays sanitized and low-noise.
  • No auth/CORS/session/API/OpenAPI/MCP surface change — bounds an existing outbound request only; success-path payload is byte-identical.
  • No UI change — no UI Evidence needed.

@xfodev
xfodev requested a review from JSONbored as a code owner July 19, 2026 11:25
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.81%. Comparing base (c0b4185) to head (2565c33).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7267   +/-   ##
=======================================
  Coverage   93.81%   93.81%           
=======================================
  Files         704      704           
  Lines       69454    69455    +1     
  Branches    18897    18897           
=======================================
+ Hits        65158    65159    +1     
  Misses       3302     3302           
  Partials      994      994           
Flag Coverage Δ
shard-1 43.21% <0.00%> (-0.41%) ⬇️
shard-2 37.35% <0.00%> (+0.12%) ⬆️
shard-3 32.97% <100.00%> (-0.13%) ⬇️
shard-4 32.73% <0.00%> (-1.60%) ⬇️
shard-5 32.78% <0.00%> (+0.59%) ⬆️
shard-6 46.05% <100.00%> (+0.27%) ⬆️

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

Files with missing lines Coverage Δ
packages/loopover-miner/lib/orb-export.js 98.48% <100.00%> (+0.01%) ⬆️

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

loopover-orb Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-19 11:34:23 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This adds a 10s AbortSignal.timeout to the AMS export POST in sendAmsExportBatch, exposing timeoutMs as an option with a new exported DEFAULT_ORB_EXPORT_TIMEOUT_MS default, and relies on the existing catch to turn an abort into {sent:0, error}. The change is minimal, correctly scoped, doesn't touch method/headers/body, and is consistent with this package's existing default-timeout pattern (e.g. discovery-index-client.js's DEFAULT_REQUEST_TIMEOUT_MS = 10_000). Tests cover both the default and explicit timeoutMs paths and the abort-caught-without-throwing case, and the .d.ts is updated in lockstep.

Nits — 3 non-blocking
  • orb-export.js doesn't use the shared fetchWithRetry/timeout helper from http-retry.js that discovery-index-client.js uses — worth a comment or follow-up noting why this module inlines AbortSignal.timeout instead of reusing that helper, for consistency.
  • The new test 'catches an aborted (timed-out) request' only checks `error.toContain('aborted')`, which is coupled to the exact DOMException message text rather than asserting on error type/name — a slightly more robust check might assert on `TimeoutError`/`AbortError` name instead.
  • Consider extracting the AbortSignal.timeout + fetch pattern into a tiny shared helper alongside http-retry.js if more modules end up needing a bare (non-retrying) timeout, to avoid three slightly different reimplementations across the package.

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 #7237
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: 19 registered-repo PR(s), 9 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor xfodev; Gittensor profile; 19 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The diff adds signal: AbortSignal.timeout(timeoutMs) to the fetchFn init object, introduces the exported DEFAULT_ORB_EXPORT_TIMEOUT_MS constant defaulting to 10_000, updates the .d.ts, and adds regression tests confirming the AbortSignal is passed and that a rejected/aborted fetch is caught into {sent:0, error} without a new catch branch or retry logic, matching all stated requirements.

Review context
  • Author: xfodev
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: JavaScript, TypeScript
  • Official Gittensor activity: 19 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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.

@loopover-orb
loopover-orb Bot merged commit a783cc1 into JSONbored:main Jul 19, 2026
16 checks passed
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): orb-export.js's sendAmsExportBatch fetch has no AbortSignal.timeout

1 participant