Repository navigation
fix(ci): skip stale auto-fix runs and guard publication - #1791
Open
Abhigyan-Shekhar wants to merge 2 commits into
Open
Abhigyan-Shekhar wants to merge 2 commits into
Abhigyan-Shekhar wants to merge 2 commits into
Conversation
Abhigyan-Shekhar
marked this pull request as ready for review
October 11, 2026 03:42
Contributor
|
Note Production impact unlikely. Documentation, test, or CI-only change; nothing that runs in production is affected. Polylane analysed Rate this review: 👍 helpful · 👎 not helpful · 😕 confusing |
This branch has not been 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.
Fixes #1788.
When CI for source commit H fails after the PR has advanced to N, auto-fix currently checks out N and attempts to repair H's failure. This change pins editing to H, skips stale runs, and refuses to publish a fix if the branch changes while Claude works.
The workflow resolves the PR from run metadata, falling back to a single open PR for the recorded branch when GitHub returns an empty
pull_requestslist (observed on recent same-repository CI runs). It checks the live PR against the run's immutablehead_shabefore editing and publication. Linked PR head metadata is never used as the recorded source SHA.Claude receives a read-only GitHub token. A separate publishing job applies its patch to H and pushes with an explicit
--force-with-lease=refs/heads/<branch>:H, so Claude cannot bypass the revision guard by pushing directly. Branch movement, including a race during push, skips publication; unrelated push failures still fail the job. Workflow helpers come from the immutable workflow-run default-branch SHA.PR CI still tests a synthetic merge commit. The prompt distinguishes that from H and directs Claude to the failed logs for merge-specific failures.
Validation: 25 Node regression tests pass, including real local Git publication races and empty PR-metadata lookup; Biome, actionlint (without ShellCheck), and
git diff --checkpass. The tests run in regular CI. Only the auto-fix workflow, its helper/tests, and the test invocation are changed.Operational limitation: the publisher uses
GITHUB_TOKEN. Under GitHub's current rules, resulting PR CI requires a repository writer to approve the workflow runs; it is not an unattended CI retrigger. Preserving unattended retriggers would require an appropriate publishing App/PAT credential. No new credential setup is included in this fix.The secret-backed Claude workflow has not been executed live.
workflow_runchanges take effect after merge to the default branch.