## TL;DR

Delegations form a cycle (A delegates to B, B delegates to A) and the walker follows it forever. Track visited approvers during the walk, stop with a clear error on revisit, and report the cycle to an admin to break.

## Error

```text
agent's approval-chain walker hung with error on circular delegation
```

## Steps

1. Add a visited set to the walker: record each approver as the walk advances. Expected: the walk has memory of where it has been.
2. On encountering an already-visited approver, stop and raise a circular-delegation error naming the cycle. Expected: a hang becomes a clear, fast error.
3. Add a maximum chain depth as a backstop (for example, 20 steps). Expected: even exotic cycles terminate.
4. Report the cycle (the ordered list of approvers) to the expense admin. Expected: the admin breaks the delegation loop.
5. After the admin fix, re-run the walker to confirm the chain resolves. Expected: the chain terminates at a final approver.

## When to use

- An approval-chain walker hangs or loops.
- Delegations may form a cycle.

## When not to use

- The chain has a missing approver (see the broken-chain skill).
- The walker is slow but terminates (performance tuning).

## Tool compatibility

- Custom approval-chain walkers in audit agents.

## Variant phrasings

### Circular delegation detected in approval chain

The error-form phrasing of the same problem.

### Approval walk never terminates

The hang symptom.

## Why it happens

Delegation is a graph, not a list, and nothing prevents cycles in the configuration. A walker without cycle detection follows the cycle until something external kills it.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_qAXc2W8f-jlrAXFz7VQ_vA
