Loading
Draft: Add statuses filter argument to duoWorkflowWorkflows query
Summary
Implements the statuses filter argument for the duoWorkflowWorkflows GraphQL query as described in issue #608884 (closed).
This allows filtering workflows by exact raw states, complementing the existing status_group filter which is coarser-grained.
Problem
Query.duoWorkflowWorkflows filters by status_group which bundles multiple raw states together. For example, AWAITING_INPUT includes three different states:
input_required(flow is resting between chat turns — no action needed)plan_approval_required(flow is stuck until caller approves)tool_call_approval_required(flow is stuck until caller approves)
Callers need to distinguish between these states without fetching each workflow individually.
Solution
Adds a statuses argument (plural, [DuoWorkflowStatus]) to the resolver, allowing exact-state filtering as a sibling to status_group.
Changes
- WorkflowsResolver (
ee/app/graphql/resolvers/ai/duo_workflows/workflows_resolver.rb)- Add
statusesargument of type[Types::Ai::DuoWorkflows::WorkflowStatusEnum] - Pass
statusesto the WorkflowsFinder
- Add
- WorkflowsFinder (
ee/app/finders/ai/duo_workflows/workflows_finder.rb)- Add
resolve_statusesmethod that maps enum values to database status values - Uses the same pattern as
resolve_status_groupwithstate_machines[:status].states
- Add
- Workflow Model (
ee/app/models/ai/duo_workflows/workflow.rb)- Add
in_statusesscope to filter by exact status database values
- Add
- Tests
- Add comprehensive specs in
ee/spec/finders/ai/duo_workflows/workflows_finder_spec.rb - Add resolver tests in
ee/spec/graphql/resolvers/ai/duo_workflows/workflows_resolver_spec.rb - Tests cover single status, multiple statuses, and specific awaiting_input substates
- Add comprehensive specs in
Example Usage
# Get only workflows awaiting approval (not just resting between turns)
query {
duoWorkflowWorkflows(statuses: [PLAN_APPROVAL_REQUIRED, TOOL_CALL_APPROVAL_REQUIRED]) {
nodes {
id
status
}
}
}Closes #608884 (closed)