agent's approval-chain walker hung with error on circular delegation
Fixes agent approval-chain walker hangs on circular delegation with cycle detection. Use when a chain walker loops forever on circular delegations. Not for broken chains with missing approvers.
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
agent's approval-chain walker hung with error on circular delegationSteps
- Add a visited set to the walker: record each approver as the walk advances. Expected: the walk has memory of where it has been.
- On encountering an already-visited approver, stop and raise a circular-delegation error naming the cycle. Expected: a hang becomes a clear, fast error.
- Add a maximum chain depth as a backstop (for example, 20 steps). Expected: even exotic cycles terminate.
- Report the cycle (the ordered list of approvers) to the expense admin. Expected: the admin breaks the delegation loop.
- 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/pstqAXc2W8f-jlrAXFz7VQvA