Skip to content

fix(cli): show migration failure reason#210

Open
lurenjia534 wants to merge 1 commit into
MoonshotAI:mainfrom
lurenjia534:fix/migration-failure-reason
Open

fix(cli): show migration failure reason#210
lurenjia534 wants to merge 1 commit into
MoonshotAI:mainfrom
lurenjia534:fix/migration-failure-reason

Conversation

@lurenjia534
Copy link
Copy Markdown

Related Issue

Part of #203

Problem

When kimi migrate fails, the migration screen currently drops the thrown error and only renders the generic Migration failed message. This leaves users without the immediate failure reason and makes migration issues harder to diagnose.

This PR does not claim to fix every possible post-migration provider or connection failure discussed in #203. It only addresses the narrower, reproducible diagnostic issue where the failed migration screen hides the underlying error.

What changed

The migration screen now preserves the rejection reason from the migration runner and renders it on the failure screen as Reason: ....

The formatter intentionally avoids stack traces and does not serialize arbitrary thrown objects. It shows Error.message, string rejections, primitive values, or a generic object/function fallback so the UI provides useful diagnostics without dumping unrelated object contents.

The existing failure-path test now asserts that the rendered screen includes both Migration failed and the underlying rejection reason.

Validation

  • pnpm --filter @moonshot-ai/kimi-code exec vitest run test/migration/migration-screen.test.ts
  • pnpm --filter @moonshot-ai/kimi-code run typecheck
  • pnpm exec oxlint --type-aware apps/kimi-code/src/migration/migration-screen.ts apps/kimi-code/test/migration/migration-screen.test.ts
  • pnpm --filter @moonshot-ai/kimi-code run test

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 29, 2026

🦋 Changeset detected

Latest commit: 8ec2520

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@lurenjia534 lurenjia534 marked this pull request as ready for review May 29, 2026 10:34
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.

1 participant