Repository navigation
A namesake tie goes to review, not to candidate order - #329
Conversation
When a base holds two same-name entities with identical profile vectors (common after deeplethe#221 seeds both from one chunk), a later bare mention scores the same against both. resolve_mention attached to the first candidate the database returned once the score cleared SIM_ATTACH, filing no review — so which entity got the fact was decided by candidate order. A near-tie among namesakes (same canonical name, scores within the new SIM_TIE_MARGIN) is now a grey zone regardless of the absolute score: attach to neither, create the entity, and file a review pair against each candidate at the human stage, so the batch adjudicator can never auto-merge two profiles it cannot tell apart. SIM_ATTACH / SIM_NEW are untouched. Fixes deeplethe#270. Signed-off-by: Ben Younes <2910651+ousamabenyounes@users.noreply.github.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
|
Reviewed and pushed one commit on top: the new The rest reads well. Two things I checked and liked: the Approving CI now. |
Fixes #270.
The tie
Once a base holds two entities with the same name —
Zhang WeiA (Platform Engineering) and B (Finance) — a later document that mentionsZhang Weiwith no handle is attributed by profile similarity. When both were seeded from the same chunk their profile vectors are identical, so the new mention scores the same against both.resolve_mentionkept the first candidate it met (sim > s, strict) and, once that score clearedSIM_ATTACH, attached silently. No review pair was filed. Which entity got the fact depended on the order the candidates came back from the database.The fix
A near-tie among namesakes is now a grey zone regardless of the absolute score (per the issue's first option). When the top-scored candidate would otherwise attach (
sim >= SIM_ATTACH) but another candidate with the same canonical name scores within a newSIM_TIE_MARGINof it, the mention attaches to neither: it creates the entity and files a review pair against each namesake at the human stage.Filing at
human(notadjudicating) is the point — the batch adjudicator (adjudication.rs) auto-mergesadjudicatingpairs, which is exactly what must not happen to two profiles it cannot tell apart.pending_adjudicationsfiltersstage = 'adjudicating', so human pairs never reach it, andcreate_review's upsert only ever escalates a pre-existing pair tohuman.SIM_ATTACH/SIM_NEWare untouched, as the issue asked.lower().resolve_mentioncarry the review stage out,ReviewRequestgained astagefield; every existing caller keepsAdjudicating, and the extraction loop now honours it (and no longer wakes the LLM adjudicator for a purely human pair).Test verification (RED → GREEN)
Two database-backed tests (they skip without
UTOPIA_DATABASE_URL, like the rest of theutopia-storesuite; the CImigrationsjob runs them withUTOPIA_TEST_REQUIRE_DB=1).RED — on the unmodified
devbranch, the store test fails because the mention silently attaches:GREEN — with the fix, a third entity is created and two human review pairs are filed:
The server test drives the real
resolve→resolve_uncachedpath and asserts the tie files twohumanreviews, leavespending_adjudicationsempty, and never setsneeds_adjudication.Local CI
Ran the full
ci.ymllocally againstpgvector/pgvector:pg16:cargo fmt --all --check— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace(with a database) — 316 passed, 0 failedcargo build --workspace— okweb:pnpm install --frozen-lockfile && pnpm build— ok