Skip to content

Fixes agent version being created with wrong id

Eduardo Bonet requested to merge ai_agents/fix_send_message_request into master

What does this MR do and why?

Fixes agent version being created with wrong id

The agent id was being used to query messages, when agent_version id should be used.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

Example below:

  1. Ensure you have an EE license activated

  2. Enable the feature flag and populate the database:

    Feature.enable(:agent_registry)
    p = Project.find_by_id(1)
    agent = Ai::Agent.create(project: p, name: 'agent_1')
    Ai::AgentVersion.create!(agent: agent, project: p, prompt: "Prompt 1", model: "claude")
    Ai::AgentVersion.create!(agent: agent, project: p, prompt: "Prompt 2", model: "claude")
  3. Load /-/ml/agents for the project used to create the agent, and click on the agent agent_1

  4. Open inspection tools, and select Network

  5. Type something and send a message. A new graphql request will be generated. If the code works, under Payload you will see gid://gitlab/Ai::AgentVersion/2, previously it would request gid://gitlab/Ai::AgentVersion/1 image

Edited by Eduardo Bonet

Merge request reports