Home / Articles

Self-Repairing Automation Without an Allow-Clicker: Gates That Work at 3am

Design unattended auto-repair for scheduled agent routines: an outside watchdog, actions typed by reversibility, canary rollouts and status reports backed by evidence.

Publisher: REACTAPP.TOP6 min read1418 words

This article is published in English.

Sources: Routines That Repair Themselves

Once a team runs dozens of scheduled routines and agent sessions, the next wish is obvious: when a routine hits an error in itself or its environment, it should fix the root cause on its own, or spawn a separate session that does, without anyone approving each step in the middle of the night. The goal is sound. The danger is that the quickest way to get there, removing the approval gates or automating the clicks, turns a small fault into a fleet-wide incident with a false all-clear on top. This guide shows how to get genuine unattended repair while keeping the one distinction that matters: whether an action can be undone.

What goes wrong when the gates disappear

Two failure modes show up again and again in automated operations, and both are worth studying before building anything.

A correct command, executed at scale

Picture a voice or chat command that gets transcribed slightly wrong and reaches an automation path with authority over the scheduler. Within about five seconds it disables 146 scheduled tasks, including every watchdog that would have noticed. Nothing malfunctioned. The system did exactly what it was told, instantly and at scale.

The fix is a rule short enough to remember: any order that is mass, that disables an entire class of things, or that cannot be reversed gets a single confirmation line before it runs. That line names what will be touched and what the rollback will cost. Reading it takes a second; recovering from the incident without it takes an hour or more.

A recovery report written from intention

The second failure is subtler. After such an incident, the recovery notes say something like "restored 30 of 30". Days later, a check against the live scheduler finds 27 tasks still disabled, among them the configuration backup, the sync monitor and the session watchdog. The status line had been written from what the operator meant to do, not from what the system actually showed.

That produces a strict reporting rule. A sentence such as "restored N of N" is only allowed next to the command output that read that state back. Without that evidence, the honest wording is "sent the restore command".

This is the central risk of auto-repair. A repairer that declares success without reading the result is worse than having no repairer at all, because it turns an outage into an outage plus a confident message that everything is fine.

Five rules for repair that runs unattended

1. A routine cannot be its own repairer

If a routine is broken, its built-in self-repair logic is usually broken with it, and both fail silently together. Repair belongs one layer outside: a separate process, ideally on a separate machine, that watches the routine from the outside.

What it should watch is the age of the routine's output, not its exit code. A job that exits with status 0 and writes nothing looks perfectly healthy to any exit-code check. It is entirely possible for a job like that to go unnoticed for weeks. A freshness check ("the report file is younger than 26 hours", "the last row in the table is from today") catches exactly the failures that status codes hide.

2. Classify actions, not approvals

The request behind "nobody can press allow at night" is reasonable, but a bot that clicks allow automatically is the wrong answer. It erases the one line that truly matters, the one separating actions you can undo from actions you cannot, and it does so fastest precisely when no human is watching. It also hides a decision: someone still decided those actions were safe, and the clicker just conceals who made that call and when.

The workable alternative is to classify the action itself into tiers:

  • Automatic, no human, any hour: restarting a stuck service, re-registering a scheduled task that dropped off, clearing a stale lock, re-running an idempotent import, rebuilding an index. These are bounded, reversible and safe to repeat.
  • Automatic with a loud report: a configuration change on a single node, reinstalling dependencies, rebuilding a cache. They run, and a human reviews what happened afterwards.
  • Never automatic, queued for the morning: anything involving money, deletions, credentials, outbound messages sent in a person's name, schema changes, or mass actions across the whole fleet.

With this in place, the first tier runs at full autonomy overnight, the third tier waits in a morning report, and nobody clicks anything at 3am. Equally important, nothing irreversible happens at 3am.

Writing the classification down makes the trust decision explicit, reviewable and changeable in a single file. It is the same amount of trust as an allow-clicker grants, stored somewhere you can audit and test. For a deeper treatment of risk tiers and approval gates for agents in general, see our guide to permissions, approval gates and risk tiers.

3. Canary first, then the fleet

A fix pushed to every node simultaneously is itself a single point of failure: if the fix is wrong, it is wrong everywhere at once. Roll it out in steps instead:

  • apply the change to one node
  • verify by reading the resulting state, not by trusting a return code
  • apply it to a second node of a different type
  • only then roll it out to everyone

Name the rollback before you begin, so that reverting is a known procedure rather than an improvisation under pressure.

4. Do not build a repairer for the first failure

Auto-repair machinery multiplies easily, because every one-off error seems to deserve its own robot. A threshold keeps that in check. The first occurrence of a problem earns a single dated line in a journal. A mechanism gets built only when the same class of failure appears a third time, and only with a named consumer who needs it.

Without such a rule, the overhead can grow alarmingly. One team that measured its own work found that 82% of it had become meta-work: machinery built to manage other machinery. Repair automation is exactly the category most prone to that spiral.

5. Give every spawned session a self-contained brief

A session launched at 4am by a watchdog has none of the context held by the process that spotted the problem. Hand it a brief containing:

  • what broke
  • the evidence
  • what has already been tried
  • the boundary of what it may touch
  • the definition of done

The boundary is the line people forget. Without it, an eager agent will helpfully fix neighbouring things nobody asked about, which is how a narrow repair becomes a broad unreviewed change.

When one agent approves another

A common suggestion is to let one agent approve another, for example in a shared chat where a supervisor agent tells a worker to proceed. Ready-made tooling for invoking sessions this way exists. The pattern works well for the first tier of actions. It is also exactly how third-tier actions get waved through at 3am if nothing distinguishes them. Once actions are typed by reversibility, agent-to-agent approval becomes safe to use, because the supervisor can only approve what the classification already permits.

Key takeaways

  • Put repair outside the thing being repaired, and judge health by output freshness rather than exit codes.
  • Replace approval-clicking with a written classification of actions by reversibility and blast radius.
  • Require a one-line confirmation for mass, class-wide or irreversible orders, stating scope and rollback cost.
  • Report "fixed" only next to evidence that read the state back; otherwise report what was sent.
  • Roll fixes out through a canary and a differently typed second node before the fleet.
  • Build automation on the third recurrence of a failure class, not the first, and brief every spawned session with scope and a definition of done.