feat(core): implement JIT plan directory provisioning with path safety#25384
feat(core): implement JIT plan directory provisioning with path safety#25384mahimashanware wants to merge 6 commits intofeature/plan-mode-custom-dirs-phase-2from
Conversation
|
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! |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces the third phase of dynamic extension plan directory resolution. It enhances the system's ability to handle custom plan storage locations by dynamically provisioning these directories on-demand while enforcing strict path safety to prevent unauthorized file system access. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
🛑 Action Required: Evaluation ApprovalSteering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged. Maintainers:
Once approved, the evaluation results will be posted here automatically. |
There was a problem hiding this comment.
Code Review
This pull request enhances the EnterPlanModeTool to automatically provision plan directories for active extensions, ensuring they exist before the agent attempts to write to them. This is particularly important for sandboxed environments where host directories must be pre-created. The implementation now iterates through active extensions and creates any configured custom plan directories alongside the default one. Feedback indicates that the logic should also consider the default directory specified in an extension's manifest if no user-specific setting is found.
c64d139 to
627d2a5
Compare
627d2a5 to
fe5fade
Compare
ece2b0c to
0bb1927
Compare
fe5fade to
e32ef3c
Compare
0bb1927 to
aad3e4b
Compare
There was a problem hiding this comment.
Code Review
This pull request updates the EnterPlanModeTool to support extension-specific plan directories. It now iterates through active extensions, resolving custom plan directories from user settings or extension manifests, and ensures they are created before entering plan mode. Feedback was provided regarding a potential issue where the path resolution logic might throw an error for non-existent directories, preventing their creation.
|
|
||
| if (customDir) { | ||
| try { | ||
| dirsToCreate.add(this.config.storage.getPlansDir(customDir)); |
There was a problem hiding this comment.
The getPlansDir(customDir) call will fail for any directory that does not already exist because resolveWorkspaceRelativePath uses resolveToRealPath, which throws an error if the path is missing. While Rule 2 mandates using resolveToRealPath for consistent path resolution, this strictness breaks JIT provisioning for new custom plan directories. The resolver or its usage should be updated to handle non-existent paths for creation purposes while maintaining the consistency required by Rule 2.
References
- Ensure consistent path resolution by using a single, robust function (e.g.,
resolveToRealPath) for all related path validations, including internal validations in components likeWorkspaceContext.
e32ef3c to
eee6466
Compare
|
Hi there! Thank you for your interest in contributing to Gemini CLI. To ensure we maintain high code quality and focus on our prioritized roadmap, we have updated our contribution policy (see Discussion #17383). We only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. All other community pull requests are subject to closure after 14 days if they do not align with our current focus areas. For this reason, we strongly recommend that contributors only submit pull requests against issues explicitly labeled as 'help-wanted'. This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding and for being part of our community! |
Summary
Phase 3 of the dynamic extension plan directory resolution implementation. This PR implements the logic for dynamically resolving and provisioning plan directories on-demand.
Details
getPlansDirinpackages/core/src/config/storage.tsto resolve paths based on theactiveExtensionNameand theplan.directorysetting.EnterPlanModeToolinpackages/core/src/tools/enter-plan-mode.tsto synchronously verify and create the target plan directory if it doesn't exist. This preventsENOENTerrors when sub-agents attempt to initialize in a new custom sandbox.resolveWorkspaceRelativePathto ensure that all extension-provided paths are jailed within the current workspace, preventing any accidental or malicious escapes.Related Issues
Depends on Phase 2 (PR #25383).
How to Validate
Run unit tests for plan mode entry and storage:
npm test -w @google/gemini-cli-core -- src/tools/enter-plan-mode.test.ts src/config/storage.test.tsPre-Merge Checklist