MoonshotAI / MoonshotAI/kimi-code
Bug: atomicWrite replaces symlink with regular file, breaking config.toml sync
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
- Create symlink:
ln -s /path/to/icloud/config.toml ~/.kimi-code/config.toml - Start kimi-code
- Add a provider via UI or CLI
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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