Fail flow trigger workload when branch creation fails

What does this MR do and why?

This MR fixes an error in Ai::FlowTriggers::RunService where a ServiceResponse object was being returned directly instead of a Hash, causing a "no implicit conversion of ServiceResponse into Hash" error.

The issue occurred when branch creation failed - the service was trying to return a ServiceResponse from branch_args method, but the calling code expected a hash to splat into keyword arguments.

Changes

  • Modified branch_args to always return a ServiceResponse:
    • On success: returns ServiceResponse.success(payload: { ref: branch_name })
    • On failure: returns the error ServiceResponse from the branch service
  • Updated run_workload to check the ServiceResponse and extract the ref from the payload
  • When branch creation fails, the entire workload execution now fails with the appropriate error message
  • Added test coverage for the branch creation failure scenario

Related issues

Closes #issue_number_here (if applicable)

Merge request reports

Loading