From c10e3239b540d3b687422637c7b4487f25d42bc0 Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Mon, 23 Mar 2026 01:16:50 -0400 Subject: [PATCH] fix: only remediate original tx when manual dispense fully succeeds If the manual dispense itself partially fails (e.g., cassette jam during remediation), the original failed transaction must stay in error state so the operator knows it still needs attention. Only mark as 'remediated' when result.dispensed === true (all requested bills out). Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/machine/electron/main.ts | 3 ++- apps/machine/src/stores/atm.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/machine/electron/main.ts b/apps/machine/electron/main.ts index df82c01..26a82ac 100644 --- a/apps/machine/electron/main.ts +++ b/apps/machine/electron/main.ts @@ -412,8 +412,9 @@ function startCommandPoller(): void { error: result.error, }) + // Only remediate the original tx if ALL requested bills were dispensed let refRemediated = false - if (parsed.ref_txid) { + if (parsed.ref_txid && result.dispensed) { refRemediated = remediateTransaction(parsed.ref_txid, txid) } diff --git a/apps/machine/src/stores/atm.ts b/apps/machine/src/stores/atm.ts index 513e3ca..1bcd1ec 100644 --- a/apps/machine/src/stores/atm.ts +++ b/apps/machine/src/stores/atm.ts @@ -104,9 +104,9 @@ async function handleManagementCommand( error: result.error, }) - // Remediate referenced failed transaction + // Only remediate the original tx if ALL requested bills were dispensed let refRemediated = false - if (request.ref_txid && isElectron && window.electronAPI) { + if (request.ref_txid && result.dispensed && isElectron && window.electronAPI) { refRemediated = await window.electronAPI.remediateTransaction(request.ref_txid, txid) if (refRemediated) { console.log('[ATM] Remediated failed tx:', request.ref_txid)