feat(duo_workflows): accept the idle flow status
What does this MR do and why?
GitLab is adding a new Duo agent session status, idle: the agent finished its turn and the session takes a next message, as opposed to input_required, which waits on the user (gitlab!262822 (merged)). GLQL checks DuoWorkflows statuses against a fixed list, so dashboards can't filter or count idle sessions yet: the DAP Impact dashboard needs to count them as completed, status in ("finished", "idle") (gitlab#634550 (closed)).
This adds idle to FLOW_STATUSES, the single list behind the status filter, the status dimension and totalCount(status:), and regenerates src/schema/schema.json. On the GitLab side, Analytics::AggregationEngines::DuoWorkflows reads its statuses from the workflow state machine, so it accepts idle once the Rails MR is deployed. Until then, the engine ignores the unknown name.
How to set up and validate locally
cargo test --test duo_workflows_tests- Compile a query through the Ruby extension (see below):
status = "idle"compiles tostatus: ["idle"], and an unknown name such as"idled"is still rejected with a list that now includesidle.
Example Usage
cd glql_rb
bundle install
bundle exec rake compileCount Developer sessions that are idle
mode: analytics
query: type = DuoWorkflow and flowType = "developer/v1" and status = "idle"
dimensions: status
metrics: totalCountTest via ruby extension
cd glql_rb # after the build prerequisite above
bundle exec ruby -Ilib - <<'RUBY'
require "gitlab_query_language"
ctx = { mode: "analytics", dimensions: "status", metrics: "totalCount", group: "gitlab-org" }
puts Glql.compile(%(type = DuoWorkflow and flowType = "developer/v1" and status = "idle"), ctx)["output"]
puts Glql.compile(%(type = DuoWorkflow and flowType = "developer/v1"), ctx.merge(dimensions: "flowType", metrics: %(totalCount(status="idle") as "Idle")))["output"]
RUBYGenerated GraphQL (excerpts):
duoWorkflows(workflowDefinition: ["developer/v1"], status: ["idle"]) {totalCount_status_idle: totalCount(status: ["idle"])Execution against GitLab.com is not shown: GitLab.com doesn't know idle until gitlab!262822 (merged) is deployed.