Engineering notes/A KeeperHub bug we found

A KeeperHub bug we found

A reproducible bug in KeeperHub's own workflow engine, found while building the default-detection workflow — filed and currently open.

The symptom#

The Default Detection + Deposit Draw workflow walks every circle, then every member of each circle, checking for missed contributions — a Condition node nested two For Each loops deep. In every execution we ran, that condition never fired, even for members confirmed on-chain to have genuinely missed a contribution.

The root cause#

KeeperHub's workflow executor is open source. Tracing the bug to its own code, the nested For Each callback (handleNestedForEach) resolves each node's next step using the inner loop's own partial edge map, rather than the workflow's global edge map — the same lookup that works correctly for a top-level, non-nested node. A condition nested inside two loops never resolves to its own outgoing edges, so it silently never executes, with no error surfaced anywhere.

What we tried first#

  • Restructuring the workflow to avoid the second nesting level.
  • Adding an explicit Collect node to flatten the loop output before the condition.
  • Re-reading KeeperHub's own documentation for a nested-loop pattern we'd missed.
  • Only after those didn't resolve it did source-diving into KeeperHub's executor turn up the actual root cause above.

Current status#

Filed as KeeperHub/keeperhub#2049 — open, with three reproduction execution IDs and a suggested one-line fix pointing at the exact line. The workflow itself is correctly configured against Cadence's deployed contracts and will start working the moment the fix ships; nothing about the bug is Cadence-side.

In the meantime, defaults aren't unrecoverable — the contract allows any member, not just the automated keeper, to call coverDeposit() manually, as covered in Managing a circle. The automation just isn't running that check on schedule yet.