Put ai_governance_enabled GAIG gate behind a feature flag

What does this MR do and why?

!261994 (merged) gated external agent session capture (GAIG) on the cascading ai_governance_enabled setting. That gate is premature:

  • ai_governance_enabled defaults to false, has no UI, and can only be set through the groups API.
  • The backfill for existing customers (https://gitlab.com/gitlab-org/gitlab/-/work_items/633222) has not run.
  • As a result, existing GAIG customers capturing external agent sessions are getting 403 Forbidden responses.

This MR puts the gate behind a new gitlab_com_derisk feature flag, ai_governance_session_gate (default off, actor: the project's root namespace):

  • Flag off (default): the five GAIG permissions (create_ai_agent_identity, create_ai_agent_session, create_ai_agent_audit_event, update_ai_agent_session, read_ai_agent_session) go back to the pre-!261994 (merged) behavior — gated on duo_external_agents_enabled of the root ancestor.
  • Flag on: the current behavior is kept — the permissions are gated on ai_governance_enabled.

The Groups API params, the ai_governance_enabled setting, and its cascade are unchanged.

This must land before the 19.6 stable branch is cut or be backported, so the regression does not ship in 19.6.

@jeanvdw FYI as author of !261994 (merged).

References

Screenshots or screen recordings

Not applicable: policy and documentation change only, no UI changes.

How to set up and validate locally

  1. In the Rails console, with a group project whose root ancestor has duo_external_agents_enabled on and ai_governance_enabled off:

    project = Project.find(<id>)
    user = project.team.developers.first
    Ability.allowed?(user, :create_ai_agent_session, project) # => true (flag off by default)
  2. Enable the flag for the root namespace and re-check:

    Feature.enable(:ai_governance_session_gate, project.root_ancestor)
    Ability.allowed?(user, :create_ai_agent_session, project) # => false until ai_governance_enabled is on

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.

Merge request reports

Loading
Loading