mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-08-10 09:04:51 +00:00
* sessions: attribute PR spend per turn instead of per session The by-PR surfaces attributed a session's full cost to every PR it referenced, so one orchestration session that touched many PRs rendered identical full-session rows. Capture per-turn PR references during transcript parsing and attribute each turn's cost to the PR set active at that turn (split evenly across a multi-PR merge-sweep turn), carrying the most recent PR set forward across turns that reference nothing. Turns before the first reference form an unattributed bucket. A session whose transcript expired before per-turn capture keeps its session-level prLinks but has no per-turn refs; it falls back to an even whole-session split, and any row carrying such a portion is flagged approximate. Rows are now summable: the CLI and app footers report the attributed sum plus the unattributed remainder instead of a distinct-session total. Bumps the session cache version so surviving transcripts re-parse and populate the new per-turn field. Daily-cache versioning is untouched. * sessions: harden PR attribution and add models + category breakdown Addresses the review findings on the per-turn PR attribution and adds the model and task-category surfaces. Correctness: - Cache migration: the 5 -> 6 session-cache bump now adopts the prior v5 file's expired-source PR entries instead of abandoning them, and the claude scan preserves and surfaces PR-bearing orphans, so a session whose transcript was deleted still appears as a legacy even-split instead of vanishing. The daily cache is untouched. - Date-range carry: the parser captures the PR set active at the start of the in-range turn slice and seeds the state machine with it, so a PR referenced before the window still owns its later, in-range, ref-less turns instead of the session falling back to a whole-session approx split. - Calls are split across a multi-PR turn by largest-remainder, keeping per-PR counts whole (a 1-call, 2-PR turn no longer renders as 2 calls). - The CLI and app footers reconcile to the rounded row values actually shown. - Distinct sessions are keyed by project + sessionId, not sessionId alone. - The app tolerates an older by-reference payload (no attributedCost): it keeps the old non-summable footer and never renders NaN. Features: - Each PR contribution records the models of its calls and the turn's task category (split by the same share on a multi-PR turn); legacy even-split rows carry the model union but no category breakdown. - Payload rows gain models (short names, cost-desc) and categories (label + cost, cost-desc, omitted when empty); the payload gains otherPrCount/otherPrCost for the PRs beyond the sent top 20. - CLI --by-pr gains a Models column. The desktop table is now full-width with a Models column and click-to-expand rows showing a per-category cost breakdown with proportional bars, keyboard accessible, with an "Other (N more PRs)" row when capped. Tests: state-machine seed/models/categories/largest-remainder/dedup, the prRefs round-trip through the real incremental-append path (continuation + straddle), v5 adoption of an expired PR session, payload round-trip, and the desktop expansion/models/old-payload cases. * sessions: reconcile mixed PR rows, harden v5 adoption, bound models Round-2 review follow-ups. - Mixed legacy/live category breakdown: a PR row that combines an expired legacy contribution (even-split, no turn data) with a live per-turn contribution now emits an explicit "Legacy estimate (no per-turn detail)" category carrying the legacy share, so the expansion reconciles to the row cost instead of silently dropping it. A legacy-only row still shows no breakdown. - v5 adoption is now per cached file: one malformed entry is skipped instead of rejecting the whole v5 cache and dropping every valid expired PR session. - The desktop "Other (N more PRs)" line moved to the table footer as a muted, separated summary rather than a sorted row. - Row expansion resets when the PR set changes (period/provider/data), so a stale expansion cannot linger on a row that is gone. - Payload models per row are capped to the top 4 by attributed cost, with a name-ascending tie-break; categories get the same stable tie-break. Tests: mixed live+legacy reconciliation, legacy-only omission, model cap and tie-break, corrupt-plus-valid v5 adoption, and the desktop expansion-reset. * session-cache: validate optional agentType and failed during v5 adoption; app: reset PR expansion on period switch A v5 entry that was valid except for a malformed optional field (agentType, failed) passed per-file validation and flowed downstream as a non-string. The expansion reset keyed only on the row URL set, so a period switch that returned the same PRs kept a stale expansion open over changed numbers. --------- Co-authored-by: reviewer <review@local> |
||
|---|---|---|
| .. | ||
| indigo.css | ||
| plain.css | ||