Files
splinter/src
lotherk 98dce53200 embed: a remote index stores the model's vectors, and the query asks the model
Two bugs that made `embed = openai` useless while looking healthy:

1. encode_remote() read every vector element with mcp_arg_num(el, NULL, 0.0).
   mcp_arg_num() looks up a key in an object; on a bare array element it always
   returned the default. Every stored vector was zeros, so the index was
   "built" and no search could ever match.
2. The search encodes the question locally, even when the index was built
   remotely. Two unrelated vector spaces: a query never landed near anything.
   encode_query() now sends the question to the same endpoint that built the
   index.

Proof in tests/test_embed.c (test_remote_vectors_are_the_models): a forked
HTTP server answers /v1/embeddings with a bag-of-words vector that is not the
local hash. Without the fix the stored vector is all 'A' (base64 zeros) and
the search finds nothing; with the fix the stored vector carries 5 non-zero
components and "which port does the deploy machine use" hits the right message
at 0.713.

make check: all tests passed. make check-asan: all 45 test binaries clean.
2026-11-23 00:47:34 +00:00
..