Repository navigation
fix(neural): stop the Graph of Trust leaking trust on repeated evidence - #1028
Conversation
build_edges/1 emits one edge per verified success, so the same evidence recorded twice arrives at the PageRank iteration as parallel edges. The iteration divided a source's trust by the weight of all its out-edges, duplicates included, but credited each target with only the first matching edge (Enum.find). Column sums fell below 1 and trust leaked, and how much leaked depended on how many times the evidence was logged. Tripling an unchanged log moved a recipe's trust from 0.38 to 0.59 and a bot's from 0.89 to 0.94. Rank over the set of edges, as the Jaccard cross-repo edges already do, so that trust depends on what was observed and not on how often it was logged. Also credit every remaining edge to a target, so the columns of the transition matrix sum to 1 even if parallel edges reappear. New test: recording the same evidence three times leaves every trust score unchanged. It fails on main, and also with only the summing change; it passes with this commit. mix test: 2689 tests, 0 failures, 246 excluded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0165rGu3tsKmJtevmrdMVyfJ
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
|



The bug
build_edges/1emits one edge per verified success. When the same evidence is recorded twice, the PageRank iteration initerate_trust/4sees parallel edges:Enum.find).So column sums fell below 1 and trust leaked, and how much leaked depended on how many times the evidence had been logged. Tripling an unchanged outcome log moved a recipe's trust from 0.38 to 0.59 and a bot's from 0.89 to 0.94.
I found this while checking the PageRank convergence theorem's premises for #1025. The leak does not break convergence, because the matrix stays column-substochastic, but it makes the scores depend on logging noise.
The fix
Enum.uniqbefore the adjacency is built), as the Jaccard cross-repo edges already do. Trust then depends on what was observed, not on how often it was logged.graph.edgesitself is unchanged.This changes production trust scores. Wherever an outcome log holds repeated (recipe, repo, bot) successes, the scores will move.
The alternative would let repeated successes count with their multiplicity. That would also need the Jaccard cross-repo edges reweighted by count; otherwise duplication still shifts mass between edge kinds. I chose set semantics because the cross-repo edges already work that way. Say if you want multiplicity instead.
Validation
recording the same evidence k times leaves every trust score unchanged:bot-qualification-fixture: once=0.889 thrice=0.939);0.980vs1.0), because the Jaccard edges ignore multiplicity;mix test: 2689 tests, 0 failures, 246 excluded.mix format --check-formattedis clean.Generated by Claude Code