fix(core): handle nested plan files by resolving paths correctly#24854
fix(core): handle nested plan files by resolving paths correctly#24854mahimashanware wants to merge 1 commit intoworktree-con-plan-bugfrom
Conversation
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.
|
Hi @mahimashanware, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
🧠 Model Steering GuidanceThis PR modifies files that affect the model's behavior (prompts, tools, or instructions).
This is an automated guidance message triggered by steering logic signatures. |
Summary
This fixes a bug where
path.basenamewas incorrectly stripping directory structures from plan files (e.g., trying to write toplans/nested/file.mdwould incorrectly write toplans/file.md). By usingpath.resolveand verifying withisSubpath, nested files are now handled securely and correctly.Details
path.basenamelogic inedit.ts,write-file.ts, andplanUtils.tswith proper path resolution.