repeating the same quarantine action after the release api failed: the agent's retry loop never converged
Breaks a non-converging retry loop where an agent repeats a quarantine action after the release API fails, by adding attempt limits and state verification before acting. Use when the agent action history shows the same release or quarantine cycle repeating without progress. Not for legitimate repeated actions on different messages.
TL;DR
This loop shape, act, fail, repeat, survives because the agent never checks the world before acting: it works from a stale task list rather than the message current state. Before each action, re-read the target state; if the desired state already holds, close the task. If the API reports a permanent failure, stop and escalate with the error. Cap attempts per task across all runs, and make the cap impossible to reset by restarting, by storing attempts with the task itself.
repeating the same quarantine action after the release api failed: the agent's retry loop never convergedUse this when
- Agent logs show the same action attempted across many runs on one item.
- The item is already in the state the action wants, or can never reach it.
Not for this skill when
- Each repetition targets a genuinely new copy of the message. Verify identity before treating it as a loop.
- The API fails for every action due to an outage. Pause actions globally during the outage instead of per-item logic.
Steps
- Reconstruct the attempt history for the looping item from logs, including each API response. Verify: the repetition and its responses are fully visible.
- Identify why the action cannot succeed: state already achieved, item gone, or a permission or validation error. Verify: the class is named from the responses.
- Add a pre-action state check that closes tasks whose goal state already holds. Verify: a test task in the achieved state closes without an API action call.
- Add a persisted attempt counter and a hard cap with escalation to a human queue on the cap or on any permanent error. Verify: a simulated permanent failure escalates after one attempt.
- Run the agent over the historical problem items. Verify: each closes, succeeds once, or escalates, and none loops.
Variant phrasings
retry loop never converges quarantine release api failed
The non-converging variant.
agent check state before action idempotent quarantine
The state check variant.
Compatibility: Quarantine and case APIs used by triage agents, agent task stores.
Why it happens
Loops like this are the agent version of a stuck button: the instruction list is static, the world has moved on, and nothing reconciles them. State-first design, read, compare, then act only on a real gap, is the general cure for the whole class.
Edge cases / pitfalls
- Escalations need the full attempt history attached, or the human repeats the same diagnosis.
- A loop detector counting repeated identical actions across runs catches new variants of this bug early.
- Distinguish transient from permanent errors using the API own error codes, not optimism.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_3l6XhbPHoTFX-G83fMfYnQ