-
Notifications
You must be signed in to change notification settings - Fork 98
fix: GeminiCliSubagent.fromFile() discards subdirectory paths via basename #1424
Description
Background
In PR #1409, GeminiCliSubagent was converted from a simulated subagent (extending SimulatedSubagent) to a native subagent (extending ToolSubagent directly). During this conversion, the fromFile method retained the old basename(relativeFilePath) call from the simulated pattern. However, native subagents (e.g., ClaudecodeSubagent) use relativeFilePath as-is without stripping directory components.
Details
In src/features/subagents/geminicli-subagent.ts, the fromFile method applies basename to relativeFilePath:
relativeFilePath: basename(relativeFilePath),This means if relativeFilePath contains a subdirectory (e.g., subdir/nested-agent.md), the directory component is silently discarded. This inconsistency with ClaudecodeSubagent.fromFile() (which preserves the full relative path) could cause issues when:
- Round-tripping subagent files (read -> convert -> write back)
- Deleting subagent files that live in subdirectories
- Any operation that relies on the stored
relativeFilePathto locate the original file
The existing test ("should handle file path with subdirectories") only checks getBody() and getFrontmatter(), not getRelativeFilePath(), so this gap is not caught.
Solution / Next Steps
- Remove the
basenamecall inGeminiCliSubagent.fromFile()and passrelativeFilePathdirectly, matching theClaudecodeSubagentpattern. - Update the subdirectory test to also assert that
getRelativeFilePath()preserves the full path including directory components.