MoonshotAI / MoonshotAI/kimi-code

Bug: atomicWrite replaces symlink with regular file, breaking config.toml sync

Open
#751 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

Bug Description

When config.toml is a symlink (e.g., ln -s /iCloud/config.toml config.toml), adding/removing providers in kimi-code replaces the symlink with a regular file, breaking iCloud
sync.

Steps to Reproduce

  1. Create symlink: ln -s /path/to/icloud/config.toml ~/.kimi-code/config.toml
  2. Start kimi-code
  3. Add a provider via UI or CLI
  4. Check ~/.kimi-code/config.toml — it's now a regular file, not a symlink

Expected Behavior

The symlink should be preserved; only the target file's content should be updated.

Root Cause

atomicWrite() in packages/agent-core/src/utils/fs.ts uses fs.rename(tmp, target) which replaces the directory entry. When target is a symlink, the symlink itself gets
overwritten.

Environment

  • OS: macOS (with iCloud Drive)
  • kimi-code version: 0.12.3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with atomicWrite() in packages/agent-core/src/utils/fs.ts and reproduce the behavior using the symlink setup described in the issue. Verify the change preserves the config.toml symlink while updating the target file's content, and add or update coverage for that behavior if the relevant tests are located.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.