Skip to content

feat(capture): parse-time capture of branch, LOC deltas, interruptions, titles, PR links#758

Merged
iamtoruk merged 1 commit into
mainfrom
feat/rich-session-capture
Jul 20, 2026
Merged

feat(capture): parse-time capture of branch, LOC deltas, interruptions, titles, PR links#758
iamtoruk merged 1 commit into
mainfrom
feat/rich-session-capture

Conversation

@iamtoruk

Copy link
Copy Markdown
Member

Capture half of the rich-session-data plan: parse-time capture of fields the real Claude/Codex stores already carry but CodeBurn discarded. Capture only — no report, payload, or UI consumes these yet; feature PRs (cost-per-branch/per-PR, LOC risk map, ground-truth correction signals) will read them from cache with no further re-parses.

New optional cached fields (omitted at zero/false; cache grew +0.47% on a real 36MB cache)

  • Per-call locAdded/locRemoved: counted from Claude toolUseResult.structuredPatch hunks and Codex patch_apply_end.changes[*].unified_diff. Numbers only, never patch text.
  • Per-call interrupted, userModified, toolErrors (Claude, from explicit is_error markers, deliberately not stderr which carries warnings), editFailed (Codex success === false).
  • Per-turn gitBranch (Claude), stored only when it differs from the previous turn (carry-forward on read). Added as a seventh field to the perf(parser): single-pass field extraction in the large-line JSONL scanner #752 single-pass scanner, so large lines pay no extra scan.
  • Per-session title (last ai-title wins), prLinks, isSidechain. Investigated sidechain linking: parentUuid references an intra-file entry uuid, not a session id (0 matches across the sampled corpus), so only the boolean marker is captured and the limitation is documented.

Parse versions

One conscious bump each: claude -> ...-rich-capture-v1, codex bump + CODEX_CACHE_VERSION 5 -> 6 in lockstep (the codex results layer would otherwise serve old field-less calls). Cold re-parse cost is ~half what it was pre-#752. daily-cache.ts/day-aggregator.ts untouched.

Verification

  • 21 new tests (LOC counting multi-hunk/empty/malformed, meta extraction, branch dedup incl. mid-session switch, title/prLinks, codex diff counting + failed edits, cache round-trip incl. old field-less caches still loading). Full suite green.
  • Real-corpus re-parse on a 770MB store, independently re-verified by a second scan of the resulting cache: 2933 calls with LOC deltas, 666 with toolErrors, 1340 branch-stamped turns, 566 session titles, 8 PR links, 698 sidechain sessions; Codex 872 LOC calls. interrupted/userModified/editFailed had no true samples on this corpus and are covered by unit tests.

Known transient: until this ships, an older CLI sharing the cache re-parses it back to the old version and the dev CLI re-upgrades it (standard bump thrash, resolves on release).

@iamtoruk
iamtoruk merged commit ba56ad7 into main Jul 20, 2026
3 checks passed
@iamtoruk
iamtoruk deleted the feat/rich-session-capture branch July 20, 2026 13:03
iamtoruk added a commit that referenced this pull request Jul 20, 2026
The rich session capture (#758) stores every PR URL a transcript
references, but nothing displayed it. codeburn sessions --by-pr now
groups spend by pull request: cost, savings, sessions, calls, and the
date span per PR, sorted by cost, with a GitHub-shortened label and
json output. Attribution is by reference, so a session that mentions
several PRs counts fully toward each row; the footer reports the
distinct-session total so overlapping rows are never mistaken for a
grand total. prLinks now ride from the cached file onto SessionSummary
in both the Claude pipeline and the generic provider path.

Co-authored-by: reviewer <review@local>
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