Skip to content

fix(selfhost): bound every Qdrant REST call with an AbortSignal timeout - #7106

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
shin-core:fix/qdrant-vectorize-fetch-timeout-7072
Jul 17, 2026
Merged

fix(selfhost): bound every Qdrant REST call with an AbortSignal timeout#7106
JSONbored merged 1 commit into
JSONbored:mainfrom
shin-core:fix/qdrant-vectorize-fetch-timeout-7072

Conversation

@shin-core

Copy link
Copy Markdown
Contributor

What

src/selfhost/qdrant-vectorize.ts is a self-host Vectorize adapter backed by an operator's own Qdrant REST API. All 5 of its fetch() calls — initQdrantCollection's PUT + GET, and upsert/query/deleteByIds — had no AbortSignal.timeout. This is a Node.js adapter with no platform-level subrequest ceiling (unlike the Workers runtime), so an unresponsive or network-partitioned Qdrant instance could hang these calls indefinitely in the review/RAG pipeline. Every other self-host external-fetch adapter (ai.ts, review/**) already uses a bounded AbortSignal.timeout.

How

Add one module-scoped QDRANT_FETCH_TIMEOUT_MS (15s, matching the siblings' order of magnitude) and pass AbortSignal.timeout(QDRANT_FETCH_TIMEOUT_MS) to all 5 calls. Behavior on timeout is unchanged and correct by construction:

  • upsert/deleteByIds/initQdrantCollection already throw on a non-ok/rejected fetch — an AbortSignal rejection propagates out of await fetch(...), firing those existing throw paths.
  • query's existing try/catch already degrades to { matches: [] } on any thrown error, so a timeout there degrades gracefully exactly like any other network failure.

No new catch/throw logic — just the added signal.

Validation

Tests added to the existing selfhost-qdrant-vectorize.test.ts: every Qdrant fetch across all 5 call sites (init PUT + GET, upsert, query, deleteByIds) is asserted to carry an AbortSignal. Confirmed they fail against the unfixed code and pass with the fix. typecheck clean; the adapter suite passes.

Closes #7072

qdrant-vectorize.ts's 5 fetch() calls (initQdrantCollection's PUT + GET,
and upsert/query/deleteByIds) had no AbortSignal.timeout. This is a
self-host Node.js adapter with no platform-level subrequest ceiling, so an
unresponsive or partitioned Qdrant instance could hang these calls
indefinitely in the review/RAG pipeline -- unlike every other self-host
external-fetch adapter (ai.ts, review/**), which bound their fetches.

Add a shared QDRANT_FETCH_TIMEOUT_MS (15s) and pass
AbortSignal.timeout(...) to all 5 calls. The existing throw paths and
query's { matches: [] } degradation already handle a rejected fetch, so a
timeout surfaces exactly as any other network failure -- no new logic.

Closes JSONbored#7072
@shin-core
shin-core requested a review from JSONbored as a code owner July 17, 2026 21:34
@superagent-security superagent-security Bot added the contributor:flagged Contributor flagged for review by trust analysis. label Jul 17, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

🚨 Contributor flagged. Click here for more info: Superagent Dashboard

@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.75%. Comparing base (1b42787) to head (c97e567).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7106   +/-   ##
=======================================
  Coverage   93.75%   93.75%           
=======================================
  Files         692      692           
  Lines       68808    68809    +1     
  Branches    18781    18781           
=======================================
+ Hits        64511    64512    +1     
  Misses       3302     3302           
  Partials      995      995           
Flag Coverage Δ
shard-1 43.38% <50.00%> (-0.41%) ⬇️
shard-2 36.85% <0.00%> (+0.01%) ⬆️
shard-3 33.14% <0.00%> (+<0.01%) ⬆️
shard-4 34.39% <0.00%> (-0.09%) ⬇️
shard-5 31.74% <0.00%> (-0.55%) ⬇️
shard-6 46.04% <100.00%> (+0.27%) ⬆️

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

Files with missing lines Coverage Δ
src/selfhost/qdrant-vectorize.ts 100.00% <100.00%> (ø)

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

loopover-orb Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-17 23:09:48 UTC

2 files · 1 AI reviewer · no blockers · CI green · unstable

⏸️ Suggested Action - Manual Review

Review summary
This is a clean, narrow fix that adds a 15s AbortSignal.timeout to all 5 Qdrant REST fetch calls in the self-host Vectorize adapter, matching the timeout convention already used by sibling adapters (ai.ts, oauth-device-flow.ts). Behavior on timeout is correctly traced: init/upsert/deleteByIds already throw on a rejected fetch, and query's existing try/catch already degrades to empty matches, so no new error-handling logic was needed. Tests directly assert an AbortSignal is present on every one of the 5 call sites, including both branches of initQdrantCollection (fresh create vs 409-then-GET), which is real coverage of the added lines.

Nits — 4 non-blocking
  • The timeout constant (15_000) is not configurable via env var the way QDRANT_DIM is, so operators with a slow self-host Qdrant instance have no way to raise it without a code change.
  • The three-line comment above QDRANT_FETCH_TIMEOUT_MS in qdrant-vectorize.ts:31-34 is longer than needed given the PR description already explains the rationale; a one-liner referencing the sibling convention would suffice.
  • Consider sourcing QDRANT_FETCH_TIMEOUT_MS from an env var (e.g. QDRANT_TIMEOUT_MS) with the current 15_000 as default, consistent with how QDRANT_DIM is already externalized.
  • No blocking changes needed — this is ready to merge as-is if brevity is preferred over configurability.
Flagged checks (non-blocking)
  • Contributor trust — Contributor flagged for review

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 #7072
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: 61 registered-repo PR(s), 37 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor shin-core; Gittensor profile; 61 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Review context
  • Author: shin-core
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 61 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.

@JSONbored
JSONbored merged commit cb67c64 into JSONbored:main Jul 17, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:flagged Contributor flagged for review by trust analysis. gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

qdrant-vectorize.ts's 5 Qdrant REST calls have no AbortSignal.timeout, unlike every other self-host external-fetch adapter

2 participants