GeezerVison is showing github.com — atlas-search: query-embedding cache — sha256 key, memory LRU + shared Turso tier, async writes (#5668 slice 1) · Issue #9941 · developing-today/code
atlas-search: query-embedding cache — sha256 key, memory LRU + shared Turso tier, async writes (#5668 slice 1) #9941DescriptionSlice 1 of #5668, filed by the task 15204 fresh triage (2026-11-14, lane any-c). Design: PR #5667 §3 (merged). Parent: #5668.
Work — query-embedding cache (independent; lands first)
Per design §3 and #5668's acceptance:
- Cache key:
sha256(model_id || model_rev || normalized_text); no TTL.
- Two tiers: service-memory LRU (~10k entries) + shared Turso cache DB in the internal tier.
- Cache writes are async/best-effort and never in the request path; a cache outage must not fail a search.
- Wire it into the query-embedding call site in pkgs/atlas-search (atlas-embed / atlas-core) so both CLI and serve mode benefit; the service protocol is unchanged in this slice.
Acceptance
- A repeated identical query embedding is served from cache (memory tier first, Turso tier second) with identical vectors — proven by tests that count embedding-provider calls (oracle: provider call count stays 1 across repeats).
- PBT over cache-key construction: normalization sensitivity (case/whitespace per the design's normalization), model_id/model_rev sensitivity (any change re-keys), per the testing doctrine — every test names its oracle.
- Golden-311 parity unchanged with the cache cold and warm.
- No behavior change when the Turso cache DB is unreachable (search proceeds, cache write dropped).
Activitydeveloping-today commented on Nov 14, 2026 dezren39 commented on Nov 14, 2026
Agent note — MID-SHIFT FALLBACK: backend failed at checkpoint (task 16725, lane any-c, 2026-11-14)
dezren39 commented on Nov 14, 2026
Picked up by repo-worker-any-c — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while repo-worker-any-c posts progress markers; after 30 minutes of silence any other worker may pick this up.) dezren39 commented on Nov 14, 2026
Progress from repo-worker-any-c: claimed: fallback coordination live; revalidating issue and reading design PR #5667 section 3 dezren39 commented on Nov 14, 2026
Progress from repo-worker-any-c: verified: design 3.1 + embed.rs mapped; implementing embed_cache in atlas-core (LRU + Turso tier, async writes), wiring at main.rs embedder construction dezren39 commented on Nov 14, 2026
Progress from repo-worker-any-c: building: embed_cache.rs + wiring written in worktree queue/16725-9941-embed-cache; running cargo test -p atlas-core dezren39 commented on Nov 14, 2026
Progress from repo-worker-any-c: atlas-core green incl. new cache tests; running fmt check + atlas-search tests (golden cli_parity) dezren39 commented on Nov 14, 2026
Progress from repo-worker-any-c: atlas-core + atlas-search tests green, golden parity green; committed 1b05350; pushing and opening PR dezren39 commented on Nov 14, 2026
Progress from repo-worker-any-c: PR #10086 open; atlas-search CI is push-to-main by repo policy, local suites green; merging dezren39 commented on Nov 14, 2026
Progress from repo-worker-any-c: PR #10086 merged (6bc2bf5); watching main atlas-search CI run 43611013263 dezren39 commented on Nov 14, 2026
Agent note — DONE: query-embedding cache implemented and merged (task 16725, lane any-c, fallback coordination)
- state: done · PR: feat(atlas-search): query-embedding cache — memory LRU + shared Turso tier (#9941) #10086 · merge commit:
6bc2bf54134589eb2dd675661d7f554a86918c5e
- Coordination: this task ran in GitHub-fallback mode after the queue backend failed mid-shift (see the MID-SHIFT FALLBACK note above); the fallback release is its terminal record. The broker-side lease on task 16725 expired during the outage — this note + the merged PR are the state any reclaimer should revalidate against.
What landed (design PR #5667 §3.1): atlas_core::embed_cache — key sha256(model_id ‖ model_rev ‖ normalized_text) (identity fields length-prefixed; no TTL — a model change re-keys); normalization = trim + whitespace collapse, case preserved (the embedder is case-sensitive); memory LRU (10k) always on; shared Turso tier via ATLAS_EMBED_CACHE_TURSO_URL / ATLAS_EMBED_CACHE_TURSO_TOKEN over the libsql HTTPS pipeline — reads on memory miss (2s timeout, failure = miss), writes async/best-effort off the request path; an unreachable tier never fails a search. The cached value is the raw full-dimension vector; finish_query_vector runs after retrieval on hit and miss alike. Wired at CliEmbedder, so CLI one-shot and serve mode share the cache; the FixedEmbedder test-hook path is untouched.
Verification: all four suites the repo's atlas-search CI runs are green locally on the branch — atlas-core (55 unit incl. the provider-call-count oracle staying at 1 across repeats and whitespace variants, the shared-tier cross-cache test, the tier-down resilience test, LRU order, and the proptest PBT over key construction), atlas-search (incl. the golden CLI parity suite — parity unchanged), atlas-proto, atlas-embed. The push-to-main CI run for the merge commit (run 43611013263) was still in the GitHub runner queue at closeout; it runs exactly these suites.
Follow-up (ops, not code): provision the shared cache DB + rw token and set the two env vars on the serve host to light up the shared tier; until then the cache runs memory-only, the designed degradation. Remaining #5668 slices are their own issues. dezren39 commented on Nov 14, 2026
Released by repo-worker-any-c (outcome: done). Implemented #9941 (atlas-search query-embedding cache, design PR #5667 s3.1): PR #10086 merged as 6bc2bf5. atlas-core embed_cache: sha256 key over length-prefixed model_id/model_rev + normalized text (no TTL), memory LRU 10k + env-configured shared Turso tier (async best-effort writes, tier failure = miss, never fails a search), wired at CliEmbedder for CLI + serve. All four CI suites green locally (atlas-core incl. provider-count oracle + key PBT, atlas-search incl. golden parity, atlas-proto, atlas-embed); push-to-main CI run 43611013263 still runner-queued at closeout. Closeout: #9941 (comment). Ran in fallback mode after the queue backend failed mid-shift (broker lease on task 16725 expired during the outage). dezren39 commented on Nov 14, 2026
Agent note — task 16725 completed as already_done (lane code-d)
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|