Exclude CLI sessions from the inbox "Needs a decision" tab on every page

Generated by an AI agent on Andrew's behalf; sources linked inline.

What does this MR do and why?

Part of #630923 (closed)

The backend half landed in !259823 (merged), which added the excludeSourceTypes argument this MR uses; this MR is the frontend half. The argument must be in production before the inbox flag is enabled anywhere: @gl_introduced cannot guard an argument, and an unknown argument fails both tabs.

The Duo panel inbox's "Needs a decision" tab fills with interactive CLI sessions parked in INPUT_REQUIRED after the user left the terminal. The interim fix hid them on the client, but only when the tab fit on one page; with more pages the raw page showed and the badge fell back to 20+.

The inbox's needsDecision alias now passes excludeSourceTypes: [DUO_CLI_INTERACTIVE, DUO_CLI_ACP]; the all alias does not, so CLI sessions stay on the All tab. duo_cli_run is deliberately not excluded: headless duo run has nobody at a terminal, so its INPUT_REQUIRED is a real decision. The client-side filter, its single-page guard and the flowMetadataVersion -interactive heuristic are removed; the badge count is now the server's. isInteractiveCliSession matches the real DUO_CLI_* enum values instead of the non-existent 'CLI' literal, and the inbox query selects sourceType so it can.

Everything here is behind the duo_panel_session_inbox feature flag (default off).

References

Screenshots or screen recordings

Seeded with 22 web sessions, 2 interactive CLI sessions, 1 ACP session and 1 duo_cli_run session, all in INPUT_REQUIRED (page size 20). "Before" is current master, which has the backend argument but not this change.

Before After
"Needs a decision", page 1: the ACP session is listed. Before, page 1 "Needs a decision", page 1: only the duo_cli_run row remains. After, page 1
"Needs a decision", page 2: both interactive CLI sessions are listed. Before, page 2 "Needs a decision", page 2: three web sessions, no CLI rows. After, page 2

On the All tab the CLI sessions are still listed, with the CLI row variant: After, All tab

How to set up and validate locally

  1. In a Rails console, enable the inbox flag:
    Feature.enable(:duo_panel_session_inbox)
  2. Create an interactive CLI session awaiting input, plus enough other awaiting-input sessions to get a second page, for example with bin/rails runner:
    user = User.find_by!(username: 'root')
    project = Project.first
    FactoryBot.create(:duo_workflows_workflow, :duo_cli, :input_required, user: user, project: project)
    21.times { |i| FactoryBot.create(:duo_workflows_workflow, :input_required, user: user, project: project, goal: "web #{i}") }
    (Requires require 'factory_bot_rails' and FactoryBot.find_definitions first if factories are not loaded in your console.)
  3. Open the Duo panel session inbox. The CLI session is on All and absent from "Needs a decision" on every page; the badge reads 20+ while more pages remain.

Specs:

yarn jest ee/spec/frontend/ai/duo_agents_platform/panel/agent_session_inbox_spec.js \
  ee/spec/frontend/ai/duo_agents_platform/panel/cli_sessions_spec.js \
  ee/spec/frontend/ai/duo_agents_platform/panel/agent_session_inbox_tab_spec.js
bin/rspec ee/spec/frontend/fixtures/ai_duo_panel_integration.rb   # regenerates the inbox fixtures
yarn jest:integration ee/spec/frontend/integration/ai_duo_panel/agent_session_inbox_spec.js

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.

Edited by Andrew Fontaine

Merge request reports

Loading
Loading