Bug: tildeifyPath treats sibling home directories as the current home (missing path-separator bound)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- cli
Research direction
Start in packages/core/src/utils/paths.ts and inspect the tildeifyPath() implementation and its callers in Footer.tsx and BackgroundTaskDisplay.tsx. Add focused coverage in packages/core/src/utils/paths.test.ts for exact home paths, child paths, sibling prefixes, and Windows paths; done means only the home directory and its descendants are tilde-prefixed.
Written by the indexing model from the issue text.
Description
What happened?
tildeifyPath() uses path.startsWith(homeDir) and then path.replace(homeDir, '~'). There is no check that the match is a full path segment.
If homedir() is /Users/al (or C:\Users\Al on Windows):
/Users/al/proj→~/proj(correct)/Users/albert/proj→~bert/proj(wrong)/Users/al→~(correct)
startsWith('/Users/al') is true for /Users/albert/..., so a different user's (or a longer username's) directory is displayed as under ~.
Used in the CLI footer and background-task display (Footer.tsx, BackgroundTaskDisplay.tsx). packages/core/src/utils/paths.test.ts never tests this function.
Repro (unit-level):
- Stub
homedir()/GEMINI_CLI_HOMEto/Users/al. - Call
tildeifyPath('/Users/albert/Documents/app'). - Actual:
~bert/Documents/app. Expected:/Users/albert/Documents/appunchanged.
What did you expect to happen?
Only the home directory itself, or paths under home + path.sep, should be tilde-prefixed.
Sibling prefixes (/Users/albert when home is /Users/al) must be left unchanged.
Client information
Reproduced from source on current main. Platform: macOS.
CLI Version: 0.59.0-nightly.20260825.g812f7a2bc
Login information
Not auth-related. Display-path helper in packages/core/src/utils/paths.ts.
Anything else we need to know?
Suggested fix: treat as home only when
p === home or p.startsWith(home + path.sep)
(and on Windows also home + '/' if callers pass forward slashes). Then replace that exact prefix with ~.
Add unit tests in paths.test.ts for:
- exact home →
~ - child of home →
~/... - sibling prefix (
/Users/alvs/Users/albert) → unchanged - Windows
C:\Users\AlvsC:\Users\Albert
I'd like to send a focused PR with tests after this is labeled help wanted.
- Dominant language
- TypeScript
- Stars
- 107k
- Forks
- 14.6k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 43
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google-gemini/gemini-cli
-
bug(core): explicit `--model gemini-3-pro-preview` silently rewritten to `gemini-3.1-pro-preview` Openarea/agent effort/medium kind/bug priority/p2 status/bot-triaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
google-gemini/gemini-cli#29417 · 1 comment ·
-
area/enterprise kind/bug priority/p2 status/bot-triaged
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
google-gemini/gemini-cli#29406 ·
-
area/agent status/need-triage
Difficulty 2/5 Half a day Newbie friendliness 78/100
google-gemini/gemini-cli#29360 ·
-
area/agent kind/bug priority/p2 status/bot-triaged
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
google-gemini/gemini-cli#29315 ·
-
area/non-interactive effort/small kind/bug priority/p2 status/bot-triaged status/need-information
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
google-gemini/gemini-cli#29308 · 2 comments ·
All issues in google-gemini/gemini-cli
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100