fix(productivity-review): derive active duration from run execution, not checkout (BLO-22016) - #1047
Conversation
1 similar comment
|
Hey @allyblockcast[bot]! Before this PR can be reviewed, a few things need attention: Missing or incomplete:
Once updated, push a new commit and these checks will re-run automatically. — commitperclip |
…not checkout (BLO-22016) `elapsedMs` was computed from issue.startedAt (stamped at checkout) or executionLockedAt, so a run that sat queued for hours before dispatch counted as "active" work and tripped false-positive long_active_duration reviews (BLO-18846 / run 9e49405e: ~17.75h queued, 0 tokens executed). Anchor the active episode to the earliest run that has actually started executing since the current checkout instead. A queued-but-never-executed run now yields no active duration; a genuinely long-running or stalled executing run still trips the threshold. Co-Authored-By: Paperclip <noreply@paperclip.ing>
bdfb54f to
192a941
Compare
kkroo
left a comment
There was a problem hiding this comment.
Reviewed the rebase and merged behavior. active duration now starts from started heartbeat runs since checkout, while the existing BLO-19848 non-live holder and resumed-park clamps remain in place. New tests cover queued-never-started, zero-run, and started-run control cases. Local server typecheck passes; embedded Postgres productivity tests are skipped in this local worktree and left to CI.
Ally — Consolidated PR ReviewLenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex. Important Issues (1)
Strengths
Recommended Action
This PR is authored by |
Thinking Path
Linked Issues or Issue Description
9e49405equeued for roughly 17.75h with no tokens executed before the false-positivelong_active_durationreview.BLO-22016; only this PR matched.What Changed
server/src/services/productivity-review.tsnow derives the active episode start from the earliestheartbeatRuns.startedAtsince the current checkout.startedAt: null, and checked-out issues with no run rows, produce no active duration instead of accumulating checkout wall time.server/src/__tests__/productivity-review-service.test.tsseeds explicit active runs for aged fixtures by default, withactiveRun: falsefor queued/no-run cases.Verification
pnpm --filter @paperclipai/server exec vitest run src/__tests__/productivity-review-service.test.tscompleted locally; embedded Postgres tests are skipped in this worktree environment.pnpm --filter @paperclipai/server typecheckpassed.git diff --check origin/master...HEADpassed.Risks
Low-to-medium. This narrows
long_active_durationto execution time instead of checkout time. The main risk is undercounting an unusual in-progress issue that has no started heartbeat run, but that is the safer direction for a detector whose failure mode was firing on work that never executed. Real long-running started runs and master’s non-live holder clamps remain covered.Model Used
master, updated the PR body, and ran local verification.Checklist
Fixes: #/Closes #/Refs #OR (b) described the issue in-PR following the relevant issue template