feat(agent): preserve claim-source attribution through report synthesis#89
Merged
Merged
Conversation
Closes #88. Attribution was enforced within the diagnosis (#81) and passed intact into the Report agent, but lost at synthesis: IncidentReport carried no sources and no claims, so the artifact a human reads (prose root_cause/summary, text-only low_confidence_claims) could not be traced back to the tool signals behind it. Traceability survived only in the audit log's separate diagnosis dump. This violated the assertion that every synthesis step must output claim-source pairs. - IncidentReport gains sources: list[SourceRecord] and supporting_claims: list[ClaimRecord] (default empty), plus a self-contained validator mirroring the diagnosis integrity check: every non-UNSOURCED supporting claim traces to a real carried source; source_ids and claim_ids unique. - _parse_incident re-attributes every report from the diagnosis deterministically (_attach_attribution: carry sources + claims, re-validate), so no hallucinated source_ids and the invariant holds on what the pipeline emits. - _fallback_report carries attribution too, so the fallback path stays traceable. Root-cause/action-level provenance (citing specific claim_ids) is left as a follow-up; this delivers the deterministic no-loss guarantee first. Tests: IncidentReport attribution validator (valid, unknown-source rejected, UNSOURCED exempt, duplicate rejected, empty default) and monitor carry-forward (_parse_incident + _fallback_report). Full suite 236 passed; ruff + mypy clean.
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.
Closes #88.
Problem
Attribution was enforced within the diagnosis (#81) and passed intact into the Report agent, but lost at synthesis:
IncidentReportcarried no sources and no claims.root_cause/summaryare prose,low_confidence_claimsis text-only, so the artifact a human reads couldn't be traced back to the tool signals behind it. Traceability survived only in the audit log's separate diagnosis dump. This violated the assertion that every synthesis step must output claim-source pairs.Fix
IncidentReportgainssources: list[SourceRecord]andsupporting_claims: list[ClaimRecord](default empty), plus a self-contained validator mirroring_check_attribution_integrity: every non-UNSOURCED supporting claim traces to a real carried source; source_ids and claim_ids unique._parse_incidentre-attributes every report from the diagnosis deterministically (_attach_attribution: carry sources + claims, re-validate), so no hallucinatedsource_ids and the invariant holds on what the pipeline emits._fallback_reportcarries attribution too, so the fallback path stays traceable.Out of scope (follow-up)
Root-cause / per-action provenance citing specific
claim_ids. This delivers the deterministic no-loss guarantee first.Why now
#67 (fork-style exploration) reconciles N forks: a synthesis step. This gives that merge an attribution-preserving target instead of the one synthesis example that dropped it.
Tests
IncidentReport attribution validator (valid, unknown-source rejected, UNSOURCED exempt, duplicate rejected, empty default) + monitor carry-forward (
_parse_incident,_fallback_report).Full suite 236 passed; ruff + mypy clean.
https://claude.ai/code/session_01R5VygSzbGTggW7mHd3PVwE