# Repairs and standing grants

> Fixes a chart may offer from a closed list, the owner's standing yes for each one, and how the guard loop tries them, backs off and gives up.

When an `alive` proof fails, a chart may offer repairs from a closed list. Each one is asked, every time, until the owner allows it in advance. That standing yes is a **grant**.

```json [alta-os chart.json: repairs]
[
  {
    "id": "restart-ollama",
    "kind": "service.restart",
    "args": { "id": "ollama" },
    "suggest": true
  },
  {
    "id": "pull-embeddings",
    "kind": "model.pull",
    "args": { "model": "qwen3-embedding:0.6b" },
    "suggest": true
  },
  { "id": "recover-gateway", "kind": "gateway.recover", "suggest": true }
]
```

## The kinds

Signing in again, pairing a device, applying a part again or anything that asks for more rights can never be allowed in advance.

## A grant

- **Explicit.** One box per repair, unticked, on the install plan or later with `alta repairs grant <chart> <repair>`. Every box starts unticked, Alta's own charts included. A chart's `suggest` only adds the words "suggested by the author".
- **Scoped.** One repair of one chart. If a new version changes that repair or its target, the grant is void and the owner is told.
- **Never expires** until the owner revokes it: `alta repairs revoke <chart> <repair>`. `alta repairs pause` stops every automatic repair at once; `alta repairs resume` starts them again.
- **Logged.** Each use and each refusal is one line of the Guardian's journal (`alta repairs log`): no value, no output of the program.
- **Machine switch.** The server must be started with `--allow-repair`. Without it, every repair is asked.

## One incident

1. The proof fails, `grace` times in a row: an incident opens.
2. The first granted repair of the proof's list runs at once; if the proof still fails, again 1 minute later, then 5 minutes after that.
3. Then the next repair of the list, the same way.
4. The proof passes: the incident closes. Only the proof decides, never the program's exit code.
5. Nothing left to try: the release is `Drifted` with the reason `RepairGaveUp`, and the owner is asked once.

Daily caps, a flapping proof (three incidents in a day) and a machine-wide circuit breaker stop automatic repairs until the owner looks.

## Who does what

| Who | Does |
|---|---|
| The guard loop | Reads the proofs, decides, runs only granted repairs, writes the journal. A script, no model; it works when the agents are down. |
| The Guardian | Tells the owner what was repaired, asks for the rest, may suggest a grant. It never gives one and never runs a repair. |
| The owner | Gives, sees and takes back every grant. |

**Next:**

- [Let the owner allow a repair](https://docs.altasystem.ai/charts/guides/repairs)
- [alta repairs](https://docs.altasystem.ai/reference/cli/repairs)
