| name | self-fix-loop |
| description | Self-learning fix loop - commit, push, monitor CI, auto-fix failures using swarm agents with skills on demand, loop until all checks pass. Supports GitHub Actions and GitLab CI. Use when CI fails and you need to iteratively fix until green. Triggers: "fix CI", "loop until green", "auto-fix failures", "self-fix".
|
| category | workflow |
| license | MIT |
| metadata | {"author":"d-oit","version":"0.3.0","adapted-from":"d-o-hub/github-template-ai-agents"} |
Self-Fix Loop Skill
When to Use
- User asks for this skill's functionality
Automated self-learning cycle: commit → push → monitor → analyze failures → fix → retry until all CI checks pass.
Self-Fix Threshold: If 2+ similar errors occur during the loop, pause and diagnose the root cause before attempting another fix.
Overview
Continuous improvement loop that:
- Commits all changes atomically
- Pushes to feature branch
- Creates/updates PR/MR
- Monitors CI (GitHub Actions or GitLab CI)
- On failure: diagnoses and fixes
- Repeats until ALL checks pass
Platform Detection
Auto-detect from git remote:
REMOTE=$(git remote get-url origin)
if echo "$REMOTE" | grep -qi "github"; then
PLATFORM="github"; CLI="gh"
elif echo "$REMOTE" | grep -qi "gitlab"; then
PLATFORM="gitlab"; CLI="glab"
fi
CLI Command Mapping
| Action | GitHub (gh) | GitLab (glab) |
|---|
| Check CI | gh pr checks | glab ci status |
| Create PR/MR | gh pr create | glab mr create |
| View logs | gh run view --log-failed | glab ci view |
Arguments
| Argument | Description | Default |
|---|
--max-retries N | Maximum fix iterations | 5 |
--platform github|gitlab | Force platform | auto-detect |
--auto-research | Use web research on failures | true |
--fix-issues | Attempt automatic fixes | true |
--strict-validation | ALL checks must pass | true |
--timeout SECONDS | Per-iteration timeout | 1800 |
--dry-run | Simulate without pushing | false |
Loop Phases
[Start]
↓
Phase 1: COMMIT & PUSH
- Stage all changes
- Run quality gate
- Atomic commit
- Push to feature branch
↓
Phase 2: CREATE/UPDATE PR/MR
- Create new PR/MR or update existing
↓
Phase 3: MONITOR CI
- Poll GitHub Actions / GitLab CI
- Wait for all checks complete
↓
Phase 4: ANALYZE FAILURES
- Identify failed checks
- Extract error messages
- Categorize failure type
↓
Phase 5: FIX (if failures)
- Diagnose root cause
- Apply fixes
- Commit fix
↓
Phase 6: RETRY LOOP
- If retries remaining → Phase 1
- If max retries → FAIL
- If all pass → SUCCESS
Rust Failure Types
| Failure Type | Action |
|---|
cargo fmt | Run cargo fmt --all |
cargo clippy | Fix warnings, respect -D warnings |
cargo test | Debug test failures, fix or skip flaky |
cargo audit | Update vulnerable dependency |
cargo deny | Fix license or advisory violations |
cargo machete | Remove unused dependencies |
| Linker errors | Check build-essential, pkg-config |
Rationalizations
| Rationalization | Reality |
|---|
| "The loop is stuck, I'll just force merge" | Force merging defeats the purpose of CI and introduces regressions. |
| "One more retry should fix it" | Repeated identical failures indicate a root cause, not a flaky test. |
| "I'll disable strict validation to pass faster" | Strict validation catches issues early; disabling it pushes bugs to production. |
Red Flags