Skip to content

fix(migration): map default_yolo to default_permission_mode instead of dead yolo field#124

Open
shuizhongyueming wants to merge 2 commits into
MoonshotAI:mainfrom
shuizhongyueming:fix/migration-default-yolo-mapping
Open

fix(migration): map default_yolo to default_permission_mode instead of dead yolo field#124
shuizhongyueming wants to merge 2 commits into
MoonshotAI:mainfrom
shuizhongyueming:fix/migration-default-yolo-mapping

Conversation

@shuizhongyueming
Copy link
Copy Markdown
Contributor

Related Issue

Resolve #123

Problem

The kimi-cli → kimi-code config migration step maps default_yolo = true to yolo = true in config.toml, but yolo is a dead field — no code in kimi-code reads it. Users who migrated from kimi-cli with yolo enabled end up without yolo mode after migration.

What changed

Changed the migration mapping from migratedTop["yolo"] = true to migratedTop["default_permission_mode"] = "yolo", which is the correct config key recognized by core-impl.ts for enabling yolo auto-approval mode.

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.

…f dead yolo field

The kimi-cli config key `default_yolo` was being migrated to `yolo` in
kimi-code config.toml, but `yolo` is a dead field that no code reads.
The real config key for yolo mode is `default_permission_mode = "yolo"`.
Copilot AI review requested due to automatic review settings May 27, 2026 15:20
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 27, 2026

🦋 Changeset detected

Latest commit: f1d0de0

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

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/migration-legacy Patch
@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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 27, 2026

pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@f1d0de0
npx https://pkg.pr.new/@moonshot-ai/kimi-code@f1d0de0

commit: f1d0de0

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1d0de07aa

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// kimi-cli's `default_yolo` is kimi-code's `yolo`.
if (v === true) migratedTop['yolo'] = true;
// kimi-cli's `default_yolo` maps to kimi-code's `default_permission_mode`.
if (v === true) migratedTop['default_permission_mode'] = 'yolo';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve existing camelCase permission setting

When the target config already has defaultPermissionMode = "manual" (which parseConfigString accepts because transformTomlData leaves camelCase keys as defaultPermissionMode), this adds a separate default_permission_mode = "yolo" instead of recording a conflict. After migration the transformed config contains both keys and the later snake_case entry wins, so a user-modified target config can be silently changed to yolo despite mergeConfig's “target value is never overwritten” policy. Please normalize/check the camelCase target key before adding this migrated value.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The config migration step fires at most once — on first launch when switching from kimi-cli to kimi-code. At that point the target config.toml is either missing, a default stub, or freshly generated — the user has not had a chance to manually edit it with camelCase keys. This edge case is not reachable in practice.

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: migration maps default_yolo to dead yolo field instead of default_permission_mode

1 participant