From dba0b278e89064a4e344e6a928ca0dd488dd3ce7 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Mon, 19 Oct 2026 01:45:48 +1100 Subject: [PATCH] fix(postgres): repin parked and queued tasks that still name the root identity --- .../migrations/0054_task_pin_identity_root.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 internal/infrastructure/postgres/migrations/0054_task_pin_identity_root.sql diff --git a/internal/infrastructure/postgres/migrations/0054_task_pin_identity_root.sql b/internal/infrastructure/postgres/migrations/0054_task_pin_identity_root.sql new file mode 100644 index 000000000..d422e246c --- /dev/null +++ b/internal/infrastructure/postgres/migrations/0054_task_pin_identity_root.sql @@ -0,0 +1,13 @@ +-- A task pins its workflow definition when it first runs, so parked and queued +-- tasks keep the "identity: root" that 0053 removed from the stored definitions +-- and fail to resolve it on every retry. The digest is the pin's SHA-256. + +-- +goose Up +UPDATE tasks +SET workflow_definition_yaml = regexp_replace(workflow_definition_yaml, 'identity: root(?=\n|$)', 'identity: 6f129e29-0e26-5246-99bd-74cb4496203b', 'g'), + workflow_definition_digest = encode(sha256(convert_to(regexp_replace(workflow_definition_yaml, 'identity: root(?=\n|$)', 'identity: 6f129e29-0e26-5246-99bd-74cb4496203b', 'g'), 'UTF8')), 'hex') +WHERE status IN ('parked', 'queued') + AND workflow_definition_yaml ~ 'identity: root(\n|$)'; + +-- +goose Down +SELECT 1;