Add a statuses filter argument to duoWorkflowWorkflows for exact-state filtering
Note
This is not an MCP tool issue itself — it's a small GraphQL API prerequisite for #607635 (list_sessions MCP tool), found while redirecting that issue's implementation plan from Base::CustomService to the existing Query.duoWorkflowWorkflows query.
Problem Statement / Use Case
Query.duoWorkflowWorkflows filters by status_group (Types::Ai::DuoWorkflows::WorkflowStatusGroupEnum — ACTIVE, PAUSED, AWAITING_INPUT, COMPLETED, FAILED, CANCELED), which is coarser than callers sometimes need.
Concretely: #607635 wants to let an MCP agent filter sessions to "ones that need my approve/reject decision." The model's AWAITING_INPUT group bundles three raw states together: input_required (the flow is just resting between chat turns — no action needed) and plan_approval_required/tool_call_approval_required (the flow is stuck until the caller calls approve_duo_agent_action). Those need different agent behavior, but status_group can't tell them apart — filtering by AWAITING_INPUT returns all three mixed together, and the agent would have to call get_session on every result just to figure out which ones actually need a decision.
The raw-state enum already exists (Types::Ai::DuoWorkflows::WorkflowStatusEnum / DuoWorkflowStatus, used today for the per-object WorkflowType#status field) — it's just not exposed as a filter argument on the list side.
Proposed Change
Add a statuses argument (plural, [DuoWorkflowStatus]) to Resolvers::Ai::DuoWorkflows::WorkflowsResolver, filtering to an exact set of raw states — sibling to the existing status_group argument, not a replacement for it.
Resources
ee/app/graphql/resolvers/ai/duo_workflows/workflows_resolver.rb— add thestatusesargument alongsidestatus_group.ee/app/finders/ai/duo_workflows/workflows_finder.rb— add aresolve_statusesmethod mirroring the existing one-liner:def resolve_status_group(status_group) query.in_status_group(status_group) endee/app/graphql/types/ai/duo_workflows/workflow_status_enum.rb(DuoWorkflowStatus) — already public, reuse as the argument type.ee/app/models/ai/duo_workflows/workflow.rb—state_machines[:status].statesfor mapping enum values to DB status ints (same patternin_status_groupalready uses).
Implementation Plan
- Add
argument :statuses, [Types::Ai::DuoWorkflows::WorkflowStatusEnum], required: false, description: '...'toWorkflowsResolver. - Add
resolve_statuses(statuses)toWorkflowsFinder: map each enum value to its state-machine DB value and filter withquery.where(status: ...). - Decide interaction with
status_groupif both are passed in the same request — most consistent option is to require exactly one ofstatus_group/statuses, matching how other mutually-exclusive filters are enforced elsewhere in this finder. - Specs: resolver spec covering
statusesfiltering (including a case matching only 2 of the 3AWAITING_INPUTmembers), andspec/graphql/all_queries_spec.rbcoverage once#607635commits its.graphqlfile using the new argument.