Skip to content

feat(pr): attribute PR work honestly and show one shot, review runs and follow-ups - #1733

Merged
iamtoruk merged 7 commits into
mainfrom
feat/pr-insights-ui
Oct 10, 2026
Merged

iamtoruk merged 7 commits into
mainfrom
feat/pr-insights-ui

Conversation

@iamtoruk

Copy link
Copy Markdown
Member

Pull requests view: honest attribution plus what each PR actually took.

Attribution fixes (money moves between PRs, totals unchanged):

New per-PR fields (local only, no GitHub calls), each with an unknown state: oneShot / followUpRounds (pushes after gh pr create, 10-minute bursts; contributor PRs show "your follow-ups: N"), reviewRuns (a run that read the PR and committed nothing, or gh pr review N) with cost, mergedAt / timeToMergeMs, costSplit (building / review runs / after first review, sums to cost), linkEvidence ("linked by pr-link only"). Session why gets a prWork block.

Desktop: one facts line per PR card ("Reviewed by Opus 5.5 run ($1.40) · Your follow-ups: 1", "One shot"), "N runs", a by-phase split and review runs when expanded, a "PR work" panel in the session view; 6 locales.

Checked against GitHub (read-only): one-shot and round counts agree on 13/13 PRs where the open and head were seen. Limits: failed pushes still count; opens/merges run through scripts or shell variables show as not seen; "after first review" can include work after the merge.

Verified: 7 new pr-insights tests (fail before / pass after), 38 parser/sessions/session-why/attribution files 458 passed, renderer PullRequests 28, SessionView 11, i18n 12; full suite 5,128 passed in the integration run. Speed: subagent descriptions are read only for PR attribution, memoized per file; report at parity with main (4.117 s vs 4.100 s warm); a full uncached menubar payload is ~0.3 s slower because it now computes the PR card signals.

A subagent run folded into whatever PR its parent's last pr-link carried, so
review runs for #1703, #1712, #1728 and #1729 landed on a stale closed #24.
The Agent description ("Review PR 1729 ...") is now read from the subagent's
.meta.json at report time; a single PR it names outranks the carried PR.
Every PR row carried the whole session's first and last timestamp, so one
long orchestrator session stamped the same span and "1 session" on all of
them. Rows now span their first to last attributed turn or folded run, and
a new `runs` field counts contributing sessions plus folded subagent runs.
…nd cost split per PR

Each PR row now carries signals read from cached commands, no GitHub calls:
openedAt (gh pr create paired with the PR's first pr-link), follow-up rounds
(pushes naming its --head branch, or from a run whose description names it,
in 10-minute bursts), oneShot only when the open and its branch were seen,
reviewRuns and reviewCostUSD, mergedAt and timeToMergeMs, a build/review/fixes
cost split that sums to the row, and linkEvidence to flag pr-link-only rows.
… review runs

The why view now carries prWork: each gh pr create whose output printed a PR
URL, the pushes after it on its --head branch (or from a helper whose
description names that PR) in 10-minute rounds, and the helpers that read a
PR without committing or pushing, with their cost.
Each PR card gets one line of facts from the CLI's local signals: the review
run and its cost, one shot or follow-up rounds, and merge time after open.
Unknowns are left out; a pr-link-only row says so. The count shows agent runs
instead of sessions. The expanded card splits spend into building, review runs
and after first review, and lists the review runs. The session view lists the
PRs it opened and the review runs it spawned.
Every report, status and menubar refresh read each subagent's .meta.json
(about 2,000 files in 30 days) and the cross-provider correlation scanned
every folded run's commands for PR signals it never uses. Sessions now carry
the sidecar path; the description is read on demand, memoized by mtime, only
for folded runs and runs that push, and correlation skips the command scan.
The by-pr footer now counts runs to match the Runs column.
@iamtoruk
iamtoruk merged commit 4877345 into main Oct 10, 2026
23 checks passed
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