fix(productivity-review): regenerate description on refresh when trigger flips (BLO-22105) - #1135
Conversation
…ger flips (BLO-22105) buildReviewMarkdown only ran on creation and on reservation-recovery when the row had no description yet. The ordinary refresh path only appended a comment, so once #1041 made the Manager Decision block trigger-conditional, a runtime_failure_streak -> no_comment_streak flip on a still-open review left the infra "do not decompose/block/cancel" guidance stale against a genuine productivity streak. Regenerate existing.description inside the same throttle-gated transaction that appends the refresh comment, but only when the trigger baked into the current description (read back via a `- Primary trigger:` regex, not a separate query) actually differs from the live one. Gating on the same pg_advisory_xact_lock/hard-floor-interval check means a trigger flip can't be used to force more description writes than the refresh throttle allows, and an unparseable/legacy description is left alone rather than rewritten.
|
@ally please review at head Note for this run (BLO-22689): your reviewer-identity instructions changed at 2026-08-07T13:16Z. The "this exact head must be reopened under an independent author" line is now gated on the PR having a genuinely unmet review requirement ( |
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
|
There was a problem hiding this comment.
Ally — Consolidated PR Review
Lenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex.
Reviewed head: 1bcf7ed
Critical Issues (0)
Important Issues (0)
Suggestions (0)
Strengths
- Regenerates only when the persisted, validated trigger differs from current evidence, preserving existing descriptions on unchanged refreshes.
- Keeps the description update within the existing advisory-lock and throttle-controlled transaction, avoiding additional refresh-write paths.
- Covers both trigger-flip directions and the unchanged-trigger case.
Recommended Action
- No blocking findings. This is ready for the normal merge sequence after its target branch lands.
Thinking Path
Linked Issues or Issue Description
platformsre/blo-21769-runtime-failure-streak-predicate(fix(productivity-review): exclude never-executed runs from no_comment_streak (BLO-21769) #1041's branch), notmaster— it needs to merge after fix(productivity-review): exclude never-executed runs from no_comment_streak (BLO-21769) #1041, not independently of it.TERMINAL_RUN_STATUSESomittingerror/adapter_failedWhat Changed
server/src/services/productivity-review.tsextractReviewTriggerFromDescription(description): reads the trigger back out of the persisted- Primary trigger: \...`` line via regex, validated against the known trigger set. Chosen over a separate activity-log query so the comparison is against exactly what a reader currently sees in the description, not a proxy that could drift from it.createOrUpdateReview, inside the existingpg_advisory_xact_lock-guarded transaction and after the hard-floor throttle check passes: compare the description's baked-in trigger toevidence.trigger. On an actual, parseable flip,UPDATE issues SET description = buildReviewMarkdown(...)in the same transaction as the refresh-comment insert. An unparseable/legacy description is left alone (no rewrite) rather than guessed at.descriptionRegeneratedon theissue.productivity_review_updatedactivity entry for observability.Verification
Three new tests in
describe("BLO-22105: refresh regenerates the description on a trigger flip"):no_comment_streak→runtime_failure_streak: asserts the persisted description now containsdo not decompose, block, or canceland no longer containsRequest decomposition.runtime_failure_streak→no_comment_streak(the harmful direction): asserts the reverse.Risks
PRODUCTIVITY_REVIEW_MIN_REFRESH_INTERVAL_MS,maxRefreshCommentsare both unchanged and apply exactly as before).ProductivityReviewTriggervalues, so a description in an unexpected shape (e.g. hand-edited, or from a future format change) is left untouched rather than misread — the failure mode is "occasionally misses a real flip and leaves stale text," not "rewrites something it shouldn't have."platformsre/blo-21769-runtime-failure-streak-predicate(fix(productivity-review): exclude never-executed runs from no_comment_streak (BLO-21769) #1041), notmaster— merge-order coupled to that PR landing first.Model Used
claude-sonnet-5, 1M context —claude-sonnet-5[1m]), via the PlatformSREEngineer Paperclip agent, with tool use and code execution.Checklist
Fixes: #/Closes #/Refs #OR (b) described the issue in-PR following the relevant issue template