Skip to content

fix(cli): tolerate pre-existing plan directory on OneDrive#9765

Open
truffle-dev wants to merge 1 commit intoKilo-Org:mainfrom
truffle-dev:fix/plan-mode-mkdir-recursive-onedrive-9755
Open

fix(cli): tolerate pre-existing plan directory on OneDrive#9765
truffle-dev wants to merge 1 commit intoKilo-Org:mainfrom
truffle-dev:fix/plan-mode-mkdir-recursive-onedrive-9755

Conversation

@truffle-dev
Copy link
Copy Markdown

Why

Plan mode crashes with EEXIST: file already exists when a kilocode workspace lives on a OneDrive-synced Windows path (#9755). The .kilo/plans directory is a OneDrive ReparsePoint, and Node's fs.mkdir(path, { recursive: true }) still throws EEXIST against ReparsePoint dirs in some Node versions even though recursive: true is supposed to be idempotent. Every plan turn fails before the plan file is written.

What changed

insertPlanReminders now goes through a small ensurePlanDir helper that pre-checks the directory with Filesystem.isDir and only calls mkdir when the dir doesn't already exist. POSIX behavior is unchanged; on the OneDrive ReparsePoint case the throwing mkdir call is skipped entirely.

How to test

bun test ./test/kilocode/ensure-plan-dir.test.ts from packages/opencode/. The new tests cover the missing-dir, idempotent-existing-dir, and recursive-parents cases.

Closes #9755

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented May 1, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • packages/opencode/src/kilocode/session/prompt.ts
  • packages/opencode/test/kilocode/ensure-plan-dir.test.ts

Reviewed by gpt-5.5-2026-04-23 · 102,242 tokens

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.

Plan mode fails with EEXIST on OneDrive-synced repositories (ReparsePoint directories)

1 participant