Skip to content

fix(pr-bot-review): let a fold run fold a review on an unchanged head - #28

Merged
ken-b4m merged 2 commits into
mainfrom
fix/pr-bot-review-fold-runs
Sep 30, 2026
Merged

ken-b4m merged 2 commits into
mainfrom
fix/pr-bot-review-fold-runs

Conversation

@ken-b4m

@ken-b4m ken-b4m commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

With changeset_guard: true, the substantive-change guard skips a run when the head is unchanged since the last bot review. So applying the fold label right after a review never folded anything. It also posted a comment blaming changeset commits that did not exist.

Fold runs now skip the guard. Every downstream step tests steps.substantive.outputs.skip != 'true', so a skipped guard reads as not-skip.

Found on a canary run in a caller repo. actionlint reports the same 8 pre-existing errors on main and on this branch (stale action metadata for client-id and newer context fields); none is on the changed lines.

With changeset_guard on, the substantive-change guard skipped any run whose
head matched the last bot review. A fold straight after a review on the same
head is the normal flow, so it never ran, and the skip comment blamed changeset
commits that did not exist. Fold runs now bypass the guard; downstream steps
already treat a skipped guard as not-skip.

@ken-b4m ken-b4m left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: fix(pr-bot-review): let a fold run fold a review on an unchanged head

Assessment: APPROVE with comments (posted as a comment, since GitHub refuses an approval on your own PR). This is a self-review.

The fix is correct and I found nothing blocking. Two P3 items, both on the changed line, worth folding in before merge:

  1. P3 .github/workflows/pr-bot-review.yml:257 - the new conjunct reads inputs.fold_mode != true. Change it to env.FOLD_MODE != 'true'. Disposition: Fold in.
  2. P3 .github/scripts/checkBotFoldWritePath.test.mjs - nothing pins the new conjunct. Add an ifConjuncts(src, 'Substantive-change guard - skip changeset-only re-reviews') assertion. Disposition: Fold in.

CI: 5/5 checks green at 53e2a8cf. Mergeable: yes, 0 commits behind main. Prior reviews: none. Requirements source: none (canary finding, described in the PR body).

Findings in full
P3 - .github/workflows/pr-bot-review.yml:257 - gate reads the input, not env.FOLD_MODE

The job-level comment at .github/workflows/pr-bot-review.yml:187-190 makes FOLD_MODE the single source of truth for the run mode: "Every fold-gated if: and both tool lists read this instead of repeating the input, so a gate added later cannot be twinned wrong." Every other fold gate in the file uses env.FOLD_MODE == 'true' (lines 782, 803, 1102, 1148, 1166, 1331, 1376). This line is the first to read inputs.fold_mode directly.

It is behaviourally equivalent today: the input is type: boolean (line 59), and env.FOLD_MODE is its string rendering. So there is no bug. The cost is that the convention the file states is no longer true of the file.

Change: if: inputs.changeset_guard == true && env.FOLD_MODE != 'true' && steps.size_check.outputs.skip == 'false'. The env context is available in a step if:, as the other gates show.

P3 - .github/scripts/checkBotFoldWritePath.test.mjs - the new conjunct is unpinned

The suite pins fold gates as conjunct sets by value (ifConjuncts, e.g. the Mint fold push token assertion near line 2846). Its own comment explains why: a substring check cannot see || true neutralising a gate. Removing the new conjunct would pass the whole suite today and silently reintroduce the canary bug.

Change: add an assertion that the guard step's conjuncts equal ["inputs.changeset_guard == true", "env.FOLD_MODE != 'true'", "steps.size_check.outputs.skip == 'false'"] (adjusted if you keep the input form).

Verified and clean
  • Downstream steps stay live on a fold run. With the guard skipped, steps.substantive.outputs.skip is empty. Every consumer tests != 'true' (lines 323, 334, 387, 394, 425), so an empty output reads as not-skip. The one == 'true' consumer, the "Note changeset-only skip" comment at line 305, now cannot fire on a fold run. That removes the misleading comment the PR body describes.
  • Guard logic otherwise unchanged. The LAST = HEAD_SHA early emit true at line 292 is exactly the path a fold run right after a review hits, so the root-cause reading in the PR body holds.
  • No new loop risk. A fold run's own push lands commits not authored by the changeset bot, so the guard would have emitted false on the follow-up run before this change too.
Method

Inline review, no lenses: surface is +3/-1 in one file, and no escalation clause fires (no security, authz, money or migration surface; no invariant premise removed). Ops check done in the same pass: the change is itself CI config, and all five check runs at the head SHA concluded success. I read the guard step, every steps.substantive consumer, the fold_mode input, the FOLD_MODE env comment, and the ifConjuncts tests. I did not run actionlint; the PR body's claim of 8 pre-existing errors off the changed lines is unverified by me.

@ken-b4m
ken-b4m marked this pull request as ready for review September 30, 2026 16:57
Reads env.FOLD_MODE like every other fold gate, pins the condition with ifLine, and notes the fold exception in the changeset_guard description.
@ken-b4m
ken-b4m merged commit d76f1c2 into main Sep 30, 2026
5 checks passed
@ken-b4m
ken-b4m deleted the fix/pr-bot-review-fold-runs branch September 30, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant