gemini-cli - 💡(How to fix) Fix Plan Mode Path Flattening in `write_file` [1 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#25131Fetched 2026-04-11 06:31:17
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×2cross-referenced ×1
RAW_BUFFERClick to expand / collapse

What happened?

A critical path-handling bug occurs specifically in Plan Mode when using the write_file tool during the execution of newTrack via the Conductor extension. Even when authorized to write within a specific directory (e.g., base_dir/), any attempt to write to a nested subdirectory (e.g., base_dir/nested/path/file.md) results in the tool stripping all intermediate directories and writing the file directly to the root of the authorized directory (base_dir/file.md).

This behavior causes silent overwriting of existing root-level files (such as index.md) if a nested file shares the same name.

  • Intended Path: conductor/tracks/<id>/index.md
  • Actual Execution Result: conductor/index.md (Overwrites the main project index)

What did you expect to happen?

The tool should preserve the full relative path provided in the file_path argument, provided that the entire path resides within the authorized directory tree. The directory hierarchy should be respected exactly as specified by the AI agent during the Plan Mode execution.

Client information

About Gemini CLI
CLI Version0.37.1
Git Commit3b2d4f1
Modelgemini-3-flash-preview
Sandboxno sandbox
OSdarwin

Login information

Google Account (via OAuth)

Anything else we need to know?

In Plan Mode, the framework's attempts to organize track-specific files into subfolders result in the accidental destruction of the project's root index.md.

Ref: gemini-cli-extensions/conductor#159

We verified that this only occurs in Plan Mode. In Default Mode, the path handling works correctly and preserves the directory structure.

extent analysis

TL;DR

The write_file tool in Plan Mode should be modified to preserve the full relative path when writing files to authorized directories.

Guidance

  • Verify that the file_path argument passed to the write_file tool includes the full relative path, including any nested directories.
  • Check the implementation of the write_file tool in the Conductor extension to ensure it correctly handles relative paths and does not strip intermediate directories.
  • Consider adding a test case to the Conductor extension to validate path handling in Plan Mode, comparing the intended path (conductor/tracks/<id>/index.md) with the actual execution result.
  • Review the documentation for the write_file tool to ensure it accurately describes its behavior in Plan Mode and Default Mode.

Example

No code snippet is provided due to the lack of specific implementation details in the issue.

Notes

The issue seems to be specific to the Conductor extension in Plan Mode, and the root cause may be related to how the write_file tool handles relative paths. Further investigation into the extension's code is necessary to determine the exact cause and implement a fix.

Recommendation

Apply a workaround to modify the write_file tool in the Conductor extension to correctly handle relative paths in Plan Mode, as the issue is specific to this mode and the Default Mode works as expected.

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