Problem
When clayde opens a PR and the GitHub Actions pipeline fails, clayde currently does nothing — it only reacts to human review comments. A failing CI is effectively a blocking review signal that should be handled autonomously.
Desired behaviour
During the pr_open phase, in addition to checking for PR reviews, clayde should:
- Fetch the CI status for the PR's head commit (GitHub Checks API)
- If any required check has failed and clayde has not yet attempted a fix for that run:
- Invoke Claude with the failing job logs + current branch state
- Claude analyzes the failure, pushes a fix commit to the branch
- Clayde posts an issue comment summarising what failed and what was changed
- Re-check on the next cycle — if CI is still failing after a fix attempt, retry (up to a configurable max, e.g. 3 attempts per PR)
- If CI is green (or no required checks exist), continue existing review-monitoring logic unchanged
Implementation notes
- New helper in
github.py: get_check_runs(g, owner, repo, ref) — wraps the Checks API to return failed check runs for a given commit SHA
- New Jinja2 prompt template
fix_ci.j2 — includes: issue context, PR branch, list of failed checks with their log URLs, instruction to fetch logs via gh run view --log-failed and push a fix
- State: track
last_ci_fix_attempt_sha in issue state — only attempt a fix once per head SHA to avoid infinite loops on unfixable failures
- Max attempts:
ci_fix_max_attempts setting (default 3), tracked as ci_fix_attempts in state; stop attempting and notify operator if exceeded
- Notification: ntfy alert when max attempts exceeded ("Clayde: CI still failing after N attempts")
- Scope: only act on required checks (same checks that block merging), ignore informational ones
Problem
When clayde opens a PR and the GitHub Actions pipeline fails, clayde currently does nothing — it only reacts to human review comments. A failing CI is effectively a blocking review signal that should be handled autonomously.
Desired behaviour
During the
pr_openphase, in addition to checking for PR reviews, clayde should:Implementation notes
github.py:get_check_runs(g, owner, repo, ref)— wraps the Checks API to return failed check runs for a given commit SHAfix_ci.j2— includes: issue context, PR branch, list of failed checks with their log URLs, instruction to fetch logs viagh run view --log-failedand push a fixlast_ci_fix_attempt_shain issue state — only attempt a fix once per head SHA to avoid infinite loops on unfixable failuresci_fix_max_attemptssetting (default 3), tracked asci_fix_attemptsin state; stop attempting and notify operator if exceeded