From e901b64bedc1e2cbb5ac784530f32ca788ee453f Mon Sep 17 00:00:00 2001 From: majdyz Date: Mon, 13 Apr 2026 04:22:03 +0000 Subject: [PATCH] fix(test): fix _handle_low_balance mock signature to accept positional args The gated_processor fixture's fake_low_balance mock used **kwargs, but production code calls _handle_low_balance with positional args via asyncio.to_thread. This caused a silent TypeError caught by the broad except handler, making the handle_low_balance assertion fail (0 calls instead of 1). Updated mock to match the actual method signature. --- .../test/test_orchestrator_per_iteration_cost.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 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 611ab54fac..f166093d4c 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 @@ -492,8 +492,16 @@ def gated_processor(monkeypatch): fake_charge_extra, ) - def fake_low_balance(self, **kwargs): - calls["handle_low_balance"].append(kwargs) + def fake_low_balance( + self, db_client, user_id, current_balance, transaction_cost + ): + calls["handle_low_balance"].append( + { + "user_id": user_id, + "current_balance": current_balance, + "transaction_cost": transaction_cost, + } + ) monkeypatch.setattr( manager.ExecutionProcessor,