From ba3a26af3c3a7738fa3e47388227756fd59f9741 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Tue, 27 Oct 2026 11:44:23 +1100 Subject: [PATCH] fix(postgres): carry org, park class and park blocker on task list rows so a parked task's recovery link shows --- internal/infrastructure/postgres/postgresdb/tasks.sql.go | 8 +++++++- internal/infrastructure/postgres/queries/tasks.sql | 2 +- internal/infrastructure/postgres/store.go | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/infrastructure/postgres/postgresdb/tasks.sql.go b/internal/infrastructure/postgres/postgresdb/tasks.sql.go index af703645a..14dce36b8 100644 --- a/internal/infrastructure/postgres/postgresdb/tasks.sql.go +++ b/internal/infrastructure/postgres/postgresdb/tasks.sql.go @@ -609,7 +609,7 @@ const listTaskSummaries = `-- name: ListTaskSummaries :many SELECT id, owner, repo, issue_number, title, status, workflow, pr_number, tokens_used, iterations, attempt, park_reason, retry_count, created_at, updated_at, plan, plan_document, source, identity, binding_id, binding_version, - outputs, review_gate, rereview_rounds + outputs, review_gate, rereview_rounds, org_id, park_class, park_blocker FROM tasks WHERE ($1::text IS NULL OR org_id = $1) AND (cardinality($2::text[]) = 0 OR status = ANY($2::text[])) @@ -654,6 +654,9 @@ type ListTaskSummariesRow struct { Outputs string ReviewGate string RereviewRounds int64 + OrgID string + ParkClass string + ParkBlocker string } // The dashboard's list. This projection is deliberately narrow: Plan gates @@ -706,6 +709,9 @@ func (q *Queries) ListTaskSummaries(ctx context.Context, arg ListTaskSummariesPa &i.Outputs, &i.ReviewGate, &i.RereviewRounds, + &i.OrgID, + &i.ParkClass, + &i.ParkBlocker, ); err != nil { return nil, err } diff --git a/internal/infrastructure/postgres/queries/tasks.sql b/internal/infrastructure/postgres/queries/tasks.sql index 7c66c3bf1..738c64050 100644 --- a/internal/infrastructure/postgres/queries/tasks.sql +++ b/internal/infrastructure/postgres/queries/tasks.sql @@ -43,7 +43,7 @@ SELECT * FROM tasks WHERE owner = sqlc.arg(owner) AND repo = sqlc.arg(repo) AND SELECT id, owner, repo, issue_number, title, status, workflow, pr_number, tokens_used, iterations, attempt, park_reason, retry_count, created_at, updated_at, plan, plan_document, source, identity, binding_id, binding_version, - outputs, review_gate, rereview_rounds + outputs, review_gate, rereview_rounds, org_id, park_class, park_blocker FROM tasks WHERE (sqlc.narg(scope_org)::text IS NULL OR org_id = sqlc.narg(scope_org)) AND (cardinality(@statuses::text[]) = 0 OR status = ANY(@statuses::text[])) diff --git a/internal/infrastructure/postgres/store.go b/internal/infrastructure/postgres/store.go index 91ac15b97..4f0fe13aa 100644 --- a/internal/infrastructure/postgres/store.go +++ b/internal/infrastructure/postgres/store.go @@ -778,6 +778,7 @@ func (s *Store) TasksPage(ctx context.Context, page storecontract.TaskPage) ([]w Identity: r.Identity, BindingID: r.BindingID, BindingVersion: int(r.BindingVersion), Outputs: outputs, ReviewGate: r.ReviewGate, RereviewRounds: int(r.RereviewRounds), + Org: org.OrgID(r.OrgID), ParkClass: r.ParkClass, ParkBlocker: r.ParkBlocker, }) } return tasks, nil