Fix #86: Monitor CI on clayde PRs and self-fix failing pipelines#87
Open
ClaydeCode wants to merge 1 commit into
Open
Fix #86: Monitor CI on clayde PRs and self-fix failing pipelines#87ClaydeCode wants to merge 1 commit into
ClaydeCode wants to merge 1 commit into
Conversation
When an issue's PR is open and there is no new human activity, the orchestrator now checks the PR head commit's check runs. If a required check has failed and a fix has not yet been attempted for that head SHA, the new fix_ci task invokes Claude to diagnose the failing job logs and push a fix to the branch. Attempts are capped per PR by CLAYDE_CI_FIX_MAX_ATTEMPTS (default 3); once exhausted the operator is notified once via ntfy. Green/pending CI falls through to normal review monitoring unchanged. - github.py: get_check_runs() (failed check runs for a SHA), get_required_check_names() (required checks from branch protection) - tasks/fix_ci.py + prompts/fix_ci.j2: the CI-fix task and its prompt - orchestrator._handle_ci_fix(): CI monitoring, per-SHA + max-attempts loop-safety, exhaustion notification - state: ci_fix_attempts, last_ci_fix_attempt_sha, ci_fix_exhausted_notified - config: ci_fix_max_attempts setting - docs: README, CLAUDE.md, config.env.template Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
Closes #86.
Clayde now treats a failing CI pipeline on one of its own PRs as a blocking signal and fixes it autonomously, instead of only reacting to human review comments.
When an issue's PR is open and there is no new human activity in a cycle,
_handle_ci_fix()checks the PR head commit's check runs:get_check_runs).get_required_check_names); on unprotected branches every failed check is treated as blocking.fix_citask — Claude reads the failing job logs (gh run view --log-failed), pushes a fix to the PR branch, and posts an issue comment summarising what failed and what changed.CLAYDE_CI_FIX_MAX_ATTEMPTS(default 3) per PR.Loop-safety
The attempt counter and attempted head SHA are recorded before invoking Claude, so a crash or usage limit can never cause an endless retry on the same commit.
last_ci_fix_attempt_shadedupes per-commit;ci_fix_attemptsenforces the global per-PR cap.New state fields
ci_fix_attempts,last_ci_fix_attempt_sha,ci_fix_exhausted_notified.Testing
uv run pytest— 371 passed (30 new: check-run helpers, thefix_citask,_handle_ci_fix, and the_handle_issueintegration).Recommended reading order
src/clayde/github.py— newget_check_runs()/get_required_check_names()helpers (the data layer).src/clayde/config.py—ci_fix_max_attemptssetting.src/clayde/prompts/fix_ci.j2— the prompt Claude receives.src/clayde/tasks/fix_ci.py— the CI-fix task (mirrorstasks/work.py).src/clayde/orchestrator.py—_handle_issuerestructure +_handle_ci_fix()/_notify_ci_exhausted()(how it all wires together).tests/—test_github.py,test_tasks_fix_ci.py,test_orchestrator.py.README.md,CLAUDE.md,config.env.template.🤖 Generated with Claude Code