[PR #8402] fix(session): use directory instead of root for plan mode paths #12726

Open
opened 2026-02-16 18:17:37 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8402

State: open
Merged: No


What does this PR do?

Fixes #8389

When Instance.worktree is "/" (non-git projects), the Session.plan() function was creating paths like /.opencode/plans/... at the system root, which fails with EACCES: permission denied, mkdir /.opencode.

This PR fixes the issue by using Instance.directory (the actual working directory) when worktree is "/" to create plan files in the correct location.

How did you verify your code works?

  • Code review of the fix logic
  • Verified the pattern matches similar handling in cli/cmd/agent.ts for global vs project scopes
  • Confirmed the typecheck error on @gitlab/gitlab-ai-provider is pre-existing in upstream/dev (unrelated to this change)

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8402 **State:** open **Merged:** No --- ### What does this PR do? Fixes #8389 When `Instance.worktree` is "/" (non-git projects), the `Session.plan()` function was creating paths like `/.opencode/plans/...` at the system root, which fails with `EACCES: permission denied, mkdir /.opencode`. This PR fixes the issue by using `Instance.directory` (the actual working directory) when `worktree` is "/" to create plan files in the correct location. ### How did you verify your code works? - Code review of the fix logic - Verified the pattern matches similar handling in `cli/cmd/agent.ts` for global vs project scopes - Confirmed the typecheck error on `@gitlab/gitlab-ai-provider` is pre-existing in upstream/dev (unrelated to this change) --- 🤖 Generated with Claude Code
yindo added the pull-request label 2026-02-16 18:17:37 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12726