Repository navigation
Description
RE-SCOPED 2026-08-31 by the maintainer after the
timeoutescalation (run33433995544, 2701s vs a 2700s budget).
Per dev-lead's own escalation guidance, this issue is now slice 1 of 2 and covers only the pure helper library. The wiring intodev-lead-fix-reviews.shmoved to the follow-up issue linked at the bottom. Do not modifyscripts/dev-lead-fix-reviews.shin this issue.
This is the same re-scoping that unblocked#1589after an identical timeout.
SCOPE OF THIS ISSUE (slice 1) — the pure library only
Add scripts/lib/resolution-integrity.sh, a pure, side-effect-free helper. No network calls, no git invocations, no gh invocations, no sourcing of other dev-lead libs.
Required function:
ri_may_resolve <sha_before> <sha_after>
- Returns 0 (may resolve) iff both arguments are non-empty AND they differ.
- Returns non-zero (must not resolve) in every other case — including either argument empty, both empty, or the two equal. Fail closed.
- No output on stdout other than what the tests below assert; no
exit(it is sourced, soreturn).
Acceptance criteria
-
scripts/lib/resolution-integrity.shexists, isshellcheck-clean, and is safe tosourceunderset -euo pipefail. -
ri_may_resolveimplements exactly the truth table above. - Unit tests in
tests/dev-lead/unit/test_resolution_integrity.batscovering, at minimum: both empty → deny;beforeempty → deny;afterempty → deny; equal SHAs → deny; differing SHAs → allow. - The file declares each function exactly once (
grep -c '^ri_may_resolve()'→1). This issue exists because of the#1485duplicate-declaration class; do not reintroduce it. - No other file is changed. In particular
scripts/dev-lead-fix-reviews.shis untouched.
Keeping the helper pure is deliberate: it is the part that can be exhaustively unit-tested without a PR fixture, and it is what makes slice 2 small.
Why this is needed — the incident record (context, not scope)
Third occurrence — and this one defeated the gate on a fleet-breaking change
The fix for this class merged at 13:34Z (#1604 → 9b3bc2b0) and a more severe instance occurred at 14:03Z, on petry-projects/.github#1024.
Between 14:00Z and 14:03Z, all 18 open threads on #1024 went to resolved — clean thread surface, REVIEW_REQUIRED, one approval from merge. No commit was made: head unchanged at 30375c5c, verified at that SHA via the contents API:
bash -n scripts/apply-repo-settings.sh → line 498: syntax error near unexpected token `}'
grep -c '^_watched_paths()' canary-rollout.sh → 2
grep -c '^ensure_required_labels()' compliance-audit.sh → 3
The resolved set included a 🔴 Critical thread on the unmatched brace. All 28 threads were reopened; the merge is re-blocked and dev-lead:hands-off is applied.
Severity is materially higher than the earlier cases
The two occurrences on #1021 cost review cycles. This one would have merged:
scripts/apply-repo-settings.shunparseable — it drives the fleet-wide apply-repo-settings workflow delivered hours earlier by#984/#985. Every scheduled run org-wide would fail at parse.- The
#1485trunk-corruption class intopetry-projects/.github— the one org-infra repo with noduplicate-decl-gate(petry-projects/.github#1025).
The gap in the shipped fix (root cause, confirmed)
#1604/#1567 moved the bar to "the commit is non-trivial AND touches the regions the review named" — but that is an evidence check on the status=applied claim only (scripts/lib/review-change-evidence.sh, finalize_review_application).
It does not gate thread resolution. In scripts/dev-lead-fix-reviews.sh, the three resolution nets — resolve_bot_outdated_threads, resolve_actor_outdated_threads, and resolve_addressed_bot_threads — run in the no-changes path as well as the applied path (fix-reviews, fix-bot-comment, review-changes). resolve_addressed_bot_threads (#1547) resolves a non-outdated bot thread purely on a reply marker with no commit required — the exact vector that resolved the Critical brace thread.
This incident produced no commit and no status=applied claim at all; the threads were simply marked resolved.
Follow-up slices (do NOT implement here)
- Slice 2 — wiring (Follow-up to #1609 (slice 2): gate dev-lead thread resolution on the pass having advanced the PR head #1617): source the lib in
scripts/dev-lead-fix-reviews.sh, addresolution_gate_open, and wrap the threeresolve_*call sites in thefix-reviews/fix-bot-comment/review-changesintents; emit a::notice::naming this issue when resolution is skipped; update the existing tests that assert resolution in a no-commit pass. - Slice 3 (not yet filed) — pr-review-side invalidation: an approval is void if threads were resolved with no intervening head change. This is the control that would have caught all three occurrences independently.
Related: #1596, #1607, #1610, petry-projects/.github#1024, petry-projects/.github#1025.
Activity
github-actions commentedon Aug 31, 2026
Thank you for the thorough write-up and for catching this before the merge went through — the near-miss on
#1024makes the severity very clear. To confirm the scope of the fix needed: can you clarify whether thepr-reviewfix pass currently has any check that a thread may only transition to resolved when the head SHA has changed since the finding was recorded, or does the shipped guard in#1604only fire when astatus=appliedclaim is present?don-petry commentedon Aug 31, 2026
Dev-Lead Implementation Plan
Issue: #1609 — Follow-up to #1567: threads resolved with NO commit at all — the shipped evidence bar gates status=applied, not thread resolution
Scope
Confirm the #1604 gap and close it: gate all auto-resolution of review threads in
dev-lead-fix-reviews.shon the fix pass having advanced the PR head this pass (a new commit was created + pushed). A pass that produces no commit resolves zero threads — the near-miss onpetry-projects/.github#1024, where 18 open threads (incl. a 🔴 Critical unmatched-brace finding) were marked resolved with the head unchanged and no commit.Root cause (confirmed)
#1604's evidence check (review-change-evidence.sh) only gates thestatus=appliedclaim. The three thread-resolution nets —resolve_bot_outdated_threads,resolve_actor_outdated_threads,resolve_addressed_bot_threads— run in the no-changes path too (fix-reviews L1485-91, fix-bot-comment L1530-36, review-changes L1602-07).resolve_addressed_bot_threads(#1547) resolves a non-outdated bot thread purely on a reply marker, with no commit required — the exact vector that resolved the Critical brace thread.Implementation Checklist
scripts/lib/resolution-integrity.sh(ri_resolution_permitted/ head-advance decision) — no network/git side effectsresolve_*calls on "this pass advanced the head" (commit_and_push returned 0) in all three intent branches ofscripts/dev-lead-fix-reviews.sh; emit a::notice::naming Follow-up to #1567: threads resolved with NO commit at all — the shipped evidence bar gates status=applied, not thread resolution (near-miss: fleet-breaking merge on .github#1024) #1609 when resolution is skippedtests/dev-lead/unit/test_fix_reviews.batsthat assert resolution/announcement in a no-commit pass (now a declared defect) to the new specTests to Write
tests/dev-lead/unit/test_resolution_integrity.bats— pure helper: allow when head advanced, deny (fail-closed) when not / unknownTest Command
bats tests/dev-lead/unit/and the repo bats suite viascripts/run-bats.sh; lint viabash .dev-lead/scripts/dev-lead-lint.shNote on AC #4
The pr-review-side approval invalidation ("an approval is void if threads were resolved with no intervening head change") is framed as "Consider" in the issue; the dev-lead-side gate above closes AC #1–#3 at the source. AC #4 is recorded as a follow-up rather than built in this pass to keep scope to what the issue requires.
don-petry commentedon Aug 31, 2026
Dev-Lead: issue #1609 implementation failed — will retry
All engines were rate-limited. This was attempt 1 of 3; dev-lead will retry automatically. You can also re-apply the
dev-leadlabel to retry now.rate-limitedLast 40 lines of engine output (redacted)
at throwErrorIfNotOK (file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:267240:24) at process.processTicksAndRejections (node:internal/process/task_queues:103:5) at async file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:267003:7 at async Models.generateContentStream (file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:268099:16) at async file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:310468:19 at async file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:287277:23 at async retryWithBackoff (file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:307305:23) at async GeminiChat.makeApiCallAndProcessStream (file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:331095:28) at async GeminiChat.streamWithRetries (file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:330848:29) at async Turn.run (file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:331770:24) { status: 429 } Attempt 10 failed: Your prepayment credits are depleted. Please go to AI Studio at https://ai.studio/projects to manage your project and billing. Learn more at https://ai.google.dev/gemini-api/docs/billing#prepay. . Max attempts reached Error when talking to Gemini API Full report available at: /tmp/gemini-client-error-Turn.run-sendMessageStream-2026-08-31T14-40-46-128Z.json RetryableQuotaError: Your prepayment credits are depleted. Please go to AI Studio at https://ai.studio/projects to manage your project and billing. Learn more at https://ai.google.dev/gemini-api/docs/billing#prepay. at classifyGoogleError (file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:306592:14) at retryWithBackoff (file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:307328:29) at process.processTicksAndRejections (node:internal/process/task_queues:103:5) at async GeminiChat.makeApiCallAndProcessStream (file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:331095:28) at async GeminiChat.streamWithRetries (file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:330848:29) at async Turn.run (file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:331770:24) at async GeminiClient.processTurn (file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:345315:22) at async GeminiClient.sendMessageStream (file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/chunk-7HKQGPWB.js:345412:14) at async file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/gemini-OYYGXMHL.js:11527:26 at async main (file:///home/runner/.npm-global/lib/node_modules/@google/gemini-cli/bundle/gemini-OYYGXMHL.js:16954:5) { cause: { code: 429, message: 'Your prepayment credits are depleted. Please go to AI Studio at https://ai.studio/projects to manage your project and billing. Learn more at https://ai.google.dev/gemini-api/docs/billing#prepay. ', details: [] }, retryDelayMs: undefined, status: 429 } { "session_id": "c88bc728-2797-49e2-a00a-d44cf50d616b", "error": { "type": "Error", "message": "Your prepayment credits are depleted. Please go to AI Studio at https://ai.studio/projects to manage your project and billing. Learn more at https://ai.google.dev/gemini-api/docs/billing#prepay. ", "code": 429 } }don-petry commentedon Aug 31, 2026
Dev-Lead Implementation Plan
Issue: #1609 — Follow-up to #1567: threads resolved with NO commit at all — the shipped evidence bar gates status=applied, not thread resolution
Root cause
The #1604/#1567 evidence bar (
scripts/lib/review-change-evidence.sh,finalize_review_application) gates thestatus=appliedclaim on a substantive commit that touches the reviewed regions. But it does not gate thread resolution. Indev-lead-fix-reviews.sh,resolve_bot_outdated_threads,resolve_actor_outdated_threads, andresolve_addressed_bot_threadsrun in both the applied and the no-changes paths (fix-reviews, fix-bot-comment, review-changes). A pass that makes no commit can still mark threads resolved — exactly the.github#1024near-miss (head unchanged, 18 threads incl. a Critical resolved).Scope
Add a pass-level resolution-integrity gate: a dev-lead fix pass may auto-resolve review threads only when it advanced the PR head (a commit landed since the finding). A no-commit pass resolves zero threads.
Implementation Checklist
scripts/lib/resolution-integrity.sh— new pure helperri_may_resolve <sha_before> <sha_after>(allow iff both non-empty AND differ; fail closed otherwise).scripts/dev-lead-fix-reviews.sh— source the lib; addresolution_gate_open <cp_rc>(dry-run passes through so functions still announce; else comparesHEAD_SHApre-head togit rev-parse HEADpost-head, falling back tocp_rc==0only when a SHA is unavailable).resolve_*call sites in the fix-reviews, fix-bot-comment, and review-changes intents with the gate; emit a::notice::when resolving zero threads. Capturecp_rcin review-changes.Tests to Write
tests/dev-lead/unit/test_resolution_integrity.bats— unit tests forri_may_resolve(differ→allow; equal→deny; empty operand→deny).tests/dev-lead/unit/test_fix_reviews.bats— AC Add @claude delegation, auto-merge, and rebase handling #3 integration: a fix pass that makes no change (HEAD_SHA == real head) asserts noresolveReviewThreadmutation; positive control where a commit advances the head still resolves.Test Command
bats tests/dev-lead/unit/test_resolution_integrity.bats tests/dev-lead/unit/test_fix_reviews.bats tests/dev-lead/unit/test_review_change_evidence.batsthenbash .dev-lead/scripts/dev-lead-lint.shdon-petry commentedon Aug 31, 2026
Dev-Lead: cannot implement issue #1609 — needs human attention
A stage timed out (exit 124) while implementing this issue. A timeout is treated as a first-class, non-retryable condition — retrying with the same budget would just time out again — so this escalates for human review on the first occurrence instead of wasting a same-budget retry.
timeoutThis hit the max action budget. Split this issue into smaller, independently-implementable pieces, or raise
vars.ACTION_TIMEOUT_SEC, then re-apply thedev-leadlabel.don-petry commentedon Aug 31, 2026
Dev-Lead Implementation Plan
Issue: #1609 — Follow-up to #1567: threads resolved with NO commit at all — add the pure
resolution-integrity.shhelper (slice 1 of 2)Scope
Add
scripts/lib/resolution-integrity.sh, a pure, side-effect-free helper exposingri_may_resolve <sha_before> <sha_after>that fails closed (returns 0 only when both SHAs are non-empty AND differ). No wiring intodev-lead-fix-reviews.sh— that is slice 2 (#1617).Implementation Checklist
scripts/lib/resolution-integrity.sh— pure,set -euo pipefail-safe to source, no network/git/gh/other-lib deps,ri_may_resolvedeclared exactly oncetests/dev-lead/unit/test_resolution_integrity.batsscripts/dev-lead-fix-reviews.shuntouched); new test auto-runs viatest-dev-lead.yml'sbats tests/dev-lead/unit/globTests to Write
beforeempty -> denyafterempty -> denyri_may_resolvedeclared exactly once (grep -c '^ri_may_resolve()'-> 1)set -euo pipefailTest Command
bats tests/dev-lead/unit/test_resolution_integrity.batsandbash .dev-lead/scripts/dev-lead-lint.shdon-petry commentedon Aug 31, 2026
Dev-Lead: Progress (in progress — not yet durable)
Plan Execution (intended)
scripts/lib/resolution-integrity.shexposingri_may_resolve <sha_before> <sha_after>(fail-closed: allow only when both SHAs are non-empty AND differ; no network/git/gh/other-lib deps;return-only, source-safe underset -euo pipefail).tests/dev-lead/unit/test_resolution_integrity.batscovering the full truth table (both empty / before empty / after empty / equal → deny; differing → allow) plus source-safety and the single-declaration guard.Local check output (provisional — not the pushed run)
Files touched (this workspace, not yet pushed)
scripts/lib/resolution-integrity.sh: new pure helper (slice 1 only).tests/dev-lead/unit/test_resolution_integrity.bats: new unit tests (auto-run bytest-dev-lead.yml'sbats tests/dev-lead/unit/glob — no CI list edit needed).Notes
scripts/dev-lead-fix-reviews.shis untouched; only the two files above changed. Wiring (resolution_gate_open+ the threeresolve_*call sites) is slice 2 (Follow-up to #1609 (slice 2): gate dev-lead thread resolution on the pass having advanced the PR head #1617).don-petry commentedon Aug 31, 2026
Dev-Lead: Implementation Complete — PR #1618
The implementation for issue #1609 is durable: commits are pushed and a pull request is open. This record is backed by verifiable artifacts you can confirm in one click.
e6d6f9d71e76bf3b88df4ccce7bbeb70b084f750Review happens on the PR. Acceptance criteria and test results are evidenced by the PR's diff and CI checks — not asserted here. If a later stage fails, this claim is retracted in place.
feat: implement issue #1609 — Follow-up to #1567: threads resolved wi…
feat: implement issue #1617 — Follow-up to #1609 (slice 2): gate dev-…