Repository navigation
Report cache hits from the embeddings worker (plugin) - #1038
Merged
thekevinscott merged 3 commits intoSep 4, 2026
Merged
Conversation
Red for dirsql#1034. cachetta's wrapper returns a hit and a miss identically, so the worker cannot currently tell dirsql which answers cost nothing. skip-changelog: red tests only, no observable change yet
cachetta's wrapper returns a hit and a miss identically, so the only place
a miss is observable is the wrapped compute itself: it runs on a miss and
never on a hit. embed() clears a flag, calls through, and reads the flag
back, then the response carries `"meta": {"cached": <bool>}` for the
progress line to split.
Existing assertions that compared a whole response object now compare
`response["ok"]`; the meta key has its own tests.
Refs #1034
thekevinbot
force-pushed
the
claude/tackle-1034-plugin-flag
branch
from
September 4, 2026 22:03
e4f2700 to
6da2c8f
Compare
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Layer 2 of 2 for #1034. Stacked on #1036 (
base: claude/tackle-1034-cachesplit), which teaches the core to read and render the split; this layer teaches the embeddings plugin to produce it.Fixes #1034
The problem
cachetta'swrap()returns a hit and a miss identically — same value, no signal — soWorker.embedhad no way to say which it got. Without it, layer 1's parenthetical never appears for the one worker in this repo that actually caches.The fix
The wrapped function is the signal.
_computeruns on a miss and never on a hit, so it sets a sentinel;embedclears the sentinel, calls through the cache, and reads it back:The response then carries the flag the core protocol defines:
{"ok": [0.12, ...], "meta": {"cached": true}}handlegained an_embed_responseextraction so it stays under the incoming 24-lineone-function-per-fileratchet (21 lines now).{"ok": null}for a NULL value is unchanged — nothing is computed, so there is no cache state to report.Test changes beyond the new coverage
Several existing tests compared a whole response object (
== {"ok": [1.0, 0.0]}) where the point was the vector. Those now compareresponse["ok"]; themetakey is asserted in its owndescribe_cache_reportingblocks rather than incidentally in every protocol test.Red CI observed
Run 33922087464,
dirsql-plugin-embeddings integration tests (3.12)and(3.13), onc86314a:(That run is against the pre-rebase sha
c86314a; the branch was later rebased onto the restored base of #1036, making the same commitfc85500. The run and its logs remain reachable.)Failing on the new assertion, for the asserted reason (
-xstops there; locally the full run was6 failed, 14 passed— the five other cache-reporting integration tests plus the e2e(2 cached)assertion).Manual run
Worker directly, repeated value, real model2vec and real cachetta:
End to end through the real CLI over a four-file corpus, cold then warm against the same
XDG_CACHE_HOME:Identical rows, 3.3s versus 0.3s, and the line now says why.
Parity
No change. The plugin exports no Python API (
__init__.pyis empty) and adds nothing to any SDK surface —PARITY.mdis untouched, and layer 1 already recorded that the flag is worker-protocol rather than SDK surface. No drift.Gates
just preflight→0 failing pair(s), 3 skipped.plugins-embeddings [python] mutation→no surviving mutants — every mutation was caught (5 mutant(s) tested).Changelog / Migrations
<root>/<pkg>/changelog.d/for each changed package (or:skip-changelogtrailer on a commit with reason)<root>/<pkg>/migrations.d/(or: not required — additive/bugfix only)plugins/dirsql-plugin-embeddings/migrations.d/2026-09-04-report-cache-hits.md. Nothing breaks andRequired changesis_None._, but the trigger that fires is "changes runtime behavior without an API change": anokline that read{"ok": [1.0, 0.0]}now reads{"ok": [1.0, 0.0], "meta": {"cached": false}}. dirsql ignores unknown keys, so this is additive for it — a third party doing exact-equality on the whole object is the one case that needs a line, and it gets one.E2E Verification
packages/pythonchange on this layerpackages/tschange on this layerpackages/rustchange on this layerpackages/python/e2e-attestations/<branch>.jsonreceipt written ifpackages/pythonchanged (just e2e-attest-python) — not required, unchangedpackages/ts/e2e-attestations/<branch>.jsonreceipt written ifpackages/tschanged (just e2e-attest-ts) — not required, unchangeduv run --with-editable ../../packages/python python -m pytest tests/e2e/ -x -q(plugin, viatesting-conventions e2e attest);uv run --with-editable ../../packages/python python -m pytest tests/integration/ -q17 passed, integration49 passed. Receipt committed atplugins/dirsql-plugin-embeddings/e2e-attestations/claude-tackle-1034-plugin-flag.json.