Skip to content

[Bug] Cross-type version contamination when querying ai_resource_version by name #14836

Closed

Description

@Sunrisea

Describe the bug

When querying version list for a prompt (or skill), if an agentspec with the same name exists, its versions are also returned in the result. This is because the internal listAll() method queries ai_resource_version table only by namespace_id and name, without filtering by the type column.

How to Reproduce

  1. Create a prompt named "test-abc"
  2. Create an agentspec also named "test-abc" with a different version
  3. Open the prompt detail page for "test-abc"
  4. The version list incorrectly shows the agentspec version as well

Root Cause

PromptOperationServiceImpl.loadAllVersionRows() and SkillOperationServiceImpl use AiResourceVersionPersistService.listAll() which generates SQL like:

SELECT * FROM ai_resource_version WHERE namespace_id = ? AND name = ?

Missing the AND type = ? condition, causing all resource types with the same name to be returned.

Expected behavior

Version queries should be isolated by type. Each resource type (prompt / skill / agentspec) should only see its own versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/AIkind/bugCategory issues or prs related to bug.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions