From e558c60104416b101119a8afc75c5c8a09818caa Mon Sep 17 00:00:00 2001 From: majdyz Date: Mon, 13 Apr 2026 07:02:10 +0000 Subject: [PATCH] fix(orchestrator): don't propagate non-billing charge errors as tool failures Non-IBE exceptions from charge_node_usage (e.g. DB timeout) were re-raised and caught by the outer generic handler, incorrectly marking a successful tool execution as failed. This could cause the LLM to retry side-effectful operations. Now logs the error and continues to the success path since the tool itself completed successfully. --- .../backend/backend/blocks/orchestrator.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/autogpt_platform/backend/backend/blocks/orchestrator.py b/autogpt_platform/backend/backend/blocks/orchestrator.py index 34b4929879..3e956e8d6f 100644 --- a/autogpt_platform/backend/backend/blocks/orchestrator.py +++ b/autogpt_platform/backend/backend/blocks/orchestrator.py @@ -1192,13 +1192,16 @@ class OrchestratorBlock(Block): raise except Exception: # Non-billing charge failures (DB outage, network, etc.) - # are logged with full traceback but surfaced to the LLM - # as a generic error to avoid leaking infrastructure details. + # must NOT propagate to the outer except handler because + # the tool itself succeeded. Re-raising would mark the + # tool as failed (_is_error=True), causing the LLM to + # retry side-effectful operations. Log and continue. logger.exception( - "Unexpected error charging for tool node %s", + "Unexpected error charging for tool node %s; " + "tool execution was successful", sink_node_id, ) - raise + tool_cost = 0 if tool_cost > 0: self.merge_stats(NodeExecutionStats(extra_cost=tool_cost))