A recorded batch failure does not return the message to SQS 🟩

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-07 11:51:23 +00:00
parent 52b07e3ea4
commit f317233939

View file

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