Skip to content

Add version upgrade check and option for agents (frontend)

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Context/About

We will complete a minimal iteration of versioning that will automatically version pin items for everyone except the owners of the items. See #578589 and other related issues. This will provide customers with security when using items from the catalog that changes made to items are not automatically applied to their use of the item.

As we will be automatically version pinning in #578589, when customers are viewing agents or flows they have enabled, they must be able to see if the version they added to their project is no longer the latest version of the item. They must optionally be able to upgrade to the latest version after seeing the full details of the item at its latest version.

For context, there is a corresponding backend issue Add version pinning to enabled items (backend) (#578589). It will ensure all items are version pinned to the specific latest version of the item when it is added/enabled for the project, excepting the project that "owns" the item which will not be version pinned. So after those changes, we can expect the pinnedVersionPrefix GraphQL field of item consumers to always be either:

  • null, or
  • N.N.N - specific version string, example "1.2.0"

Proposal

  1. When viewing agents and flows a project have enabled the user should see if the latest version of the item is different from what they've had pinned
  2. The user can optionally review the latest version of the item by clicking on it to see its full details, and then can optionally update their version pin to that latest version

Technical proposal

Using the existing GraphQL fields being added in !209740 (merged).

frontend checks if item's aiCatalogItem.latestVersion(released: true) versionName is different from the pinnedVersionPrefix of the item consumer for the project.

Example GraphQL call:

{
  aiCatalogItem(id: "gid://gitlab/Ai::Catalog::Item/177") {
    id
    latestVersion(released: true) {
      humanVersionName
      versionName
    }
    configurationForProject(projectId: "gid://gitlab/Project/32") {
      id
      enabled
      pinnedVersionPrefix
    }
  }
}

Example GraphQL response:

{
  "data": {
    "aiCatalogItem": {
      "id": "gid://gitlab/Ai::Catalog::Item/177",
      "latestVersion": {
        "humanVersionName": "v1.2.0",
        "versionName": "1.2.0"
      },
      "configurationForProject": {
        "id": "gid://gitlab/Ai::Catalog::ItemConsumer/29",
        "enabled": true,
        "pinnedVersionPrefix": "1.1.0"
      }
    }
  },
  "correlationId": "01K9B0QH802E4EK3YJ9JSMZ1VK"
}

Note:

  • The versionName field does not prefix versions with a "v" prefix like the humanVersionName does, and as the pinnedVersionPrefix field also does not prefix with "v", the fields can be used for comparison.
  • If pinnedVersionPrefix is null, this means they are using the latest version - and so we would not alert.

If the item has a newer version than the version pinned, signal within the index view of the item that a newer version is available for review.

image

The user can review the latest version of the item by clicking on the item to view the full details of the item at the latest version. They can then optionally update the item consumer's version pin to the latest version using the existing GraphQL mutation if they choose to.

image

Clicking ... to show new "Upgrade" option.

image

To upgrade the item, make the following GraphQL mutation, where:

  • id is the Global ID of the consumer, the configurationForProject returned in the example GraphQL query above.
  • pinnedVersionPrefix is the versionName of the latestVersion of the item returned in the example GraphQL query above
mutation {
  aiCatalogItemConsumerUpdate(input: {
    id: "gid://gitlab/Ai::Catalog::ItemConsumer/33",
    pinnedVersionPrefix: "1.5.0"
  }) {
    errors
    itemConsumer {
      id
      pinnedVersionPrefix
    }
  }
}
Edited by Luke Duncalfe