Release workspace agents as an experimental feature

What does this MR do and why?

Workspace agents are custom sub-agents that a project defines in .agents/agents/*.md on its default branch. Duo Developer can use them.

We decided to release them as an experimental feature, with no new project setting. They are available when the existing Feature preview setting for GitLab Duo experiment and beta features is on. There is no per-project control:

  • On GitLab.com, it's a top-level group setting, changed by a group Owner in the group's Settings > GitLab Duo. All subgroups and projects in the group follow it.
  • On GitLab Self-Managed and GitLab Dedicated, it's an instance setting, changed by an administrator in Admin > Settings > GitLab Duo. All groups and projects follow it.

Projects that don't want agents can keep the files out with .gitignore or push rules.

Changes:

  • API::Helpers::DuoWorkflowHelpers#push_feature_flags now adds dap_workspace_agents to the x-gitlab-enabled-feature-flags header when the setting is on. This is a deliberate, temporary hack for the experimental release. No AI Gateway change is needed.
  • Ai::DuoWorkflows::StartWorkflowService always reads the repository's agents and passes them to remote sessions. The AI Gateway decides whether to use them.
  • The dap_workspace_agents wip feature flag is removed.
Why the AI Gateway header?

Agents run in two places:

  • Locally. Duo CLI reads the files from disk and sends them.
  • Remotely. GitLab reads them from the repository for CI sessions.

The AI Gateway is the only place that sees both. It already gates workspace agents on the dap_workspace_agents name in the x-gitlab-enabled-feature-flags header. So the simplest way to gate both paths is to send that name in the header when the setting is on. We don't expect the experimental release to last long, so we want an easy approach that ships in 19.5.

References

Screenshots or screen recordings

Not applicable. This is a backend-only change.

How to set up and validate locally

  1. In a GDK project with GitLab Duo Agent Platform working, commit .agents/agents/reviewer.md to the default branch with this content:

    ---
    name: reviewer
    description: Reviews diffs.
    tools: read_file
    ---
    Be picky.
  2. Turn the setting on. In the Rails console, run ApplicationSetting.current.update!(instance_level_ai_beta_features_enabled: true). You can also go to Admin > Settings > GitLab Duo > Change configuration, and under Feature preview select Use experiment and beta GitLab Duo features.

  3. Start a Duo Developer session in that project, locally with Duo CLI or remotely. Ask it to use the reviewer agent. The agent should be available.

  4. Turn the setting off with ApplicationSetting.current.update!(instance_level_ai_beta_features_enabled: false). Start a new session. Check that the reviewer agent is no longer available.

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.

🤖 Generated with Claude Code

Edited by Alexander Chueshev

Merge request reports

Loading
Loading