From 44f8f803aec9d8bc02e6997ea54ef6763c3b7b4c Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Fri, 27 Mar 2026 10:20:58 -0400 Subject: [PATCH] feat(state-machine): auto-clear confirmAbandon after 60s If a customer walks away from the abandon confirmation screen, the machine now returns to idle after 60 seconds instead of hanging indefinitely. Cash stays in the cashbox as operator funds. Closes #31 Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/state-machine/src/machine.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/state-machine/src/machine.ts b/packages/state-machine/src/machine.ts index 873087b..377f58b 100644 --- a/packages/state-machine/src/machine.ts +++ b/packages/state-machine/src/machine.ts @@ -507,7 +507,11 @@ export function createATMMachine( }, }, confirmAbandon: { - // Warning: cash is in the machine, abandoning forfeits it + // Warning: cash is in the machine, abandoning forfeits it. + // Auto-clear after 60s so the machine self-recovers if customer walked away. + after: { + 60000: '#atm.idle', + }, on: { CANCEL: '#atm.idle', // User confirms they want to leave RETRY: 'generatingNdebit', // Go back and try again