agent loop detected: re-running deprovision check on the same user, job failed
Breaks agents out of re-running the same deprovision check by recording per-user check outcomes and stopping after repeated identical results. Use when a deprovision check loops on one user. Not for checks whose results legitimately change.
TL;DR
The check's result never changes because the underlying state never changes, or the check reads stale state. Record the check outcome per user, stop checking that user after a few identical results, and investigate why the state is stuck.
agent loop detected: re-running deprovision check on the same user, job failedUse this when
- An agent re-checks the same user's deprovision status endlessly.
- The job only ends on timeout.
- The check result is identical every time.
Not for this skill when
- The state genuinely changes between checks. Then the loop is working.
- The check errors instead of returning. Fix the check.
- The loop spans users, not one user. That is a different loop shape.
Steps
- Store the last check result per user. Verify: the record exists.
- If the result is identical three times, stop checking that user this run. Verify: the loop breaks.
- Investigate why the state is not changing: stale cache versus really stuck. Verify: you know which.
- Fix the root cause: refresh the cache or unstick the deprovision. Verify: the state moves.
- Confirm the job completes. Verify: no user spins forever.
Variant phrasings
deprovision check loop
The short phrasing.
same user re-checked
The behavior-first search.
job failed loop
The generic phrasing.
Compatibility: Any agent running repeated status checks.
Why it happens
The agent treats checking again as progress. Without a change detector, a stable state looks like a task still in flight, so it checks forever.
Edge cases / pitfalls
- State that changes slowly; use longer intervals between checks, not infinite checks.
- The cache TTL being the real problem; the check is fine, the data is stale.
- Three identical results being too few for slow systems; tune the count.
- The investigation step skipped: the loop guard without the root-cause fix just hides the problem.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst5ubdYr8UgDu1HeZULEgRw