Skip to content

[Bug] AI module submit API does not reject non-draft versions, corrupting formal version status #15192

Closed

Description

@Sunrisea

Describe the bug

AI 模块(Prompt / Skill / AgentSpec)的 submit 接口缺少对版本状态的前置校验。当传入一个已经处于 online / offline / reviewing / reviewed 状态的正式版本时,接口不会拒绝请求,而是将该版本强制改为 reviewing 状态,导致正式版本被污染。

Expected behavior

submit 接口应仅允许 draft 状态的版本进入审核流程。对非 draft 版本调用 submit 时,应返回 HTTP 400 + INVALID_PARAM(20002) 错误,且不修改任何版本状态。

How to Reproduce

  1. 创建一个 Prompt 草稿版本 1.0.0
  2. Submit → Force-publish,使其变为 online
  3. 再次对 1.0.0 调用 POST /v3/admin/ai/prompt/submit
  4. 实际结果:接口返回 200 成功,1.0.0 状态被改为 reviewing
  5. 期望结果:接口返回 400,状态保持 online

Affected API

  • POST /v3/admin/ai/prompt/submit
  • POST /v3/admin/ai/skill/submit
  • POST /v3/admin/ai/agentspec/submit

Root Cause

  • AiResourceManager.moveToReviewing()(Skill/AgentSpec 共享路径)在执行状态变更前未校验版本是否为 draft
  • PromptOperationServiceImpl.submit() 使用独立路径,同样缺少状态校验

Additional context

  • Nacos version: 3.x (develop branch)
  • Module: ai

Activity

  1. changed the title [-]AI module submit API does not reject non-draft versions, corrupting formal version status[/-] [+][Bug] AI module submit API does not reject non-draft versions, corrupting formal version status[/+] on May 20, 2026
  2. added this to the 3.2.2 milestone on May 20, 2026
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.kind/enhancementCategory issues or prs related to enhancement.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions