Add the duo_developer_continuable_sessions feature flag

What does this MR do and why?

This MR adds the wip feature flag duo_developer_continuable_sessions and a flow_version_resolver on the Developer foundational flow that reads it. When the flag is on for the user or the container's top-level group, it selects developer/4.0.0. That version rests after each turn instead of ending, so people can follow up in the same session (gitlab-org#24022, rollout: #633281). It is the first Rails step of the continuable-sessions stack: with the flag off (the default), the resolver returns nil and sessions keep today's ^3.0.0.

For reviewers: developer/4.0.0 doesn't exist in the AI Gateway yet and follows in gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#3173; this flag is one step of that stack, and #633281 tracks when it gets enabled.

Existing specs changed to stub the flag off, because they describe today's behaviour:

  • ee/spec/lib/ai/duo_workflows/foundational_flow_start_params_resolver_spec.rb
  • ee/spec/models/ai/catalog/foundational_flow/developer/definition_spec.rb (existing examples; the new examples are in the same file)

References

Screenshots or screen recordings

Not applicable: no UI change.

How to set up and validate locally

How to test: in a Rails console (gdk rails c):

flow = Ai::Catalog::FoundationalFlow.developer_v1
group = Group.top_level.first
project = group.all_projects.first
user = User.first
other_user = User.where.not(id: user.id).first

# Flag off (default) -> "^3.0.0"
flow.resolve_flow_version_for(container: project, user: user)[:flow_version]

# Flag on for a user -> "^4.0.0"
Feature.enable(:duo_developer_continuable_sessions, user)
flow.resolve_flow_version_for(container: project, user: user)[:flow_version]
Feature.disable(:duo_developer_continuable_sessions, user)

# Flag on for the top-level group -> "^4.0.0" for anyone in a project below it
Feature.enable(:duo_developer_continuable_sessions, group)
flow.resolve_flow_version_for(container: project, user: other_user)[:flow_version]
# No container -> "^3.0.0", no error
flow.resolve_flow_version_for(container: nil, user: other_user)[:flow_version]
Feature.disable(:duo_developer_continuable_sessions, group)

# Back to "^3.0.0"
flow.resolve_flow_version_for(container: project, user: user)[:flow_version]

Not in this MR

Everything else in gitlab-org#24022, including:

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 Thomas Schmidt

Merge request reports

Loading
Loading