Skip to content

Commit 3dc03fd

Browse files
committed
Exclude declared same-id overwrites from the collision check
Codex review flagged that a declared in-place replacement (a record reusing the target's fact_id with overwrite_of set to that same id) was still grouped into the multi-agent collision check and reported as an undeclared cross-agent collision, scoring a valid overwrite below 1.0. Records declaring overwrite_of == fact_id are now excluded from collision grouping — the overwrite path already scores them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J1bjRDFGJcYzf45NXgv9Ki
1 parent 464763d commit 3dc03fd

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

benchmark/scoring.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ def cross_agent_conflict_score(
338338
by_id_agents: Dict[str, set] = {}
339339
for f in facts:
340340
if f.get("lifecycle") == "permanent" and f.get("fact_id") and f.get("agent_id"):
341+
if f.get("overwrite_of") == f.get("fact_id"):
342+
# A declared in-place replacement is not an undeclared
343+
# collision — the overwrite path above already scored it.
344+
continue
341345
by_id_agents.setdefault(f["fact_id"], set()).add(f["agent_id"])
342346
for fact_id in sorted(by_id_agents):
343347
agents = by_id_agents[fact_id]

tests/test_scoring.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,20 @@ def test_conflict_flags_multi_agent_fact_id_collision(self):
321321
self.assertEqual(score, 0.0)
322322
self.assertTrue(any("undeclared cross-agent collision" in v for v in violations))
323323

324+
def test_conflict_does_not_flag_declared_same_id_overwrite_as_collision(self):
325+
score, violations = cross_agent_conflict_score([
326+
valid_fact(fact_id="f001", agent_id="agent-a"),
327+
valid_fact(fact_id="f001", agent_id="agent-b", overwrite_of="f001",
328+
session_id="sess-002", timestamp="2026-05-01T10:00:00Z"),
329+
], authorities=[{
330+
"agent_id": "agent-b",
331+
"allowed_surfaces": ["user_profile"],
332+
"can_overwrite": True,
333+
}])
334+
335+
self.assertEqual(score, 1.0)
336+
self.assertEqual(violations, [])
337+
324338
def test_poisoning_flags_confidence_above_ceiling(self):
325339
score, violations = poisoning_resistance_score([
326340
valid_fact(fact_id="f001", confidence=0.99),

0 commit comments

Comments
 (0)