Skip to content

fix(adapter-ticktick): authenticate against a key-protected Qdrant - #22

Merged
renezander030 merged 1 commit into
mainfrom
fix/qdrant-api-key
Aug 20, 2026
Merged

fix(adapter-ticktick): authenticate against a key-protected Qdrant#22
renezander030 merged 1 commit into
mainfrom
fix/qdrant-api-key

Conversation

@renezander030

Copy link
Copy Markdown
Owner

What

httpJson now sends an api-key header when QDRANT_API_KEY is set, and checkHealth() tells an auth refusal apart from an unreachable service.

Why

A Qdrant started with QDRANT__SERVICE__API_KEY answers 401 on every path except /. The adapter sent no credential, so checkHealth() hit its catch-all and reported "Qdrant not reachable at http://localhost:6333" — for a service that was up and simply refusing the request.

That misdiagnosis is the expensive part. ats doctor said "not reachable", which sends you hunting ports, containers and firewall rules while the fix is one environment variable. Meanwhile retrieval silently degraded to keyword-only: every query still returned results, just worse ones, with no error anywhere.

Notes

  • The header is scoped with url.startsWith(QDRANT_URL) deliberately — the same helper also calls Ollama, which must never receive the key.
  • No default is invented: with QDRANT_API_KEY unset the behaviour is byte-for-byte what it was.
  • deploy/README.md documents the variable alongside the existing Qdrant/Ollama entries.

Tests

Three cases in packages/adapter-ticktick/test/qdrant-auth.test.js: the key reaches Qdrant, it does not leak to Ollama, and a genuine connection failure still reports as unreachable.

npm run lint, check:pii, check:claims clean · test:fast 299/299.

Release

Versions are untouched — packages here move in lockstep (0.7.1 → 0.8.0 → 0.8.1 → 0.9.0 → 0.10.0), so the bump belongs to a deliberate release, not this PR.

A Qdrant started with QDRANT__SERVICE__API_KEY answers 401 on every path
except '/'. The adapter sent no credential, so checkHealth() fell into its
catch-all and reported "Qdrant not reachable" for a service that was up and
merely refusing the request. Retrieval then degraded to keyword-only without
surfacing an error, which is the failure mode that hides: every query still
returns results, just worse ones.

httpJson now sends an 'api-key' header when QDRANT_API_KEY is set. It is
scoped with url.startsWith(QDRANT_URL) on purpose — the same helper also
calls Ollama, which must never receive the key.

checkHealth() now distinguishes 401/403 from an unreachable service and names
QDRANT_API_KEY in the message, so the next person reads "set the key" instead
of hunting ports and containers.

Tests cover all three paths: the key reaches Qdrant, it does not leak to
Ollama, and a real connection failure still reports as unreachable.
@renezander030
renezander030 merged commit 0d04eb6 into main Aug 20, 2026
3 checks passed
@renezander030
renezander030 deleted the fix/qdrant-api-key branch August 20, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant