Fix CI
Run this workflow to diagnose and fix CI build and test failures on the active branch.
Inputs
- Optional: specific failing check name or local reproduction command.
- Optional:
maxIterationsfor post-push CI remediation loops. Default:3.
If no inputs are provided, investigate the failing CI checks for the current branch PR.
Workflow
- Identify the failing check.
- If not provided, run
gh pr view --json statusCheckRolluporgh run list --branch <current-branch> --jsonto find failing checks. - Fetch the failing logs using
gh run view <run-id> --logor similar if necessary.
- Reproduce the failure locally.
- Map the failing check to a local script or command (e.g.
./tools/test_unit.sh,pytest,npm test,poetry run ruff check ., etc.). - Run the local command and ensure it fails in the same way as CI.
- Fix the underlying issue.
- Analyze the error output.
- Apply surgical code changes to fix the build error or test failure.
- Ensure the fix doesn't break other existing functionality.
- Verify the fix locally.
- Re-run the local reproduction command until it passes successfully.
- If the command still fails, repeat step 3.
- If the required local toolchain or service is unavailable, do not treat
weaker checks such as
git diff --checkas sufficient verification. Record the missing prerequisite and default to post-push CI verification unless the task explicitly forbids pushing; otherwise stop as blocked.
- Commit and push.
- Ensure the working tree is clean except for the fixed files.
- Stage the resolved files with
git add <file>. - Commit the changes using a descriptive message (e.g.
fix(ci): <short failure summary>). - Push to the current branch with
git push.
- Verify the pushed head in CI.
- Record the exact local
HEADSHA after the push. - Confirm the PR branch on GitHub points at that same SHA. If it does not, stop as blocked; do not report success.
- Write
artifacts/publish_result.jsonthrough the shared helper after every pushed or verified no-op outcome:
If no commit was needed, use:python3 "${MOONMIND_ACTIVE_SKILLS_DIR:-.agents/skills}/_shared/publish_evidence.py" write-pushed \ --skill-id fix-ci \ --repo "$REPO" \ --branch "$BRANCH"python3 "${MOONMIND_ACTIVE_SKILLS_DIR:-.agents/skills}/_shared/publish_evidence.py" write-no-op \ --skill-id fix-ci \ --repo "$REPO" \ --branch "$BRANCH" - Wait for required PR checks on that SHA to finish. Poll with bounded backoff.
- If checks pass, finish successfully.
- If checks fail, fetch the new failing logs and repeat steps 2-6, up to
maxIterations. - If checks remain queued/running beyond the wait cap, GitHub is unavailable,
or the task explicitly forbids pushing, write blocked evidence and stop with
the current SHA, check state, and next action:
Do not report success while CI is running, degraded, unknown, or failing.python3 "${MOONMIND_ACTIVE_SKILLS_DIR:-.agents/skills}/_shared/publish_evidence.py" write-blocked \ --skill-id fix-ci \ --repo "$REPO" \ --branch "$BRANCH" \ --reason publish_unavailable
Output
Provide:
- The failing check name and a brief summary of the error.
- The local reproduction command used.
- Files changed to fix the issue.
- Confirmation that local verification passed, or a clear blocked reason if it could not run.
- Confirmation that the pushed PR-head CI passed for the exact fixed commit.
- Commit hash and pushed branch.