At a glance
Reference for AI: auto-healing at a glance
Reference for AI: auto-healing at a glance
- Precedence: a per-run opt-in (CLI flag, action input, or API
autoHeal) takes priority over project-wide auto-heal settings for that run. - Target branch:
branchis one branch in the tests repository. Defaults to the run’s recorded branch. If the run came from app-code CI, set it to the tests repo’s integration branch (oftenmain). - Output: a PR from a generated
checksumai/<id>branch intobranch, whenautoCreatePRistrue(the default). - Honest triage: real product bugs get a
bugverdict and an@bugtag instead of being rewritten to go green. - Sharding: a merged sharded run that ends
failedis healed. If shards never merge (checksumaiolder than 4.4.0), the heal is never evaluated.
Choose how to start healing
There are two moments to ask for healing. You can opt in when you start a run, so healing kicks off on its own if the run fails. Or you can heal a run that already finished. Checksum can also turn healing on for every CI run in your project. If a run has its own opt-in (a CLI flag, an action input, or an APIautoHeal block), that takes priority over the project-wide setting for that run.
Heal failures from the CLI
Add--cksm-auto-heal to your test command. If the run fails, Checksum heals the failing tests and, by default, opens a PR with the fixes:
--cksm-auto-heal alone is usually all you need. Outside CI, you can set them yourself with the extra flags in the reference below.
Reference for AI: --cksm-auto-heal flags
Reference for AI: --cksm-auto-heal flags
Heal failures from the GitHub Action
Setauto-heal: true on the Checksum action. The action works out the PR and repository from the workflow, so healing progress appears as a comment on the PR that triggered it:
shard-count, you need action v2.1.0 or later. When the workflow runs from application code, set the action’s branch input to your tests repo’s integration branch so the heal PR lands there (see Choose where the fix PR lands). More in CI/CD Integration, or have a coding agent build the workflow with CI Setup Prompts → Prompt 1.
Heal every failing CI run
Heal from the REST API
From the API you can either ask for healing as part of starting a run, or heal a run afterward. Either way you get a healing batch to follow. Every request sendsAuthorization: Bearer $CHECKSUM_API_KEY.
Heal automatically if a run fails
Add anautoHeal block to the request that starts the run (any of the execution endpoints). If the run ends failed, Checksum starts healing on its own; there’s no second call. Leave the block out to opt out.
GET /execution/status/run/{runId}. It also works with sharded runs: once the shards merge, a failed run is healed.
Heal a run that already finished
If a run finished withoutautoHeal, ask for healing afterward. Pass the run’s ID (the runId from when you started it, or the id of the latest run), not its job name:
batchId. Because it opens a PR by default, include repoName unless you set "autoCreatePR": false.
Follow healing progress
Check the batch every so often untilallTerminal is true. Each session’s prUrl links the fix PR once it opens.
pending to in_progress and ends as completed or failed. Generation batches report progress in the same shape, without testRunId and sessions[].checksumTestId.
Example: a script that heals the latest failed run and waits for the fix PRs
Example: a script that heals the latest failed run and waits for the fix PRs
curl, jq, CHECKSUM_API_KEY, and REPO set to the <owner>/<repo> used for status comments. Set TESTS_BRANCH to your tests repo’s integration branch.Reference for AI: healing REST API
Reference for AI: healing REST API
Authorization: Bearer $CHECKSUM_API_KEY; with a body, Content-Type: application/json.autoHeal block (execution request bodies)
Accepted onPOST https://api.checksum.ai/public-api/v1/execution/suite, POST https://api.checksum.ai/public-api/v1/execution/collection/{id}, POST https://api.checksum.ai/public-api/v1/execution/tests, POST https://api.checksum.ai/public-api/v2/execution/grep. Presence means heal-on-failure: if the run ends failed, a healing batch starts with no separate call. Omit to opt out.branch = what is checked out for the test run; autoHeal.branch = where the heal PR lands. Works with shardCount: the merged run is healed; if shards never merge (outdated checksumai), the heal is never evaluated. Next: poll GET /execution/status/run/{runId}.POST https://api.checksum.ai/public-api/v1/auto-heal
Starts healing for the failing tests in a finished run.GET https://api.checksum.ai/public-api/v1/auto-heal/batch/{batchId}
Returns the progress of a healing batch. Generation batches (GET /auto-generate/batch/{batchId}) return the same shape, minus testRunId and sessions[].checksumTestId. Path parameter batchId (string, required): the batch ID returned by the trigger. Poll until allTerminal is true.Choose where the fix PR lands
Healing always works in your tests repository. Thebranch you pass is the one branch healing clones, commits to, and opens its PR against; the PR comes from a generated checksumai/<id> branch. If you don’t pass one, Checksum uses the branch the run was recorded on. That only works when the run executed against a tests-repo branch. If the run came from your application’s CI (on a branch like feature/foo), set branch to your tests repo’s integration branch, often main. These settings behave the same on POST /auto-heal, the autoHeal block, and the CLI flags.
Choose where progress is posted
Separately,prNumber and repoName tell Checksum which pull request should receive progress comments while healing runs. They don’t change what’s cloned or where the fix PR lands. Usually they point at the PR in your application repo that triggered the CI run, but they can point at the tests repo if the source PR is there.
Reference for AI: healing targets
Reference for AI: healing targets
Where healing runs (tests repository)
autoCreatePR: true, the PR opens from a generated checksumai/<id> branch into branch. Same semantics on POST /auto-heal, the autoHeal block, and --cksm-auto-heal-branch. On grep runs, a top-level branch controls the run’s checkout, not the heal PR target.Where to post status (correlation only)
Ask your coding agent to heal
With the Checksum MCP server connected, just ask:Reference for AI: checksum_test_heal
Reference for AI: checksum_test_heal
Heal from the Feature Health Dashboard
From the Feature Health Dashboard
From a bug row or an expanded bug, start healing (or another agent workflow) on the grouped set of failures. From any test row, start an agent session for that single test when your project has agent workflows enabled. See Agent actions. Each healing session appears under Agent Sessions. Tests under healing show Under Healing on the dashboard.Test states while healing
While healing runs, each test on the dashboard is in one of three states:How healing works
Triage: bug or healable?
The agent’s first step is to triage every failure in the run. For each failing test it:- Reads the test results and error context (screenshots, error messages, stack traces)
- Reads the relevant test code and application code
- Classifies the failure:
- Test issue: the app is fine but the test needs fixing (selector drift, timing, stale setup, assertion drift). These go on to the fix stage.
- Application bug: a real defect in your product. The agent submits a
bugverdict and tags the test@bugin source. It’s tracked in the Feature Health Dashboard for your team.
Deep vs Standard healing
Triage → Fix
Plan first, then repair
What the agent fixes
Review healed tests
Read the diff
Run locally (optional)
checksumai/<id> branch and run the affected tests.Merge
Healing feedback
After reviewing healed tests, you can give feedback on the quality of the healing. Checksum uses it to improve healing accuracy over time.Notifications
Healing batches emit two events you can route to Slack, Teams, Discord, or Google Chat with notification connectors:Troubleshooting
The heal PR targets the wrong branch
The heal PR targets the wrong branch
feature/foo) doesn’t exist in the tests repo. Set branch / autoHeal.branch / --cksm-auto-heal-branch to your tests repo’s integration branch.400: repoName required
400: repoName required
autoCreatePR defaults to true, which requires repoName. Pass it, or set "autoCreatePR": false without prNumber.I passed the job name and healing didn't start
I passed the job name and healing didn't start
testRunId must be the run UUID (runId), not the dispatch name. For v2 grep runs polled by job name, use the testRunId field from GET /public-api/v2/execution/status/:jobName. See Which ID is which.Healing ran but no fix PR appeared
Healing ran but no fix PR appeared
autoCreatePR was false.