Skip to content

[Bug]: Autopilot schedule creation fails with 'invalid autopilot id' when autopilot not yet created #5865

Description

@sacrtap

Bug 描述

创建定时任务(autopilot schedule)时,UI 报错:

  • "该 cron 表达式无效。"
  • "invalid autopilot id"

根因分析

核心问题:UI 在 autopilot 资源未创建完成前就提交 schedule 配置,后端校验 autopilot ID 不存在返回 invalid autopilot id

连带问题:cron 表达式 0 10 * * * 本身是合法的标准 5 字段 cron(每天 10:00),其报错为前端校验误报。

复现步骤

  1. 进入 autopilot 创建流程
  2. 填写 schedule 配置(cron: 0 10 * * *,时区:Asia/Shanghai)
  3. 提交表单
  4. 报错:invalid autopilot id + 该 cron 表达式无效。

截图

Image

环境信息

  • Multica CLI: 0.4.8
  • 平台版本: 1.18.4
  • 运行时模式: local
  • 浏览器:Chrome (assumed)

期望行为

  • 方案 A(推荐):将"创建 autopilot"和"添加 trigger"合并为原子 API 调用,前端一次提交,后端事务性完成两步
  • 方案 B:前端表单增加状态守卫 — autopilot 创建未返回成功 ID 前,schedule 提交按钮 disabled
  • 方案 C:前端在提交 schedule 时检测 autopilot ID 是否存在,不存在则自动先创建 autopilot 再提交 schedule

临时绕过方案

通过 CLI 直接创建:

# 第一步:创建 autopilot
multica autopilot create --title "<标题>" --description "<描述>" --agent <agent> --mode create_issue

# 第二步:添加定时触发
multica autopilot trigger-add <autopilot-id> --kind schedule --cron "0 10 * * *" --timezone Asia/Shanghai

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions