From 759e3c2e586c041de794ac7fc0c468b3551a2140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fiere?= Date: Mon, 7 Sep 2026 16:56:56 +0000 Subject: [PATCH 1/2] fix: drop orphaned CI auto-fix queue rows without reservation --- .../internal/orchestrator/ci_automation_attempt.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/backend/internal/orchestrator/ci_automation_attempt.go b/apps/backend/internal/orchestrator/ci_automation_attempt.go index d3b150c69fa..b4b0c1cec66 100644 --- a/apps/backend/internal/orchestrator/ci_automation_attempt.go +++ b/apps/backend/internal/orchestrator/ci_automation_attempt.go @@ -103,10 +103,10 @@ func (s *Service) reconcileOrphanedCIAutoFixQueueEntries( continue } } - if ackErr := s.messageQueue.AcknowledgeQueued( - context.WithoutCancel(ctx), &entry, - ); ackErr != nil { - return fmt.Errorf("remove orphaned CI auto-fix queue entry %q: %w", entry.ID, ackErr) + if removeErr := s.messageQueue.RemoveEntry( + context.WithoutCancel(ctx), entry.SessionID, entry.ID, + ); removeErr != nil && !errors.Is(removeErr, messagequeue.ErrEntryNotFound) { + return fmt.Errorf("remove orphaned CI auto-fix queue entry %q: %w", entry.ID, removeErr) } } return nil From dad8fe319d278d7922a4c8650b9134abfbf698d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fiere?= Date: Tue, 8 Sep 2026 09:09:27 +0000 Subject: [PATCH 2/2] fix(task): route queue schema probe through db dialect --- apps/backend/internal/task/repository/sqlite/session.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/apps/backend/internal/task/repository/sqlite/session.go b/apps/backend/internal/task/repository/sqlite/session.go index cdbd6823128..92a75e81694 100644 --- a/apps/backend/internal/task/repository/sqlite/session.go +++ b/apps/backend/internal/task/repository/sqlite/session.go @@ -2920,14 +2920,7 @@ func unmarshalSessionSnapshots( // in this task transaction. Some repository unit tests intentionally omit the // message queue schema; production databases always include it. func (r *Repository) queueSessionLockTablePresent(ctx context.Context) (bool, error) { - var present bool - var err error - if dialect.IsPostgres(r.db.DriverName()) { - err = r.db.GetContext(ctx, &present, `SELECT to_regclass('queue_session_locks') IS NOT NULL`) - } else { - err = r.db.GetContext(ctx, &present, `SELECT EXISTS (SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'queue_session_locks')`) - } - return present, err + return db.TableExistsContext(ctx, r.db, "queue_session_locks") } // DeleteTaskSession deletes the exact session incarnation and its pending queue