Skip to content

Fix agent trace attribution - #348

Open
davidabram wants to merge 11 commits into
mainfrom
fix-agent-trace-attribution
Open

davidabram wants to merge 11 commits into
mainfrom
fix-agent-trace-attribution

Conversation

@davidabram

Copy link
Copy Markdown
Member

No description provided.

davidabram and others added 8 commits November 6, 2026 16:55
Replace historical patch overlap with line-level attribution so stale or ambiguous direct evidence cannot claim committed changes. Replay bounded mutation lineage first, then accept only fresh exact single-session direct matches for uncovered lines, while preserving non-AI overrides and keeping post-commit intersection evidence separate.

Refactor fixtures and regression coverage around the Agent Trace service, and update the context documentation and flake inputs to describe the new contract.

Co-authored-by: SCE <sce@crocoder.dev>
Replace suffix-based file matching with normalized repository-relative identity, rejecting paths outside the repository and resolving structured Claude paths against their recorded cwd. Preserve each direct-trace row through attribution so conflicting sessions are rejected and tool metadata is derived only from accepted final evidence. Update the co-author preflight, post-commit builder, tests, and context documentation to enforce the same fail-closed rules.

Co-authored-by: SCE <sce@crocoder.dev>
Claude structured diff paths previously fell back to repository-relative matching when cwd was unavailable, which could attribute an edit to the wrong repository file. Carry an explicit path origin through parsing and attribution: repository-relative Git paths, absolute cwd-based Claude paths, and absolute-only Claude paths without a usable cwd. Reject unresolved relative identities while preserving absolute paths, and add regression coverage and context documentation.

Co-authored-by: SCE <sce@crocoder.dev>
Resolve each canonical committed line to one AI, non-exclusive, or unknown decision and derive hunk classifications and metadata counters from that shared map. This preserves non-exclusive lineage against direct evidence and makes totals independent of hunk boundaries.

Expand fixture, integration, and randomized coverage for the per-line attribution contract.

Co-authored-by: SCE <sce@crocoder.dev>
Keep the mixed-path parser fixture's hunk header aligned with its four removed and six added lines. This preserves the test's intended line-number coverage for direct, lineage, contended, and manual additions.
Replace Git-hunk-based Agent Trace conversations with revision-positioned ranges built from final per-line attribution decisions. Read committed blobs at the recorded revision to validate positions and hash exact line bytes, while preserving conservative handling for unavailable or non-line-addressable files.

This removes fabricated mixed hunk ownership and embedded deleted-patch expansion, groups ranges by accepted provenance, and updates the hook integration, fixtures, tests, and context contracts for the new payload semantics.

Co-authored-by: SCE <sce@crocoder.dev>
… lookup

Decode Git's C-quoted paths to preserve exact repository identity and reject malformed or ambiguous patch headers. Make committed-file reads distinguish missing, non-line-addressable, and explicitly unverified files while propagating tree and blob lookup failures instead of persisting unverified ranges.

Add focused parser, committed-content, and post-commit path identity coverage, and update the attribution documentation.

Co-authored-by: SCE <sce@crocoder.dev>
Track parent-line identities through bounded mutation replay so deleted lines are attributed to the transition that removed them rather than their original author. Anchor removal replay to the exact first-parent tree and captured commit OID, reconcile paths and unobserved tails conservatively, and keep unresolved cases unknown across gaps, partial staging, restorations, root or merge commits, and HEAD moves. Extend hook and runtime coverage and document the effective-remover contract.

Co-authored-by: SCE <sce@crocoder.dev>
@davidabram
davidabram force-pushed the fix-agent-trace-attribution branch from 274781b to 36c3733 Compare November 6, 2026 22:46
davidabram and others added 3 commits November 6, 2026 23:58
Keep the synthetic `Unverified` committed-file state and its matching
validation branch available only in test builds. This removes the test-only
fallback from production code while preserving the existing test behavior.
Prevent late mutation events and direct evidence from claiming lines in an already-created commit. Capture the committer timestamp from the captured commit OID, reject untrusted timestamps, and apply the insertion-time cutoff in both evidence queries and mutation-event paging.

When the timestamp is untrusted, fail closed to unknown attribution while still persisting the trace. Add database helpers, bounded replay coverage, hook integration, and documentation for the conservative cutoff behavior.

Co-authored-by: SCE <sce@crocoder.dev>
Clarify that post-commit direct evidence and mutation history are eligible only when both reported and database timestamps precede a trusted commit-time cutoff. Document captured-commit tree resolution, SQL filtering before the bounded mutation-event window, and fail-closed unknown attribution when the cutoff is untrusted.

Update the related database, storage, structured-patch, architecture, glossary, overview, and context-map descriptions to match the runtime contract.

Co-authored-by: SCE <sce@crocoder.dev>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant