Skip to content

fix(tui): persist permission mode defaults#915

Draft
yuanzhi-code wants to merge 1 commit into
MoonshotAI:mainfrom
yuanzhi-code:codex/persist-permission-mode-defaults
Draft

fix(tui): persist permission mode defaults#915
yuanzhi-code wants to merge 1 commit into
MoonshotAI:mainfrom
yuanzhi-code:codex/persist-permission-mode-defaults

Conversation

@yuanzhi-code

Copy link
Copy Markdown

Related Issue

Fixes #914

Problem

Runtime permission changes made inside the TUI updated only the active session. After enabling /yolo, /auto, or selecting a mode through /permission, a newly opened terminal still started from the previously configured default permission mode.

What changed

Persist successful runtime permission mode changes to defaultPermissionMode through the harness config API, so new sessions inherit the latest mode selected in the TUI.

This covers /yolo, /auto, and /permission, while keeping runtime and config error handling separate:

  • runtime permission failures are not persisted;
  • config persistence failures are reported without rolling back the already-applied session state;
  • unchanged /permission selections still save the selected mode as the default.

Testing

  • PATH=/tmp/node-v24.15.0-darwin-arm64/bin:$PATH pnpm --filter @moonshot-ai/kimi-code exec vitest run test/tui/kimi-tui-message-flow.test.ts
  • PATH=/tmp/node-v24.15.0-darwin-arm64/bin:$PATH pnpm --filter @moonshot-ai/kimi-code run typecheck
  • PATH=/tmp/node-v24.15.0-darwin-arm64/bin:$PATH pnpm exec oxlint --type-aware apps/kimi-code/src/tui/commands/config.ts apps/kimi-code/test/tui/kimi-tui-message-flow.test.ts
  • git diff --check

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

changeset-bot Bot commented Jun 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 588a7af

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

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.

Persist runtime permission mode changes as session defaults

1 participant