Repository navigation
fix(factory): re-run red CI a no-op watch pass left instead of asking Claude again - #936
Merged
Merged
Conversation
… Claude again A --watch fix pass that ends `noop` on red CI now records the head SHA and the failing required checks (`ciNoop`). The next tick that sees the same red on the same head re-runs those checks in bash under the shared `ciRerun` budget (FACTORY_CI_RERUN_MAX), with no Claude run. Once the budget is spent it comments once (drafto-factory-ci-noop-hold:<sha12>), moves the card to Blocked and frees its slot. A new push re-arms the card, and so does clearing `ciNoop` by hand. Card 899 spent ten no-op passes on one head before this. pr_infra_rerun_ids now skips checks without an Actions run URL. The watch prompt describes the bash re-run instead of claiming a noop doesn't spend the budget. ADR-0100, amending ADR-0041. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h a subset of the noop reds comment_ci_noop_hold returned 1 when it couldn't read the issue's comments or post the hold notice. The --watch loop is top-level code under `set -euo pipefail`, so that ended the whole tick (every later card skipped) and fired the EXIT trap's factory-failure issue on every tick. Both transient paths now log and return 0, and the call site adds `|| true`. ci_noop_repeat now matches when the failing required checks on the recorded head are the recorded ones or some of them. Mid-re-run a tick often sees the faster job red again and the slower one still running; exact matching sent that to a Claude fix pass on a head whose CI was still re-running. rerun_infra_failures already waits on the run's status. The hold comment, runbook, dark-factory doc and ADR-0100 now say a push must be followed by dragging the card back to In Review: nothing picks cards out of Blocked. Tests: errexit harness running the hold's transient paths in a two-card loop, mid-re-run and partial-red subset cases, a red check outside the record, and the classify_failing_required pin asserted present. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- run the migration renumber gate before re-running a noop-recorded red - key ciNoop on newline-joined check names, so a comma in a matrix job's name can't split it - keep the slot when the worktree holds commits the PR lacks - name non-Actions red checks in the hold comment; word the re-run count as the head's shared ciRerun budget - clear ciNoop when --release or the Testing stage hands a red card back - prompt: noop ends fix passes for the same red checks, not the head Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-red clear Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Owner
Author
|
Changes made after the local
ADR-0102 and the runbook are updated to match. ADR number 0102 is deliberate: open PRs #929 and #931 reserve 0099 to 0101. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 16 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…-check-rerun # Conflicts: # docs/adr/README.md
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The factory session audit (watch-waste item 5a) found that a
--watchfix pass endingnoopon red CI is asked again on every tick. Card #899 (PR #915) spent ten Claude passes on one head and one red. None of them could change the outcome, and the red only needed agh run rerun --failed. ADR-0041's attempts bound stopped the loop only after the wholeFACTORY_MAX_ATTEMPTSbudget was spent.What changed
scripts/factory-agent.sh): anooppass on red CI still spends one attempt. It now also recordsciNoop = "<head sha>:<failing required check names, sorted, newline-joined (a matrix job name can contain a comma)>".classify_failing_required, a red on the recorded head SHA goes torecover_noop_red_ciwhen its failing required checks are the recorded ones or some of them. That path has no Claude run and no fix attempt.rerun_infra_failures, sharing the per-headciRerunbudget (FACTORY_CI_RERUN_MAX, default 2) and waiting while the run is in progress.comment_ci_noop_holdposts one comment per head (<!-- drafto-factory-ci-noop-hold:<sha12> -->) with thegh run reruncommands and the re-arm command. It setslastError, moves the card to Blocked and releases its slot.|| true. The--watchloop runs underset -euo pipefail, so a non-zero status there would end the whole tick and file a factory-failure issue.node scripts/lib/state-cli.mjs factory:set-issue-field <n> ciNoop "" --state-file logs/factory-state.json. ClearciReruntoo to get fresh re-runs.pr_infra_rerun_idsskips checks that have no Actions run URL.ciNoop(factory-state.mjs:emptyIssueandMUTABLE_ISSUE_FIELDS;state-cli.mjs: doc comment).factory-watch-prompt.md): it now says what anoopon red CI leads to: an attempt spent, a bash re-run, then Blocked. This replaces the stale "rather than burning the retry budget". The pinned "It is context, not a budget" sentence is unchanged.--release's red-CI hand-back and the Testing stage'sci-redhand-back clearciNoop(clear_ci_noop), so a card they send back gets its fix pass instead of going straight to Blocked. The migration renumber gate (ADR-0077) runs before the bash re-run, as it does before a fix pass.Docs
docs/adr/README.md).docs/features/dark-factory.md.Knobs and defaults
No new knob. It reuses
FACTORY_CI_RERUN_MAX(default 2), so a noop on red now costs one Claude pass and at most 2 bash re-runs before the card goes to Blocked. WithFACTORY_CI_RERUN_MAX=0, the card goes straight to Blocked on the next tick.Tests
scripts/__tests__/factory-agent-required-checks.test.mjs:ciNoop; the repeat check comes after classification (asserted present) and before the fix loop, and is called with|| trueand followed bycontinue.pr_ci_noop_keyandrecord_ci_noop(including dry run).ci_noop_repeatshould match on:ci_noop_repeatshould not match on:set -euo pipefailwith a two-card loop shaped like the watch block, the hold's transient paths (refused comment, unreadable comments) leave the card in place and the loop moves on to the next card. A mid-re-run tick waits for the run with no re-run and no Claude.comment_ci_noop_holdedge cases, including the "push and drag back" wording; a non-Actions URL inpr_infra_rerun_ids; the noop log wording.scripts/__tests__/factory-state.test.mjs:ciNoopset and clear.Run locally under macOS
/bin/bash3.2:factory-agent-required-checks.test.mjs: 78/78 pass.cd scripts && node --test __tests__/*.test.mjs): 5763/5763 pass.bash -n,pnpm lint,pnpm typecheckandpnpm format:checkpass.Rollout / live check
The factory self-updates on merge. On the next red card that gets a
noopfix pass, the logs on the following ticks should show:no-op fix pass on N failing required check(s); spending one attemptre-running them in bash, no Claude run (ADR-0102)still red after 2 re-run(s); moving to Blocked, followed by the hold comment.Rollback: revert on main, or
node scripts/lib/state-cli.mjs factory:pause.🤖 Generated with Claude Code