Repository navigation
fix: remote recall calls setup.sql's gitmem_scar_search (GIT-114) - #50
Merged
3 commits merged intoSep 23, 2026
Merged
3 commits merged into
3 commits merged into
Conversation
When the local vector index isn't ready (every server start until warm-up, a new or empty store, a failed load, GITMEM_SEARCH_MODE=remote), recall called match_gitmem_learnings_weighted. No setup.sql defines it: GIT-93 took the name from nTEG's store. Every customer's cold recall got PGRST202 and returned nothing. - Default prefix: call gitmem_scar_search with similarity_threshold. If the store answers PGRST202 (no such function, e.g. nTEG's), fall back to match_gitmem_learnings_weighted with match_threshold. The first that exists is remembered for the process; any other error is not retried. - Non-default prefix: only match_<table>_weighted. gitmem_scar_search reads gitmem_learnings by name and would search the wrong table. - gitmem_scar_search doesn't return learning_type, applies_when, why_this_matters and the other fields recall renders. They are fetched for the matched ids in one select; if that fails, the rows are returned without them. - Remove the dead semanticSearch (match_gitmem_learnings, no callers). scar-search-rpc-name.test.ts: "tracks the prefix" asserted match_gitmem_learnings_weighted for the default prefix, the bug itself; it now asserts gitmem_scar_search. The semanticSearch test goes with the function. +4 tests: PGRST202 fallback, no retry on a real error, the follow-up select, and tolerating its failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-114) scanRpcNames resolves "/rpc/<name>" in string and template literals (getTableName expanded) and, where the URL is built from a variable, the name properties of the candidate objects in the same file. Fixed https:// URLs (licensing) are classified external. Every store RPC must be defined by setup.sql or allowlisted by ticket; stale entries and unresolved dynamic names fail. Planted-drift self-test included. +5 tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ld server (GIT-114) Both must return a seeded scar through the store's RPC. On 1.11.0 the RPC 404s (PGRST202) and both probes find nothing: exit 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
Recall's store fallback now calls the function
setup.sqlactually creates (GIT-114).gitmem_): callsgitmem_scar_searchwithsimilarity_threshold. If the store answers PGRST202 (no such function), it falls back tomatch_gitmem_learnings_weightedwithmatch_threshold. The first function that exists is remembered for the process; any other error is a real failure and isn't retried under another name.match_<table>_weighted.gitmem_scar_searchreadsgitmem_learningsby name, so underorchestra_it would search the wrong table.gitmem_scar_searchreturns only id, title, description, severity, scar_type, counter_arguments, decay_multiplier and similarity. The fields recall renders (learning_type,applies_when,why_this_matters,action_protocol, …) are fetched for the matched ids in one select. If that select fails, the matched scars are still returned without them.semanticSearch(match_gitmem_learnings, no callers).scanRpcNames,parseFunctions). Every RPCsrc/can call on the customer's store must be defined by v1.8.0'ssetup.sqlor allowlisted by ticket:match_gitmem_learnings_weighted(GIT-114, fallback only) andmatch_transcript_chunks(GIT-106, dev only). The licensing RPC is a fixed URL to another project and is classified external.Why
When the local vector index isn't ready, recall asks the store. That covers every server start until warm-up finishes, a new or empty store, a failed load, and
GITMEM_SEARCH_MODE=remote. GIT-93 named the RPC after the function on nTEG's store; nosetup.sqldefines it. So every customer's cold recall got PGRST202 and returned nothing.Decision to review
The fallback keeps nTEG's store working. The ticket says to use
gitmem_scar_search. Per the GIT-93 survey, nTEG's store hasmatch_*_weightedand no*_scar_search. So instead of switching outright, the code tries thesetup.sqlfunction first and falls back only on PGRST202. I didn't probe production to confirm which functions it has (rule: never touch production); the fallback makes that unnecessary.How to test
Venue (
vujndhcumgroztfkkdus, reset tov1.8.0:schema/setup.sql; production not touched).flowhas two new probes, each on a fresh server: recall withGITMEM_SEARCH_MODE=remote, and recall called immediately on a cold server.origin/main1.11.0POST /rpc/match_gitmem_learnings_weightedgitmem_scar_searchLocal cache not readyfallbackUnit tests: 1365/1365 (+9). Four cover the fallback, no retry on a real error, the follow-up select and tolerating its failure; five cover RPC drift, including a planted-drift self-test.
Existing tests changed
scar-search-rpc-name.test.ts:match_gitmem_learnings_weightedfor the default prefix, which is the bug itself. It now assertsgitmem_scar_searchwithsimilarity_threshold.orchestra_tests are unchanged: nTEG's prefix still callsmatch_orchestra_learnings_weighted.Checklist
🤖 Generated with Claude Code