From f317233939ffb797c70fae06d0345f99ec0b8880 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 7 Jul 2026 11:51:23 +0000 Subject: [PATCH] =?UTF-8?q?A=20recorded=20batch=20failure=20does=20not=20r?= =?UTF-8?q?eturn=20the=20message=20to=20SQS=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- utilities/aws_lambda/task_handler.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/utilities/aws_lambda/task_handler.py b/utilities/aws_lambda/task_handler.py index 695153add..de191ffb9 100644 --- a/utilities/aws_lambda/task_handler.py +++ b/utilities/aws_lambda/task_handler.py @@ -13,6 +13,7 @@ from uuid import UUID from utilities.aws_lambda.cloud_logs import cloudwatch_url from utilities.aws_lambda.default_orchestrator import default_orchestrator +from domain.tasks.subtasks import SubTaskFailure from domain.tasks.tasks import Source from orchestration.task_orchestrator import TaskOrchestrator @@ -87,6 +88,19 @@ def task_handler( work=lambda: func(body, context), cloud_logs_url=cloud_logs_url, ) + except SubTaskFailure as recorded: + # A recorded failure (ADR-0055): run_subtask has already + # failed the SubTask with the structured details — that + # record IS the outcome. Never returned to SQS for retry; + # recovery is a deliberate re-send of the sub_task's + # own inputs. + logger.warning( + "subtask recorded failure, not retrying " + "(task_source=%s subtask_id=%s): %s", + task_source, + subtask_id, + recorded, + ) except Exception: logger.exception( "subtask failed (task_source=%s subtask_id=%s)",