Workflow resume API

What does this MR do and why?

This merge request adds the ability to resume paused AI workflows that are waiting for human approval.

The main changes include:

  1. New API endpoint: Added a POST endpoint /api/v4/ai/duo_workflows/workflows/{workflow_id}/resume that allows users to provide approval decisions (approve/reject) along with optional messages when a workflow is paused and waiting for human input.
  2. Resume functionality: Created a new ResumeWorkflowService that extends the existing workflow start service to handle resuming paused workflows. It preserves previous workflow state and variables while adding the human approval decision and any accompanying message.

The feature enables a more interactive workflow experience where AI processes can pause for human review and approval before continuing with potentially sensitive operations.

References

Screenshots or screen recordings

UI page Screenshot/recording
Recording https://drive.google.com/file/d/11mA62Wdo8kfcU4mnwTOJDT7EhSX_kXDf/view?usp=sharing
User Sessions Screenshot 2026-04-02 at 11.36.29 AM.png
Automate > Sessions Screenshot 2026-03-27 at 2.19.16 PM.png

How to set up and validate locally

  1. Use this branch ss/spike-hitl from gitlab-ai-gateway, which adds the human_input component to the developer/experimental flow

  2. Pull from this branch and apply this patch

    diff --git a/ee/app/services/ai/duo_workflows/start_workflow_service.rb b/ee/app/services/ai/duo_workflows/start_workflow_service.rb
    index 5350bdc33963..356c3755e358 100644
    --- a/ee/app/services/ai/duo_workflows/start_workflow_service.rb
    +++ b/ee/app/services/ai/duo_workflows/start_workflow_service.rb
    @@ -4,7 +4,7 @@ module Ai
       module DuoWorkflows
         class StartWorkflowService
           IMAGE_PATH = "gitlab-org/duo-workflow/default-docker-image/workflow-generic-image:v0.0.6"
    -      DUO_CLI_VERSION = "8.77.0"
    +      DUO_CLI_VERSION = "8.82.0"
           DWS_STANDARD_CONTEXT_CATEGORY = "agent_platform_standard_context"
     
           def initialize(workflow:, params:)
    @@ -254,7 +254,7 @@ def set_up_executor_commands
               "command -v duo > /dev/null 2>&1 && ",
               "echo \"duo-cli already present, skipping installation\" || ",
               "{ echo \"Installing @gitlab/duo-cli@#{DUO_CLI_VERSION}...\" && ",
               "npm install -g @gitlab/duo-cli@#{DUO_CLI_VERSION}; }"
             ].join
     
             cli_setup_commands = [
    @@ -414,7 +414,7 @@ def resolve_developer_workflow(definition, project)
                 Feature.enabled?(:duo_developer_next_compatible, project.root_ancestor)
               'developer_next/experimental'
             else
    -          definition
    +          'developer/experimental'
             end
           end
    
  3. Click on Generate MR with Duo button for any issue work item. It should start execution and then exit the workload job when it has created an implementation plan

  4. Your workflow should be marked as input required in the UI

  5. Use below cURL to approve the implementation plan

    curl --request POST \
      --url http://gdk.test:3000/api/v4/ai/duo_workflows/workflows/$WORKFLOW_ID/resume \
      --header 'Authorization: Bearer $PAT' \
      --header 'content-type: application/json' \
      --data '{"human_approval":true}'
  6. It should start a new workload job linked with the session and finish it to completion

  7. You should see an MR linked at the of your session

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #594413 (closed)

Edited by Surabhi Suman

Merge request reports

Loading
Loading