Repository navigation
Description
Summary
Claim had five definitions. Two were unrelated concepts and are renamed apart in #18082 (WorkClaim for a held work scope, KeyClaim for an idempotency-key result). The remaining three are the same concept at three stages of enrichment — a real fork. Renaming those apart would entrench it, so they are deliberately left alone until they can be merged.
Parent: #12771.
The three
| module | fields | importers |
|---|---|---|
api/knowledge_grounding_models.py:137 |
claim_text, source, confidence, timestamp, metadata |
2 |
services/knowledge_grounding_models.py:129 |
claim_text, claim_type, kb_status, confidence, sources, kb_fact, timestamp, metadata |
4 |
services/grounded_agent_models.py:46 |
claim_id, claim_text, subject, predicate, object, confidence, context, timestamp |
6 |
All three are "an assertion extracted from model output, to be checked against the knowledge base". All three carry claim_text, confidence and timestamp. They diverge in what they add:
- the
apione is the thinnest and records where the claim came from (source); - the
services/knowledge_grounding_modelsone adds classification and KB verdict (claim_type,kb_status,sources,kb_fact); - the
grounded_agent_modelsone adds an identity and an SPO decomposition (claim_id,subject/predicate/object).
They feed three pipelines that all ultimately do grounding: conflict_resolver, claim_verifier + claim_classifier, and grounded_agent + the knowledge_grounding API.
Why this is not a rename
The fork-detector's advice for a cluster is "merge the others into one", and for the other clusters in #18082 that advice was wrong — they were name collisions. Here it is right, which is exactly why this is split out: a mechanical rename would produce ApiClaim / ClassifiedClaim / AgentClaim and make three models of one concept permanent.
It is also not a mechanical change. It needs decisions that a rename does not:
metadatavscontext— the same bag under two names.- Is
sourcethe same thing assources? Singular provenance versus a list of matching KB facts are probably different fields, not one. - Is the SPO triple intrinsic or a later enrichment? If intrinsic, every producer must fill it; if not, it is optional and consumers must handle absence.
- One model or a small pipeline of stages? A single union dataclass with a dozen optional fields is the failure mode this work is supposed to avoid.
Twelve import sites depend on specific field sets, so a wrong merge changes grounding and verification behaviour silently rather than failing loudly.
A second duplication sitting underneath it
There are two different modules both named knowledge_grounding_models.py — one in api/, one in services/ — each defining its own Claim. The duplication is at module level, not just symbol level, and the fork detector cannot see that at all because it keys on symbol names. Worth checking whether the whole pair should be one module before merging the dataclasses inside them.
Acceptance criteria
- One
Claimfor the extracted-claim concept, with a recorded decision for each field question above -
Claimremoved fromrepo_tests/symbol_fork_baseline.json - All 12 import sites migrated, with no optional field added merely to keep a caller compiling
- A recorded decision on whether
api/knowledge_grounding_models.pyandservices/knowledge_grounding_models.pyshould remain two modules - Grounding and verification behaviour pinned by tests before the merge, so the merge is checkable rather than assumed
Activity
github-actions commentedon Oct 7, 2026
👋 Auto-triage could not confidently classify this issue (no confident signal). Could a maintainer add the appropriate labels (
frontend,backend,infrastructure,docs,testingandgood-first-issue,intermediate,advanced)?refactor(coordination): separate the two Claims that are not groundin…
mrveiss commentedon Oct 7, 2026
Correction: the "two modules with the same name" claim in this issue is wrong
The issue body says:
The second sentence is wrong, and I wrote it from the filenames without comparing the contents. Measured:
Their top-level symbols barely overlap:
api/services/Claimis the only name in both. So this is two different modules that happen to share a filename, not a duplicated module. The module-level duplication claim should be struck; the acceptance criterion "a recorded decision on whether the two modules should remain two modules" is still worth keeping, but as a naming/clarity question, not a deduplication one.The
Claimfinding itself stands unchanged and is still the point of this issue: three definitions of one concept acrossapi/knowledge_grounding_models,services/knowledge_grounding_modelsandservices/grounded_agent_models, sharingclaim_text/confidence/timestampacross 12 import sites, differing only in what they add. That was measured field by field, not inferred.Why I am flagging my own error rather than quietly editing
Two other same-filename pairs came up in the same sweep and only one is a real duplicate, which is exactly why the filename is not evidence:
autobot-backend/plugin_sdkvsautobot_shared/plugin_sdk— already consolidated. The backend one is a re-export shim (refactor(plugin-sdk): dedup PluginRegistry/CapabilityChecker onto autobot_shared canon (#11634 T2) #11636), withtests/test_plugin_sdk_shim.pypinning that both paths resolve to the same class objects. I had flagged this as a duplication too; it is not one.rbac_middleware.pyin both backends — genuinely byte-identical, 595 vs 594 lines withdiffreporting 11 lines, all of them comment text. That one is real and is security(rbac): two byte-identical 595-line rbac_middleware copies, one per service #18088.One of three same-named pairs was a duplicate. Reading duplication off a filename would have been wrong twice out of three times.
refactor: retire ten symbol-fork clusters — 364 to 354 (#12771)
mrveiss commentedon Oct 10, 2026
Module-naming decision (2026-10-10), from the merge evidence: the two
knowledge_grounding_models.pymodules stay two modules. AfterClaim,VerifiedClaim,ConflictandConflictResolutionwere merged onto one canonical definition each (branchissue-18086-claim-models), they hold different content:api/knowledge_grounding_models.pyholds the conflict-resolver and review-queue domain:GroundingSourceType,ConflictResolution,ReviewTicket*,KBFact,ResearchedFact,ResolvedClaim,Conflict.services/knowledge_grounding_models.pyholds claim classification and verification:ClaimType,KBStatus,VerificationMethod,KBSource,Claim,ClaimStatus,VerificationStatus,VerifiedClaim,ClaimExtractionResult.They are not one module under two paths, so no module merge applies. Still open in this area: the vocabularies overlap (
pending_review/human_reviewandinconclusive/unresolvedinConflictResolution;ClaimStatusvsVerificationStatus). Collapsing them changes wire values, so it needs its own decision.services/agents/subagent_task.py'sConflictResolutiondataclass is a different concept (consensus between subagent outputs).refactor: retire ten symbol-fork clusters — 364 to 354 (#12771)
fix(ai-ml): the dynamic model loads consult the pinned registry, and …
refactor(grounding): merge the three Claim models into one (mrveiss#1…
refactor(grounding): one Conflict, ConflictResolution and VerifiedCla…
refactor(grounding): ReviewTicketPriority is the canonical Priority, …
github-actions commentedon Nov 3, 2026
needs-structure: this issue is missing:phase:M4.<k>label matching milestoneM4 - Deforking and deduplication: found noneThe label clears on the next issue event once all three are present (#19522).
mrveiss commentedon Nov 6, 2026
Local branch
issue-18086-claim-models(not on GitHub), inspected 2026-11-06Verdict: LANDED (triage said REAL-UNIQUE)
Intent: Merge the three Claim models into one; one Conflict, ConflictResolution and VerifiedClaim.
Result: Corrected from REAL-UNIQUE. Both commits are on main (7d59711, c8ca9bd); ReviewTicketPriority follow-up landed too (2524769). Pending hunks are claim_verifier type placement main restructured (claim_verifier_types.py); do NOT revive.
Commits not on main (2 non-merge, 0 merge):
3d26808886refactor(grounding): one Conflict, ConflictResolution and VerifiedClaim (refactor(grounding): three Claim models for one concept — merge, do not rename apart #18086)dfba528a52refactor(grounding): merge the three Claim models into one (refactor(grounding): three Claim models for one concept — merge, do not rename apart #18086)Pending hunks (added lines not on main): 9 hunks in 7 files; largest:
repo_tests/_reach_policy.py:ALLOWANCE_VERDICTS: dict[str, tuple[str, str, str]] = {(3 lines) — "one-claim-model-scan": (repo_tests/one_claim_model_18086_test.py:(top level)(3 lines) — for n in ast.walk(ast.parse(source)):autobot-backend/services/claim_verifier.py:class ClaimVerifier:(2 lines) — async def _verify_unknown_claim(self, claim: Claim) -> VerifiedClaim:autobot-backend/tests/services/test_claim_verifier.py:class TestBatchVerification:(2 lines) — assert results[0].claim.claim_text == "IN KB claim"autobot-backend/services/claim_verifier.py:class ClaimVerifier:(1 lines) — verified = await self._verify_unknown_claim(claim)autobot-backend/services/knowledge_grounding_models_test.py:def test_the_deliberate_prose_file_still_carries_the_literal(1 lines) — by_id = Conflict(claim_1_id="c1", description="d", severity="high")autobot-backend/tests/services/test_claim_verifier.py:class TestBatchVerification:(1 lines) — assert result.claim.claim_text == f"Claim {i}"repo_tests/python_file_size_ratchet_baseline.py:RATCHET_BASELINE: dict[str, int] = {(1 lines) — "autobot-backend/services/claim_verifier.py": 792,scripts/python_file_size_known_large.py:KNOWN_LARGE: dict[str, int] = {(1 lines) — "autobot-backend/services/claim_verifier.py": 792,Milestone change: this issue had no M1-M4 milestone; set to
M4 - Deforking and deduplication(code area: grounding models dedup).Merge origin/main into issue-18086-claim-models; main already landed …
mrveiss commentedon Nov 20, 2026
Branch
issue-18086-claim-models(PR #21822, head not recorded in the audit log) was deleted as a zero-change branch. None of the five ACs is ticked; I did not verify the singleClaim, the baseline entry, the 12 import sites or the pinning tests.