GitHub CI Checks Fix Trigger
Automatically trigger agents to fix CI check failures on pull requests.
The GitHub CI Checks Fix Trigger feature lets you automatically assign a "fixer" agent to a pull request when its CI checks fail. The agent analyzes the failure logs and attempts to fix the issues (e.g., failing tests, lint errors, type mismatches) with a follow-up commit.
How it works
Flow overview
- PR opened → agent creates or updates a PR
- CI checks run → GitHub Actions, CircleCI, or other CI runs tests
- Check fails → (lint, tests, security scan, etc.)
- Trigger fires → AACWorkflow detects the failure
- Fixer assigned → a "fixer" agent is auto-assigned to fix the issues
- Agent analyzes → reads failure logs and error messages
- Agent implements fix → commits changes to the PR branch
- CI re-runs → checks run again on the new commit
- Success or escalate → if checks pass, PR is ready to merge; if still failing, escalate to human
Approval policies
You control which CI failures trigger auto-fixes:
- All failures — any failed check triggers the fixer
- Specific checks — only certain checks (e.g., "tests" but not "security")
- Trusted checks only — only checks that are known-fixable (e.g., linting, formatting)
Dangerous checks (security, compliance) can be configured to require human approval before auto-fix is attempted.
Setup
Enable CI fix trigger
Go to Settings → GitHub → CI Checks Policy.
-
Toggle Auto-fix CI check failures → ON
-
Select which checks are auto-fixable:
- ✓ Lint errors (fixable via
eslint --fix,gofmt, etc.) - ✓ Type mismatches (often fixable via TypeScript inference)
- ✓ Formatting (auto-fixable via Prettier, formatters)
- ✗ Security scans (review before fix)
- ✗ Custom workflows (often require manual intervention)
- ✓ Lint errors (fixable via
-
Choose a fixer agent (or leave blank to use default "code-fixer")
-
Set max retry attempts (default: 2)
-
Click Save
Assign a fixer agent
By default, AACWorkflow uses an auto-provisioned "code-fixer" agent. To use a specific agent:
- Go to Settings → GitHub → CI Checks Policy
- Dropdown Fixer agent → select an agent (e.g., "Frontend Fixer", "Backend Fixer")
- Save
The selected agent must:
- Have write access to the repo (via GitHub token)
- Know how to fix the types of issues your CI checks for
- Be available (not overloaded with other tasks)
How the fixer works
Step 1: Detect failure
When a PR's CI check fails, AACWorkflow reads the failure logs from GitHub (via the GitHub API):
{
"check_run": "tests",
"conclusion": "failure",
"title": "Run tests",
"output": {
"title": "2 test failures",
"summary": "packages/views/components/button.test.tsx:42 - expect....",
"annotations": [
{
"path": "packages/views/components/button.test.tsx",
"start_line": 42,
"message": "Timeout: test 'renders with onClick handler' did not complete"
}
]
}
}Step 2: Analyze & plan
The fixer agent:
- Clones the PR branch locally
- Reads the failure logs and error annotations
- Categorizes the failures:
- Fixable: syntax errors, lint violations, missing types, test timeouts
- Escalate: permission denied, infrastructure failures, test logic issues
- Plans a fix (e.g., "Add await to async test", "Remove unused variable")
Step 3: Implement fix
The fixer commits changes to the PR branch:
git checkout feature/aac-42-oauth
# Fix the issues (syntax, types, lint, tests)
git add .
git commit -m "fix: resolve CI check failures
- packages/views/components/button.test.tsx:42 - add await for async test
- server/cmd/server/main.go:18 - gofmt formatting
"
git pushGitHub triggers a new CI run automatically (since the branch was updated).
Step 4: Retry or escalate
After the fix commit:
- CI passes ✅ → PR is now ready to merge (human review still required)
- CI fails again ❌ → if
max_retry_attemptsnot exceeded, retry logic kicks in:- Analyze the new failure
- Plan another fix
- Commit again
- Max retries exceeded → escalate to human:
- Post a comment: "I've attempted 2 fixes but CI still fails. See details below."
- Leave the PR branch in the best state possible
- Assign to human reviewer
Examples
Example 1: Lint error (auto-fixable)
CI failure: ESLint reports unused variable in apps/web/app/page.tsx:15
Fixer action:
- Detects:
unused variable 'tempUser' - Runs:
eslint --fix apps/web/app/page.tsx - Commits:
fix: remove unused variable - Pushes
- CI re-runs and passes ✅
Result: PR is now green; human reviews the code.
Example 2: Test timeout (usually fixable)
CI failure: Test times out in packages/core/agents/agents.test.ts:120
Fixer action:
- Reads error: "Test 'should handle concurrent requests' did not complete"
- Opens file, sees
awaitis missing on async operation - Adds
awaitbefore the async call - Commits:
fix: add missing await in concurrent test - Pushes
- CI re-runs; test completes in 500ms ✅
Result: PR is green.
Example 3: Type mismatch (varies in fixability)
CI failure: TypeScript reports type error in packages/core/api/client.ts:45
Fixer action:
- Reads:
Type 'undefined' is not assignable to type 'string' - Examines context; can't infer the correct value
- Tries: Add a type guard (e.g.,
?? '') - Commits and pushes
- CI re-runs; type check passes ✅
Result: PR is green (but human should review the type guard to ensure it's correct).
Example 4: Security check (escalates)
CI failure: Snyk detects a vulnerable dependency in package.json
Fixer action:
- Reads Snyk output: "lodash < 4.17.21 is vulnerable"
- Checks if it's safe to upgrade:
npm update lodash - Tests:
npm test— all pass ✅ - BUT: Security checks have
require_approval: true - Posts comment: "Found vulnerable dependency; attempting upgrade."
- Waits for human approval before pushing the fix
Result: Escalated to human; fixer waits for OK to commit.
Approval & safety
Trust levels
Configure trust levels per check type:
| Check | Trust level | Behavior |
|---|---|---|
| Lint (ESLint, gofmt) | High | Auto-fix without approval |
| Type checking (TypeScript) | High | Auto-fix without approval |
| Formatting (Prettier) | High | Auto-fix without approval |
| Tests | Medium | Auto-fix, but escalate if > 2 failures |
| Security (Snyk, OWASP) | Low | Require approval before fixing |
| Custom workflows | Low | Require approval before attempting fix |
Max retry attempts
Set how many times the fixer should retry before escalating:
- 1 — one attempt; escalate on any failure
- 2 (default) — two attempts; escalate after second failure
- 3 — three attempts; most issues are fixable by the third try
API & automation
Trigger fix manually
If auto-fix is disabled, you can trigger it manually:
POST /api/workspaces/{ws}/github/pr/{pr_number}/trigger-fixBody:
{
"check_run_id": 12345,
"agent_id": "550e8400-e29b-41d4-a716-446655440000"
}Disable fix for a specific PR
If you want to disable auto-fix for one PR (e.g., to investigate manually):
PATCH /api/workspaces/{ws}/github/pr/{pr_number}Body:
{
"auto_fix_ci_enabled": false
}Re-enable:
{
"auto_fix_ci_enabled": true
}Query fix attempts
GET /api/workspaces/{ws}/github/pr/{pr_number}/fix-historyReturns:
{
"pr_number": 123,
"fix_attempts": [
{
"attempt": 1,
"triggered_at": "2025-06-22T15:30:00Z",
"check_run": "tests",
"failure_summary": "2 tests failed (timeouts)",
"agent_id": "550e8400-e29b-41d4-a716-446655440000",
"fix_commit": "abc123def456",
"result": "success"
},
{
"attempt": 2,
"triggered_at": "2025-06-22T15:35:00Z",
"check_run": "lint",
"failure_summary": "3 ESLint violations",
"agent_id": "550e8400-e29b-41d4-a716-446655440000",
"fix_commit": "def456abc123",
"result": "escalated"
}
]
}Best practices
- Start with high-trust checks — lint and formatting are safest to auto-fix
- Review the first few auto-fixes — verify the fixer's judgment before trusting it fully
- Use dedicated fixer agents — agents trained for error analysis and remediation
- Monitor escalations — if the fixer escalates often, it may be due to unclear CI errors; improve your CI logs
- Set reasonable retry limits — 2-3 attempts usually catches fixable issues
Troubleshooting
"Fixer is making wrong fixes"
- Check the fixer agent's instructions (Settings → Agents)
- Review past fix attempts to see patterns
- Add more specific context to CI check logs (better error messages help)
- Consider using a different fixer agent or adding an approval gate
"Fixer keeps escalating instead of fixing"
- The check failures may not be fixable (e.g., security, infrastructure)
- The fixer agent may lack context; check its instructions and capabilities
- Increase
max_retry_attemptsif it's too low - Add examples in the agent's system prompt to guide decision-making
"Manual fix needed but auto-fix ran first"
- Go to the PR in GitHub
- Set
auto_fix_ci_enabled: false(via API or Settings) - Investigate and manually fix the underlying issue
- Re-enable auto-fix once the issue is clear
Related features
- GitHub integration — see GitHub integration
- GitHub PR creation — see GitHub PR Creation Flow
- Approval policies — see Approval Policies