> For the complete documentation index, see [llms.txt](https://docs-lunar.earthly.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-lunar.earthly.dev/docs/guides/cancel-a-bad-config.md).

# Cancel a Bad Config

Stop a bad Lunar configuration's work with lunar hub pull --cancel, and re-run what Lunar Hub can under the fixed configuration for the commits it already judged.

Reverting a config only helps commits pushed afterwards. Every commit Lunar Hub has already judged stays pinned to the configuration that judged it, so open pull requests and branch heads keep the bad verdict until someone pushes again. When a bad config has shipped, such as a collector that breaks or a policy that fails everything, cancel it once the revert or fix has synced. The cancel stops the bad version's work and re-runs what Lunar Hub can under the fixed version. Some things only your CI or a new push can redo; see [What a cancel can't repair](#what-a-cancel-cant-repair).

{% stepper %}
{% step %}

### Revert or fix the config

Push the revert or the fix to the config repository's default branch. The [sync job](https://docs-lunar.earthly.dev/install/lunar-hub/self-hosted/sync-config.md) publishes it as the current version, the same as any other change.
{% endstep %}

{% step %}

### Cancel the bad version

Run [`lunar hub pull`](https://docs-lunar.earthly.dev/docs/lunar-cli.md#lunar-hub-pull) against the same repository the sync job pulls, naming the bad version by the full commit SHA of its config:

```bash
lunar hub pull --cancel <bad-config-commit-sha> github://my-org/my-config-repo@main
```

The pull itself is usually skipped as already installed, and the cancel still applies. With the service token, add `--actor <your-name>` so the cancel is attributed. Lunar Hub refuses to cancel the current version, so sync the fix first.
{% endstep %}

{% step %}

### Watch it finish

The command returns once the cancel is queued. The **Configuration cancels** panel on the System status dashboard shows its progress, and it is finished when **Still pinned** and **Reprocessing** are both 0. **Re-pin** reading `not running` while commits are still pinned means the cancel stopped partway; run the same command again.
{% endstep %}
{% endstepper %}

## What stops

* **Queued work never starts.** The bad version's queued collector and policy runs are skipped, including collector jobs not yet handed to a pod, and its results are no longer posted.
* **Runs already in flight are marked canceled.** Their pods are left to finish, since Lunar Hub can't stop a running pod.
* **CI jobs still running the bad version** keep sending data, because Lunar Hub can't cancel your CI. That data is evaluated under the current version instead, on a best-effort basis.

## What runs again

Every commit the bad version judged moves to the current version, default-branch heads before pull requests. For each one, Lunar Hub re-runs the code collectors that are new in the current version, changed since the bad one, or whose last run didn't succeed, including the runs the cancel stopped. Collectors that are unchanged and succeeded keep their data, since running them again would produce the same output. Every affected component is then re-evaluated under the current configuration. A component the current version no longer has leaves the report for those commits.

## What pull request authors see

On GitHub, the **Earthly Lunar** check run goes from the canceled version's result to pending, and then to the current version's verdict; the pull request comment is rewritten to match. On GitLab, the commit status, external status check, merge request note, and badges are replaced the same way. `lunar ok-release` on a branch head answers from the current version, and reports not-done while that is pending.

## What a cancel can't repair

{% hint style="warning" %}
**A release that already passed under the canceled version isn't revisited.** `--cancel` changes what Lunar reports from now on. It can't undo a deployment that went out while the bad config was current.
{% endhint %}

* **CI collector data.** Only your CI can run CI collectors, so their data from the bad version keeps counting for that commit. Re-running the CI job adds new data next to it rather than replacing it; a new commit starts clean.
* **Data the current version doesn't re-collect.** A canceled pod's output is still stored when it reports. It counts only where nothing newer replaced it, such as a collector the fix removed, or one whose re-run under the current version failed. Policies that don't read that data are unaffected.
* **Cron collectors** aren't re-run. They fill in on their own schedule, as after any configuration change.
* **Components the current version adds** appear on each commit's next push or CI re-run, since the changed paths of an earlier push are no longer available.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs-lunar.earthly.dev/docs/guides/cancel-a-bad-config.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
