gemini-cli - ✅(Solved) Fix Extension cannot write subfolders or files under subfolders to plan directory. [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#24975Fetched 2026-04-09 08:16:41
View on GitHub
Comments
1
Participants
2
Timeline
10
Reactions
1
Timeline (top)
labeled ×3unlabeled ×2added_to_project_v2 ×1assigned ×1

Fix Action

Fixed

PR fix notes

PR #24854: fix(core): handle nested plan files by resolving paths correctly

Description (problem / solution / changelog)

Summary

This fixes a bug where path.basename was incorrectly stripping directory structures from plan files (e.g., trying to write to plans/nested/file.md would incorrectly write to plans/file.md). By using path.resolve and verifying with isSubpath, nested files are now handled securely and correctly.

Details

  • Replaced path.basename logic in edit.ts, write-file.ts, and planUtils.ts with proper path resolution.
  • Updated the path boundary validations to ensure malicious paths still fail securely.

Fixes #24975

Changed files

  • evals/plan_mode.eval.ts (modified, +37/-0)
  • packages/core/src/tools/edit.test.ts (modified, +2/-2)
  • packages/core/src/tools/edit.ts (modified, +15/-3)
  • packages/core/src/tools/write-file.ts (modified, +18/-3)
  • packages/core/src/utils/planUtils.test.ts (modified, +5/-5)
  • packages/core/src/utils/planUtils.ts (modified, +40/-13)

Code Example

> /about
# paste output here
RAW_BUFFERClick to expand / collapse

What happened?

Extensions with custom plan directories could not write nested files inside plan directory.

What did you expect to happen?

Files can be written at any path under teh custom plan directory.

Client information

<details> <summary>Client Information</summary>

Run gemini to enter the interactive CLI, then run the /about command.

> /about
# paste output here
</details>

Login information

No response

Anything else we need to know?

No response

extent analysis

TL;DR

  • Verify the permissions and configuration of the custom plan directory to ensure it allows writing nested files.

Guidance

  • Check the directory structure and permissions of the custom plan directory to identify any restrictions on writing nested files.
  • Review the documentation or configuration options for the extension to see if there are any specific settings or flags that need to be enabled to allow writing nested files.
  • Test writing a file directly in the custom plan directory to isolate if the issue is specific to nested files or a broader permission issue.

Notes

  • The exact solution may depend on the specific extension and its configuration, which is not provided in the issue.
  • Additional information about the extension, its version, and the environment it's running in could help narrow down the cause.

Recommendation

  • Apply workaround: Modify the extension's configuration or the custom plan directory's permissions to allow writing nested files, as this seems to be the most direct approach to resolving the issue given the information available.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING