Add version pinning logic in explore/project areas for AGENTS
What does this MR do and why?
Add version pinning logic in explore and project areas for agents only. Flows and the meta-data component will come in later MRs.
- Add
showLatestVersionprop and pass thru to children - Added tests to parent and leaf components
- Clarified test names and aligned some code style
References
This MR depends on !213420 (merged), which provides the needed GraphQL query updates to function.
Screenshots or screen recordings
In the "Before" section, I show the screens where you would already see an agent and then that same agent updated. The "After" screenshot shows the agent from the project scope after I had edited it from the explore area.
This would work the same way if the user edited the agent from within the project area instead of the Explore area as shown in the screenshots as well. After editing the agent from the project area, they would continue to see their original, pinned version there, but they would see the updated version in the Explore area.
| Before | After |
|---|---|
|
|
How to set up and validate locally
- Make sure to have a duo enabled project with the
global_ai_catalogfeature flag enabled - In the AI catalog, create a new agent and take note of the system prompt
- Enable this agent in a duo enabled project
- Navigate to that project’s Automate > Agents page and click on the agent you created
- You should see that the system prompt it the same as what you started with
- Also check the EDIT and DUPLICATE pages to ensure they start with the same system prompt
- Navigate back to the Explorer area and make an update to that agent's system prompt
- Navigate back to that same agent in your duo enable and click on it to see its details
- You should see that it's system prompt is still the original version you started with. This is because it has been pinned to that version and updates to the global agent item should not affect it.
- Also check the EDIT and DUPLICATE pages to ensure they start with the UPDATED system prompt
Pin the agent to a new version
- Now open up a rails console and update the pinned version of the agent you've been working with to v1.1.0
Ai::Catalog::ItemConsumer.last.update!(pinned_version_prefix: '1.1.0')
- Reload the project level agent page
- You should see that the system prompt is now aligned with the latest version
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.
Related to #580382



