Runaway spend in an unattended job

CI and automationAnyone running agents with nobody watching

A scheduled agent hit a permissions error and retried the same call for 40 minutes overnight.

How do I stop an unattended AI agent from retrying the same failing call all night?

Run the agent with ArcRoom on: its loop guard blocks the third identical call in a row and tells the agent to change approach or stop. The job then fails early and cheaply instead of late and expensively. It doesn't catch loops that vary slightly each time.

Also asked as: A scheduled agent burned 40 minutes retrying a permissions error. How do I prevent that? · How do I cap runaway retries in a headless AI agent? · Can an AI agent be stopped when it keeps repeating the same command?

The work

The loop guard blocks the third identical call in a row.

ArcRoom keeps
  • Loop guard
The next agent gets

ArcRoom loop guard: 3rd identical call blocked:

Step by step

  1. The loop guard blocks the third identical call in a row.
  2. The agent is told to change approach or stop.
  3. The job fails early and cheaply instead of late and expensively.

What the agent sees

ArcRoom loop guard: 3rd identical call blocked:
  gh api repos/acme/app/actions/secrets
Stop and report.

Compared with today's tools

Job timeout and turn limit (timeout-minutes, claude -p --max-turns)

The job sets timeout-minutes and the agent call sets a turn limit, so a stuck run stops at a fixed ceiling.

Setup
5 min
Ongoing
None

ArcRoom

Every agent reads the team playbook before it works and writes to it when it finishes. Nothing to update by hand.

Setup
2 min (npx arcroom init)
Ongoing
None

Limits stop a stuck run only at the ceiling. The loop guard stops a repeat at the third call. Use both.

Where it stops

Doesn't catch loops that vary slightly each time.

Try it in your project

Works with the agents your team already uses, and any agent over MCP or the HTTP API.

More in ci and automation