Skip to content

revert: stop putting the endpoint in the embedding index identity - #126

Merged
wefio merged 1 commit into
mainfrom
revert/endpoint-identity
Oct 29, 2026
Merged

wefio merged 1 commit into
mainfrom
revert/endpoint-identity

Conversation

@wefio

@wefio wefio commented Oct 29, 2026

Copy link
Copy Markdown
Owner

What this reverts, and why

indexId gained the provider endpoint so that switching between two deployments of the same model would mark stored vectors stale instead of mixing two spaces. The risk it guarded against was speculative - the same model name from the same provider - and the cost is now measured:

every existing user's next write re-embedded their whole store, 32 documents per batch, inside mutateUser's retry loop. Under contention each retry re-opened a newer partition, found new pending rows and embedded again. Deployed logs show an Add taking 53-76 s with last_embedding.ms 3.8-12.3 s per call and only 8 s of partition work at the end.

Reverted to the identity that was in use before (text-embedding-v4@5980a18a2d69), so vectors stored earlier are valid again and the backfill stops.

What stays

Nothing here touches storage: the 25 s document timeout, the 45 s write budget, the per-text query cache (one embedding call per search instead of up to twenty-four), and the memory trace.

Verification

  • indexId for the same model/dimensions is text-embedding-v4@5980a18a2d69, identical to the value before the change.
  • tests/core/openai-embedding.test.ts: 11 pass (the test that asserted endpoint separation was removed with the behaviour it pinned).
  • tsc --noEmit and eslint clean.

Follow-up worth doing later

Embedding should happen before mutateUser's retry loop, keyed by the request's own documents, so a CAS retry can never re-embed. That removes this amplification class by construction rather than by keeping the index stable.

The endpoint was added to `indexId` so a switch between two deployments of the same model
would mark stored vectors stale instead of mixing two spaces. The risk it guarded against was
speculative - the same model name from the same provider - while the cost was measured: every
existing user's next write re-embedded their whole store, 32 documents per batch, and on a
stalled provider that turned one Add into five to twelve embedding calls and 53-76 seconds.

Reverted to the previous identity (`text-embedding-v4@5980a18a2d69`), so the vectors stored
before the change are valid again and the backfill stops happening. The test that asserted the
separation went with it.

Not reverted, because they do not touch storage: the 25 s document timeout, the 45 s write
budget, the per-text query cache, and the memory trace.
@wefio
wefio merged commit 116a7d2 into main Oct 29, 2026
8 checks passed
@wefio
wefio deleted the revert/endpoint-identity branch October 29, 2026 09:58
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