fix(claude-autofix): run failing-checks fixes via repository_dispatch and cover CI failures (PT-289) - #72
Draft
donnfelker wants to merge 2 commits into
Draft
fix(claude-autofix): run failing-checks fixes via repository_dispatch and cover CI failures (PT-289)#72donnfelker wants to merge 2 commits into
donnfelker wants to merge 2 commits into
Conversation
… and cover CI failures PT-289
The fix-failing-checks job ran on check_suite, an event claude-code-action
rejects ("Unsupported event type: check_suite"). The GITHUB_EVENT_NAME
override from #70 never applied: GitHub forbids overriding GITHUB_* vars,
so the runner re-set the real value after the env block. The job also set
track_progress, which the action only allows on PR/issue events, so it
would have crashed on the next check regardless.
Split the job. dispatch-failing-checks runs on check_suite (third-party
check apps) and workflow_run (the caller's CI workflows; GitHub never
fires check_suite for Actions suites, so CI failures were never reachable
before). It resolves the PR, applies the fork/kill-switch/staleness/
self-exclusion/allowed_bots gates and raises a repository_dispatch.
fix-failing-checks runs on that dispatch, re-validates PR state and the
failing-check invariant from the live API, sanitises the payload, and runs
the action.
Callers must add workflow_run and repository_dispatch triggers and adopt
the new concurrency group; see the trigger template and changeset.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Claude autofix run failed while fixing CI (error, not a normal stop). See the run log: https://github.com/0xPolygon/pipelines/actions/runs/34648379163 |
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Problem
fix-failing-checksinai-platform-claude-autofix.ymlhas never run. Ticket: PT-289.check_suite, whichclaude-code-actionrejects before Claude starts (Unsupported event type: check_suite). The action's accepted list at the pin (and on upstreammain) is the PR/issue entity events plusworkflow_dispatch,repository_dispatch,schedule,workflow_run.env: GITHUB_EVENT_NAME: workflow_runcould not work. GitHub docs: "You can't overwrite the value of the default environment variables namedGITHUB_*andRUNNER_*." The failed ai-analytics run (34645803094) shows the override in the step env and the action still receivingcheck_suite.track_progress: true, which the action only allows on PR/issue events (src/modes/detector.ts). A correctly relabelled run would have crashed one check later.check_suitefor suites created by Actions, so CI failures (lint/test/typecheck/build) have never reached autofix at all. Only third-party apps such as CodeQL default setup could, and those crashed.Fix
Split the job so every event the action sees is one it supports, and cover CI failures.
dispatch-failing-checksruns oncheck_suitefailure (non-Actions check apps) andworkflow_runfailure (the caller's CI workflows, named in itsworkflows:filter). It resolves the open PR by SHA, applies the fork, kill-switch label, staleness (PR head still equals the failing SHA), self-exclusion andallowed_botsgates, then raises arepository_dispatch(claude-autofix-failing-checks) with the default token.repository_dispatchis one of the two events GitHub does start runs for when raised withGITHUB_TOKEN.fix-failing-checksruns on that dispatch. It re-validates PR state and the failing-check invariant from the live API (anyone withcontents: writecan raise a dispatch), validates and sanitises the payload before it reaches step outputs or the prompt, then runs the action. The dead override, HACK comment, andtrack_progressare removed.allowed_botsis dropped from this step because the action skips its actor check onrepository_dispatch; the dispatcher enforces the list against the real actor instead.workflow_runandrepository_dispatchtriggers, and a concurrency group where both Claude jobs key on PR number (so they serialise) while dispatcher runs use a separatedispatch-<sha>group (so pending-run eviction cannot drop the fixer).repository_dispatchrun leaves no check on the PR commit.An adversarial subagent review was run on the diff; its findings (inert
allowed_bots, missing re-validation across the trust boundary, concurrency eviction, prompt injection viasource, invisible fixer failures) are all addressed.Caller migration (required)
Each consuming repo's trigger file must add
workflow_run: { workflows: [<CI workflow name>], types: [completed] }andrepository_dispatch: { types: [claude-autofix-failing-checks] }toon:, and adopt the concurrency group from the template. Both new events only fire from the default branch, so merge the caller change before testing. Known callers:ai-analytics(pinned SHA, needs bump in its own PR),polygon-lms(@main),polygon-core-plugins(pinned SHA).Verification plan
workflow_rundispatcher run, then onerepository_dispatchrun whose log containsAuto-detected mode: agent for event: repository_dispatchand which pushes a[claude-autofix]commit or comments.gh run list --workflow claude-autofix-caller.yml --event repository_dispatchlists the run (these runs are attributed tomain, not the PR branch). No run logsUnsupported event type.🤖 Generated with Claude Code