Draft: Refuse edits to Duo Self-Hosted models linked to AI features

What does this MR do and why?

Editing a Duo Self-Hosted model an AI feature uses is now refused. Edit opens a modal listing those features, and the edit form refuses on load. On 19.1.1, a family change was accepted while the feature kept routing to the model.

Implements option 2 of #500244, recommended by @timnoah; @mhamda closed it in a backlog sweep.

@eduardobonet expects rare edits, mostly API tokens or the endpoint; exempting them needs a separate path in the form and editable?. Should it?

No feature flag: it refuses one admin update.

flowchart TD
    A[Admin selects Edit on a model] --> B{Does an AI feature setting use it?}
    B -- Yes --> E[Cannot-edit modal lists the features]
    B -- No --> C[Edit form opens]
    F[Direct URL to edit form] --> J{Linked on load?}
    J -- Yes --> K[Form shows the refusal, Save disabled]
    J -- No --> C
    C --> G[Save sent to aiSelfHostedModelUpdate]
    G --> H{UpdateService: linked now?}
    H -- No --> D[Update saves]
    H -- Yes --> I[Error returned, row unchanged]

An AI coding assistant wrote this change. The assistant also checked each claim against the cited issue notes and the changed source and ran the project's linters and the related specs on a disposable development environment, and the docs linters locally.

References

Screenshots or screen recordings

None yet; the modal reuses the cannot-delete modal.

How to set up and validate locally

  1. In Admin > GitLab Duo > Configure models for GitLab Duo, add a self-hosted model and select it for a feature on AI-native features.
  2. On Self-hosted models, select Actions > Edit. The modal lists the feature.
  3. Opening the edit URL directly shows the refusal, with Save changes disabled.
  4. Move the feature to another model. Edit opens and saves.

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