From be4ec541eed469a34ffd8b8bf6c4d371b8a69885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Salavisa?= Date: Wed, 4 Feb 2026 11:49:10 +0000 Subject: [PATCH] fix: rollback from review step works on simple boards (#177) --- .../backend/internal/orchestrator/event_handlers.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/backend/internal/orchestrator/event_handlers.go b/apps/backend/internal/orchestrator/event_handlers.go index 668b6158a6..74a6cd9180 100644 --- a/apps/backend/internal/orchestrator/event_handlers.go +++ b/apps/backend/internal/orchestrator/event_handlers.go @@ -346,16 +346,18 @@ func (s *Service) handleWorkflowTransition(ctx context.Context, taskID, sessionI return true } -// handleReviewStepRollback checks if the session is in a review step with pending status. +// handleReviewStepRollback checks if the session is in a review-type step. // If so, it moves the session back to the previous step (the step that led to the review step) // and clears the review status. This handles the case where the user sends a message to // iterate on the work instead of approving. +// Note: This works for both "simple" boards (where review steps don't require approval) and +// "advanced" boards (where review steps have RequireApproval=true). func (s *Service) handleReviewStepRollback(ctx context.Context, taskID, sessionID string) { if sessionID == "" || s.workflowStepGetter == nil { return } - // Get the session to check its current workflow step and review status + // Get the session to check its current workflow step session, err := s.repo.GetTaskSession(ctx, sessionID) if err != nil { s.logger.Warn("failed to get session for review rollback check", @@ -364,17 +366,14 @@ func (s *Service) handleReviewStepRollback(ctx context.Context, taskID, sessionI return } - // Only proceed if session has a workflow step and pending review status + // Only proceed if session has a workflow step if session.WorkflowStepID == nil || *session.WorkflowStepID == "" { return } - if session.ReviewStatus == nil || *session.ReviewStatus != "pending" { - return - } currentStepID := *session.WorkflowStepID - // Get the current workflow step to check if it requires approval + // Get the current workflow step to check if it's a review step currentStep, err := s.workflowStepGetter.GetStep(ctx, currentStepID) if err != nil { s.logger.Warn("failed to get workflow step for review rollback",