## TL;DR
Polling loops need an exit. Cap the attempts, back off between polls, and treat still-pending after the cap as a stuck task to investigate, not a reason to keep polling.

```text
license agent loop timed out re-polling SCIM provisioning status, run failed
```

## Use this when
- An agent polls a SCIM provisioning status until its own timeout fires.
- The provisioning task is stuck server-side.
- The loop has no attempt cap.

## Not for this skill when
- The task completes quickly. Then the poll loop is fine as is.
- The status API itself errors. Fix the API issue first.
- The agent should use webhooks. That is the long-term fix; this skill is the guardrail.

## Steps
1. Set a maximum poll count and a total timeout for the loop. Verify: both are enforced.
2. Back off between polls: 5 seconds, 10 seconds, 30 seconds, and so on. Verify: the interval grows.
3. When the cap hits, record the provisioning task as stuck and move on. Verify: the run continues past it.
4. Alert on the stuck task for human or follow-up-agent investigation. Verify: the alert fires.
5. Confirm the loop always terminates. Verify: no run exceeds the timeout.

## Variant phrasings
### SCIM polling loop
The short phrasing.
### provisioning status timeout
The state-first search.
### agent loop timed out
The generic phrasing.

Compatibility: Any SCIM provisioning status polling, any agent runtime.

## Why it happens
Unbounded polling turns a stuck provisioning task into a stuck agent. The task will not complete no matter how long the agent waits, so the loop needs to give up and escalate.

## Edge cases / pitfalls
- Tasks completing just after the cap; the next run picks them up, so design for that.
- Webhooks as the better pattern where the target supports them; polling is the fallback.
- The cap set so low that slow-but-healthy tasks get flagged; tune from real timings.
- The alert going nowhere; a stuck task nobody sees is the same as no cap.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_3sF8BFpgb6k1YnJuPfJLnQ
