From 36a7f7702fe1a844b156e9fe4d9499fc4ef61755 Mon Sep 17 00:00:00 2001 From: phroi <90913182+phroi@users.noreply.github.com> Date: Fri, 29 May 2026 11:32:14 +0000 Subject: [PATCH] fix(supervisor): stop on unclassified bot transactions --- apps/supervisor/src/index.test.ts | 17 +++++++++++++++++ apps/supervisor/src/index.ts | 13 ++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/apps/supervisor/src/index.test.ts b/apps/supervisor/src/index.test.ts index 3d3e3bf..8a7cf49 100644 --- a/apps/supervisor/src/index.test.ts +++ b/apps/supervisor/src/index.test.ts @@ -1381,6 +1381,23 @@ describe("classification", () => { }); }); + it("treats committed bot transactions without classifiable actions as terminal", () => { + const stdout = [ + botEvent("bot.transaction.built", { + actions: { collectedOrders: 0, completedDeposits: 0, matchedOrders: 0, deposits: 0, withdrawalRequests: 0, withdrawals: 0 }, + }), + botEvent("bot.transaction.committed", { txHash: txHash("47"), status: "committed" }), + ].map(JSON.stringify).join("\n"); + + expect(classifyActorResult("bot", commandResult("bot", stdout))).toMatchObject({ + outcome: "unknown", + terminal: true, + reason: "bot committed transaction evidence did not include classifiable action evidence", + actions: { matchedOrders: 0, deposits: 0, withdrawalRequests: 0, completedDeposits: 0, withdrawals: 0 }, + txHashes: [txHash("47")], + }); + }); + it("keeps match diagnostics tied to the matching state-read iteration", () => { const stdout = [ botEvent("bot.state.read", { diff --git a/apps/supervisor/src/index.ts b/apps/supervisor/src/index.ts index fd73858..95c2c7a 100644 --- a/apps/supervisor/src/index.ts +++ b/apps/supervisor/src/index.ts @@ -1371,9 +1371,20 @@ function classifyBotResult( if (actions === undefined) { return { ...base, outcome: "malformed_evidence", terminal: true, reason: "bot committed transaction evidence did not include matching built action evidence", publicState }; } + const outcome = classifyBotCommittedActions(actions); + if (outcome === "unknown") { + return { + ...base, + outcome, + terminal: true, + reason: "bot committed transaction evidence did not include classifiable action evidence", + actions, + publicState, + }; + } return { ...base, - outcome: classifyBotCommittedActions(actions), + outcome, terminal: false, reason: "bot transaction committed according to app evidence", actions,