Skip to content

Fix autopilot schedule preview version mismatch (ZIC-121)#5907

Open
vicksiyi wants to merge 1 commit into
multica-ai:mainfrom
vicksiyi:multica-fix/issue-5865-autopilot-schedule-version-mismatch
Open

Fix autopilot schedule preview version mismatch (ZIC-121)#5907
vicksiyi wants to merge 1 commit into
multica-ai:mainfrom
vicksiyi:multica-fix/issue-5865-autopilot-schedule-version-mismatch

Conversation

@vicksiyi

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes the autopilot schedule editor's error mapping when a newer web frontend talks to an older backend that does not have GET /api/autopilots/cron-preview.

Older backends can route cron-preview as /api/autopilots/{id} and return 400 {"error":"invalid autopilot id"}. The editor previously treated that 400 as a cron rejection, so valid cron like 0 10 * * * could be shown as invalid. This PR detects unsupported preview endpoints separately, keeps the schedule submittable, and shows localized self-host/backend-version guidance instead of a cron error.

Related Issue

Closes #5865

Multica issue: ZIC-121

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Refactor / code improvement (no behavior change)
  • Tests (adding or improving test coverage)
  • Documentation update
  • CI / infrastructure

Changes Made

  • Added isCronPreviewUnsupported classification for missing/unsupported preview routes, including the legacy invalid autopilot id 400.
  • Updated the schedule editor to exclude unsupported preview failures from cron validation and render backend-version mismatch copy.
  • Added localized unsupported-preview messages for EN, zh-Hans, JA, and KO.
  • Added focused regressions for both the submit gate and rendered editor state.

How to Test

  1. Open the schedule editor against an older backend that lacks GET /api/autopilots/cron-preview.
  2. Enter 0 10 * * * with Asia/Shanghai.
  3. Confirm the editor shows backend preview support guidance, does not mark the cron invalid, and does not disable save because of the preview route mismatch.

Local validation:

  • pnpm --filter @multica/views exec vitest run autopilots/components/schedule-editor/validate.test.ts
  • pnpm --filter @multica/views exec vitest run autopilots/components/schedule-editor/schedule-editor.test.tsx
  • pnpm --filter @multica/views typecheck
  • pnpm --filter @multica/views lint (passes with existing warnings outside this change)
  • make check-worktree was attempted, but the local Docker daemon was unavailable while the target checked PostgreSQL, so the full worktree pipeline did not progress past DB setup.

Checklist

  • I have included a thinking path that traces from project context to this change
  • I have run tests locally and they pass
  • I have added or updated tests where applicable
  • If this change affects the UI, I have included before/after screenshots
  • I have updated relevant documentation to reflect my changes
  • If I added a new runtime / coding tool / UI tab, I synced the change to landing copy (apps/web/features/landing/i18n/) and relevant docs (apps/docs/content/docs/)
  • If this PR touches Chinese product copy, I checked it against apps/docs/content/docs/developers/conventions.zh.mdx (terminology, mixed-rule for task / issue / skill)
  • I have considered and documented any risks above
  • I will address all reviewer comments before requesting merge

AI Disclosure

AI tool used: Multica Agent

Prompt / approach:
Traced the schedule editor preview query and submit gate, reproduced the mismatch via targeted mocked ApiError responses, then added the smallest UI-side classification and localized message changes with focused Vitest coverage.

Screenshots (optional)

Not included. This change is copy/error-state handling covered by component tests; no local backend with the old route shape was available for a live before/after screenshot.

Co-authored-by: multica-agent <github@multica.ai>
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

@vicksiyi is attempting to deploy a commit to the IndexLabs Team on Vercel.

A member of the Team first needs to authorize it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant