The loop your STOP button cannot end.
Live demo: https://rlasaf12.github.io/spinlock/
Part of the Agent Failure Series — interactive simulators showing how AI agents fail in production.
SpinLock demonstrates the infinite loop failure mode — when an AI agent enters a cycle it cannot detect or exit. You watch the cost counter climb. You hit STOP. Nothing happens. The agent reasons "task not complete" and continues.
This happens in production. Real developers have reported $200 bills from 2-minute tasks and API budgets drained in under 10 minutes.
| # | Name | Failure Pattern |
|---|---|---|
| ① | The Write Loop | Path correction alternates between two invalid paths — same error forever |
| ② | Agent Ping-Pong | Orchestrator ↔ sub-agent cycle with no TTL or depth limit |
| ③ | Retry Death Spiral | 429 rate-limit + no exponential backoff = immediate retry storm |
| ④ | Completion Blindness | Task done after iteration 1 — stale verifier returns False 47 more times |
- SEND STOP SIGNAL — watch the agent ignore it
- INJECT CIRCUIT BREAKER — terminates the loop, shows the 3-line fix
- Switch scenarios via the tab bar at the top
# 1. Duplicate detection
if error_hash in seen_errors: raise CircuitBreaker("duplicate error")
# 2. Iteration limit
if iterations > MAX_ITERATIONS: raise CircuitBreaker("limit reached")
# 3. Exponential backoff
wait = min(2**attempt + jitter(), 60); time.sleep(wait)- "ran 6 hours on a 2-minute task, cost $200" — DEV.to, Jul 11
- "drains API budget in 10 minutes" — DEV.to, Jul 24
- "$4 figures overnight from infinite loop" — Vorawire, Jul 3
- "wrote the same file six times in a row" — DEV.to, Jul 20
Harel Asaf — AI Operator. Finds where organizations bleed time. Builds the systems that fix it.
Built with: pure HTML/CSS/JS — no framework, no dependencies, no build step.