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)",