From 389b2f4fb26f3a7dee36dae7f29faed19a7e762e Mon Sep 17 00:00:00 2001 From: majdyz Date: Fri, 10 Apr 2026 13:33:04 +0000 Subject: [PATCH] test(orchestrator): align IBE test with no-error-set fix The test asserted result_stats.error is set to the IBE, but commit b662eab36 removed that line from the IBE handler in on_node_execution because it caused node_error_count++ inconsistency and leaked balance amounts into persisted node_stats. Update the test to assert result_stats.error is None (the structured ERROR log is the alerting hook now, not the .error field). Co-Authored-By: Claude Opus 4.6 (1M context) --- .../test/test_orchestrator_per_iteration_cost.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/autogpt_platform/backend/backend/blocks/test/test_orchestrator_per_iteration_cost.py b/autogpt_platform/backend/backend/blocks/test/test_orchestrator_per_iteration_cost.py index f1806bf6dc..1c8fca368b 100644 --- a/autogpt_platform/backend/backend/blocks/test/test_orchestrator_per_iteration_cost.py +++ b/autogpt_platform/backend/backend/blocks/test/test_orchestrator_per_iteration_cost.py @@ -506,8 +506,11 @@ async def test_on_node_execution_insufficient_balance_records_error_and_notifies """When extra-iteration charging fails with InsufficientBalanceError: - the run still reports COMPLETED (the work is already done) - - execution_stats.error is set so monitoring picks it up + - execution_stats.error is NOT set (would flip node_error_count and + leak balance amounts into persisted node_stats — see manager.py + comment in the IBE handler) - _handle_insufficient_funds_notif is called so the user is notified + - the structured ERROR log is the alerting hook """ from backend.data.execution import ExecutionStatus from backend.executor import manager @@ -542,8 +545,11 @@ async def test_on_node_execution_insufficient_balance_records_error_and_notifies nodes_input_masks=None, graph_stats_pair=stats_pair, ) - # Error recorded on stats so downstream monitoring can surface it. - assert isinstance(result_stats.error, InsufficientBalanceError) + # error stays None — node ran to completion, only the post-hoc + # charge failed. Setting .error would (a) flip node_error_count++ + # creating an "errored COMPLETED node" inconsistency, and (b) leak + # balance amounts into persisted node_stats. + assert result_stats.error is None # User notification fired. assert len(calls["handle_insufficient_funds_notif"]) == 1 assert calls["handle_insufficient_funds_notif"][0]["user_id"] == "u"