Repository navigation
fix: unified recall scopes docs to namespace, reports honest scores (#1270) - #1271
Merged
Merged
Conversation
…1270) recall_unified_all (the default CLI recall path) leaked documents across namespaces and reported rank-derived scores that outranked every memory: - doc_search was called without a namespace (its ns param was _ns), so documents from any namespace - including NULL-namespace rows - appeared in every scoped recall - doc scores were (k+1)/(k+1+rank): rank-0 reported 1.000 for every query, a pure rank function that beat all memory fusion scores (~0.16-0.19), flooding short-query results with the same doc set - min_score was applied inside recall_hybrid against pre-boost rank-based scores (#1223), where it filters nothing meaningful Changes: - new Uteke::doc_search_in(query, limit, mode, namespace) retains only exact-namespace documents; NULL-namespace docs are global- view-only, matching the #1269 doc-list semantics - unified doc arm keeps hybrid mode (index rebuilds evict chunk: vectors per #1110 - semantic-only would hide docs on affected stores) but reports the raw hybrid RRF sum (~0.016-0.033), same rank-based family as memory fusion base scores, never a fake 1.0 - memory arm called with min_score 0.0; the caller's threshold is applied post-merge on reported scores so --min/--strict work - unified document results now carry their namespace Verified: fmt/clippy clean; workspace 691 tests pass; E2E on a PROD-snapshot store - short queries return only in-namespace memories with honest scores, and 'memory lifecycle' surfaces the ns=default chapter-6 document (0.016) instead of a cross-namespace 1.0 artifact.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
doc_search_in fetched the global top-limit results and only then retained the requested namespace, so scoped searches could silently return fewer results than exist when matching docs ranked below the global top-N. Fetch 4x when scoping (mirrors the entity/category post-filter heuristic on the memory path) and truncate to limit after the retain.
| // Real cosine from the semantic doc arm — not the | ||
| // rank-derived RRF sum (kept in `rrf_sum` only for | ||
| // merge ordering). | ||
| score: dr.score, |
The score comment still said 'real cosine from the semantic doc arm' from an earlier iteration of this change - it is the raw hybrid RRF sum, and the min_score filter comment claimed both scales were honest similarities. Spell out the actual caveat instead: both scales are rank-based with different magnitudes (memory fusion ~0.2 max vs doc hybrid ~0.033 max), so thresholds above ~0.033 filter all documents; use --type memory + a vector strategy when cosine-style thresholding is needed.
ajianaz
added a commit
that referenced
this pull request
Sep 18, 2026
…oc-global design note - Critical Rule #15: key notes/decisions/findings are saved to uteke memory (project room) the moment they are confirmed, with read-back verification — recording state is part of the task, not an afterthought (#1270 session). - Per-issue workflow gains the recording step (step 10). - Known Limitations: documents are global (NULL namespace) by design; scoped unified recall therefore never returns documents (#1271), doc search stays the global doc view.
ajianaz
added a commit
that referenced
this pull request
Sep 18, 2026
* chore(release): complete v0.18.2 metadata lost in #1278 squash The #1278 squash carried AGENT.md and CHANGELOG (staged correctly) but lost the in-place edits applied after staging: Cargo.toml/Cargo.lock stayed 0.18.1 and the README version strings kept v0.18.1. This restores them on top of develop so the release line is consistent again. Also moves the #1273 Unreleased changelog entry into [0.18.2] with a note: both #1270/#1271 (this backport) and #1273 land on main together when the release is tagged, so the shipped version section must list both. * fix(release): 0.18.2 version lockstep — bundled skill asset + core contract Follows #1274 (skill parity test) and #1276 (tiered api_registry / core contract generation): both artifacts embed the workspace version and went stale when the 0.18.2 bump was reapplied on top of develop. Bumps the bundled uteke-memory-skill.md version line and regenerates docs/core-contract.json via docgen. * fix(release): sync .agents uteke-memory skill copy to 0.18.2 The skill_bundled_matches_repo_copy parity test requires the bundled asset (crates/uteke-cli/assets/uteke-memory-skill.md) and the repo wiki copy (.agents/skills/uteke-memory/SKILL.md) to be byte-identical; only the bundled side was bumped in the previous commit. --------- Co-authored-by: ajianaz <[email protected]>
6 of 10 tasks
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_unified_all(default CLIrecall,--type all):Uteke::doc_search_in(query, limit, mode, namespace)retains only documents whose namespace matches the recall's namespace; NULL-namespace documents are global-view-only (consistent with the memory path and fix: doc list honors --namespace on CLI, HTTP, and MCP (#1268) #1269 doc-list semantics).(k+1)/(k+1+rank)(which reported 1.000 for rank-0 regardless of query). Rank-based scores must not be normalized to the cosine scale in a mixed list; the RRF merge continues to decide ORDER only.recall_hybridis called withmin_score 0.0(it filters against pre-boost rank-based scores, per recall: default min_score 0.3 suppresses valid embedding matches (found via AMB benchmark wiring) #1223); the caller's threshold is applied post-merge on the reported scores, so--min/--strictbehave consistently on both result types.namespacein the output payload.Why
Short queries on the 12.5k-memory PROD snapshot returned the same document set at the top of every query in every namespace: the doc arm ignored the namespace (
_nsunused) and reported rank-derived scores (rank-0 = 1.0) that outrank every memory fusion score (~0.16–0.19). Effectivelyrecall "gadio"andrecall "billing"gave identical, namespace-violating results. Full evidence in #1270.Design note: hybrid doc mode is kept (not semantic-only) because index rebuilds evict
chunk:vectors (#1110) — on affected stores the semantic arm returns nothing and docs would vanish from unified results entirely; the FTS arm keeps them discoverable.Testing
cargo fmt --check+cargo clippy --all-targetsclean (core+cli)cargo test --workspace: 691 passed, 0 failed (a single-runupgrade::replace_binary"Text file busy" failure is a known env race executing/renaming the debug binary — passes on rerun, unrelated area)recall "gadio|billing|quota" --namespace default→ all results[memory]with honest scores ~0.19, no cross-namespace docs, no fake 1.0recall "memory lifecycle" --namespace default→ relevant[document] Ch6: Memory Lifecycle(ns=default, score 0.016) surfaces correctlydoc search(standalone) unchangedCloses #1270