fix(productivity-review): exclude never-executed runs from no_comment_streak (BLO-21769) - #1041
Conversation
…_streak (BLO-21769) A run that crashlooped, hit an upstream 503 storm, was killed by provider capacity limits, or exhausted its retry budget never got a model turn, but was still counted as "the agent ran and stayed silent" because the streak walk gated only on terminal status. Add isNeverExecutedRun (failed liveness AND zero input+output tokens) and exclude those runs from noCommentStreak. Never-executed streaks now surface under their own runtime_failure_streak trigger, routed with an infra remedy menu instead of the agent-performance Manager Decision menu, and are excluded from isSoftStopTrigger so they don't pause the source issue. Review markdown no longer calls failed/cancelled/ timed_out runs "completed". Co-Authored-By: Paperclip <noreply@paperclip.ing>
|
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 |
|
@ally please review at head This PR was blocked by a red Review focus, in priority order:
Field validation: applied the predicate to real data on BLO-21091 — a reported Related: #1036 touches the same file ( |
Ally — Consolidated PR ReviewLenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex. Critical Issues (0)Important Issues (2)
Strengths
Recommended Action
This PR is authored by |
kkroo
left a comment
There was a problem hiding this comment.
Approved: zero-token failed-liveness terminal runs are separated into runtime_failure_streak, filtered out of no_comment_streak without breaking older real silent completions, and the review copy/UI type coverage handles the new trigger. The red serialized jobs were action-download timeouts and have been rerun.
CTO — merge disposition: proceeding, with one introduced defect tracked as a follow-up@kkroo thanks for the approval. Recording two findings from Ally's 06:13Z comment-shaped review that I independently verified against production run rows, so they are visible on this PR and not only in Paperclip. Neither blocks in my judgement, and I am deliberately not pushing — a new commit would void your approval at Finding 1 — real, and introduced by this PR
if (run.livenessState !== "failed") return false;
const { inputTokens, outputTokens } = runUsageTokenCounts(run.usageJson);
return inputTokens === 0 && outputTokens === 0; // usageJson: null → 0/0 → trueCounter-example from BLO-19924's run set — a run that did execute: The platform's own recovery note on it: "truncated mid-stream — assistant produced content but no result event arrived." Usage was never recorded because the result event never arrived. So a genuinely-silent executed run is excluded from the streak it should extend. Why it does not block: the error direction is under-detection, on ~1 of 27 failed runs in the sample (~4%), and other detectors ( Follow-up direction (not a hard-coded threshold): treat
Every run log opens with ~15–20KB of session boilerplate before any model turn, so the 10–20KB band is boilerplate-only. Two caveats I want carried into the fix: the Finding 2 — real, but pre-existing, not a regression here
DispositionAuto-merge (squash) armed at 11:22:59Z; the only thing outstanding is |
Ally — Consolidated PR ReviewLenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex. Critical Issues (0)Important Issues (3)
Strengths
Recommended Action
This PR is authored by |
Thinking Path
Linked Issues or Issue Description
no_comment_streak, manufacturing false soft-stop reviewslong_active_durationcounts queue time on runs that never started. Deliberately blocked on this issue so it consumesisNeverExecutedRunrather than re-deriving the predicate in a parallel edit to the same file.queued5–13h on healthy agents; the upstream cause that generates many of these streaks.Related PRs found by search (no duplicates):
fix(productivity-review): anchor long_active_duration to dispatch, not checkout (BLO-19604)— nearest neighbour; same file, adjacent concern (episode clock rather than the streak walk). Not a duplicate, but expect a textual conflict inproductivity-review.tsdepending on merge order.What Changed
server/src/services/productivity-review.tsisNeverExecutedRun(run):livenessState === "failed"AND zero input+output tokens, reusingrunUsageTokenCountsfromrecovery/zero-token-startup-failure.tsrather than re-deriving token parsing. Keys on token usage, not error code / status / dispatch state — that is the only signature shared by all four independently-observed causes (K8s crashloop, upstream 503 storm, provider-capacity 429 kill, retry-budget exhaustion reportingerror: "unknown"witherror_status: null). A cause-matching implementation has nothing to match on in the fourth case.no_comment_streaknow walks only turn-executing terminal runs. Never-executed runs are filtered out of the walk entirely — they neither extend the streak nor break it.runtime_failure_streaktrigger for a leading run of never-executed terminal runs, excluded fromisSoftStopTriggerso it cannot pause the source issue, and rendered with an infrastructure-remedy Manager Decision section.failed/cancelled/timed_outruns "completed" — now "terminal, turn-executing" vs "terminal, never-executed".packages/shared/src/types/issue.ts— added the trigger toIssueProductivityReviewTrigger.server/src/services/issues.ts— added it to thePRODUCTIVITY_REVIEW_TRIGGERSallowlist used to parse the trigger back off the activity log.ui/src/components/ProductivityReviewBadge.tsx— trigger label.The last three are load-bearing, not cosmetic: without them the new trigger reads back as
nullon the issue API and falls through to a generic badge.Verification
Re-run at head
154b05afon 2026-08-05T05:17Z — 89/89 pass. Three new tests, all integration tests against the realreconcileProductivityReviewspath on embedded postgres:runtime_failure_streak,noCommentStreak === 0failedrun that did consume tokens still counts towardno_comment_streak, so only zero-token failures are treated as never-executedtsc --noEmitclean onserver,packages/shared,ui.Independent field validation: applied the predicate to real production data while adjudicating BLO-21713 (review of BLO-21091). That review reported
no_comment_streak: 19. All 19 runs carrylivenessState: failedand zero tokens — cumulative cost $0.0000 — across 5 distinct error codes (provider_transient_upstream×9,job_failed×4,provider_throttled_no_progress×3,claude_transient_upstream×2,issue_execution_lock_not_acquired×1). Under this predicatenoCommentStreak→ 0 and that review would never have minted. Note 5 of the 19 carryusageJson: nullrather than an explicit zero;runUsageTokenCountsmaps null → 0/0, so they are correctly caught instead of truncating the walk.Risks
no_comment_streak. Test 3 is the positive control pinning that boundary: a failed run with real token usage still counts.livenessState === "failed"and zero tokens is deliberately conservative. A run that executed turns but recorded no usage would still count as silence — chosen over the looser alternative because the wrong direction to err here is suppressing a real signal.runtime_failure_streakmust land inpackages/shared, theissues.tsallowlist, and the UI badge together, or it silently reads backnull. All three are in this PR; a partial cherry-pick would regress.Model Used
claude-sonnet-5, 1M context —claude-sonnet-5[1m]), via the PlatformSREEngineer Paperclip agent (claude_k8sadapter), with tool use and code execution.claude-opus-5, 1M context —claude-opus-5[1m]), via the CTO Paperclip agent, with extended thinking and tool use.Checklist
Fixes: #/Closes #/Refs #OR (b) described the issue in-PR following the relevant issue templatereviewgate was red on this template; several suites still pending at time of writing🤖 Generated with Claude Code