[fix] Exclude hidden files from the Files configuration [AGE-4124] - #6523
[fix] Exclude hidden files from the Files configuration [AGE-4124]#6523ashrafchowdury wants to merge 4 commits into
Conversation
…nd list The Files section counted and listed dot-prefixed paths (.env, .claude/, .gitignore), which is plumbing rather than user content and made the count misleading. The count is a server-side scalar, so the backend's curated flat view (limit=0 count and order=recent list) now drops hidden paths; the recency branch's own hidden filter folds into it. The summary hook drops them from its record-log recents and depth=1 root fallback, since depth=1 must keep serving them to the browse explorer. Raw listings, the browse tree, depth=1 levels, storage and runtime are unchanged: the explorer still shows hidden files behind its show-hidden toggle. Closes #6027
The count cap bounded the DESCENT in raw objects but reported the count after curation, so the two were measured in different units. A drive with a large .claude/ or agents/ tree spent its whole budget on files that were then filtered away, and reported a needless "N+" when its real files could have been counted exactly. Hiding dotfiles from the count made that worse. Prune hidden and runner-internal directories during the walk, where .git and gitignored directories were already pruned, so the budget covers what the caller counts. The file-level filters stay for the matching file in a kept directory, which no directory prune can reach.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe change excludes hidden paths from curated backend listings and session drive summaries. It updates count behavior, pruned traversal, documentation, and tests. Raw, browse, and shallow listings continue to retain hidden paths. ChangesHidden path filtering
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change filters hidden paths from displayed file counts and curated summaries while retaining them in raw and browse-oriented listings. No concrete merge-blocking risk remains in the supplied change context. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Team
Run ID: d0ec67e8-ef4c-47e3-9d9f-6d87d3159e64
📒 Files selected for processing (4)
api/oss/src/core/mounts/service.pyapi/oss/tests/pytest/unit/test_mounts_file_ops.pyweb/packages/agenta-entities/src/drive/useSessionDrive.tsweb/packages/agenta-entities/tests/unit/summary-drive-path.test.ts
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.
…unt budget isSummaryDrivePath was called at three sites but its definition never landed on this branch, so the package did not compile and the new tests could not run. The count cap also still charged hidden files sitting at a kept directory's own root, which no directory prune can reach. A root holding a few dotfiles could exhaust the budget and report "N+" for a drive that was countable exactly. The level scan now skips them, after reading .gitignore, which is itself hidden. Comments trimmed to the one-line rule in web/AGENTS.md.
cb3e4bd to
f7476f7
Compare
web/AGENTS.md caps in-code comments at one short line.
Railway Preview Environment
|
Context
The Files section of an agent's configuration counted and listed hidden files. On a session holding a clone of this repo, the drive carries 255 hidden entries (
.env,.gitignore,.claude/,.github/and similar plumbing) on top of its real files, and all of them landed in the count and the list. The count was the misleading part: it is the number a user reads to answer "how much is in this drive", and it was answering a different question.The count is produced server side (
limit=0returns a scalartotal), so this could not be fixed in the UI alone. The backend's curated flat view already dropped dotfiles from the recency list but not from the count that labels it. That mismatch was the bug.Changes
The count and the flat list (
mounts/service.py). Thegit_awareflat view now drops hidden paths beforetotalis computed, so the badge and the list it labels agree. The recency branch had its own duplicate hidden filter, which folded into this one. Raw listings, the browse tree anddepth=1are untouched, which is what keeps the explorer's show-hidden toggle working.The summary's own lists (
useSessionDrive.ts). The record log lives in the client, so the server never sees it and cannot filter it.useSessionDriveSummarydrops hidden paths from its record-log recents and itsdepth=1root fallback. The rule is named once asisSummaryDrivePathrather than spelled out at each of the three call sites, following the same one-question ruleisListableDrivePathalready documents.Both changes live in
packages/, so mobile and desktop get them from one place.Second commit: the count budget
Fixing the count exposed an older problem underneath it.
_COUNT_CAPbounded the descent in raw objects but reported the count after curation, so the two were measured in different units..gitand gitignored directories were already pruned during the walk, but hidden and runner-internal ones were not. A drive with a large.claude/oragents/tree spent its whole budget on files that were then filtered away, and reportedN+when its real files could have been counted exactly.Pruning hidden and internal directories during the walk completes the set, so every directory-prunable filter now prunes in the same place:
The file-level filters stay, for the matching file sitting in a kept directory (a root
.gitignore, an.env, a stray*.pyc), which no directory prune can reach. That split is the pattern gitignore already used. It is also a real perf win, since a.claude/or.github/tree is no longer enumerated at all.Tests
Backend, 63 passing in
test_mounts_file_ops.py. Seven are new: the curated list and count exclude hidden paths, the raw contract still keeps them,depth=1still keeps them, a hidden tree and anagents/tree no longer spend the count budget, and a genuinely large visible tree still caps. The three budget tests were confirmed to fail with the prune reverted, so they pin the behaviour rather than just passing.Frontend, 5 new unit tests on
isSummaryDrivePath, including that it is strictly narrower thanisListableDrivePath, since the explorer depends on the wider question.Verified against a live EE stack on a session holding a clone of this repo:
.claude,.github,.gitignoreWhat to QA
notes.md,.env, and a.config/folder with a file inside. The Files count in the configuration panel reads1 file, not3, and the list shows onlynotes.md..envand.config/are both still there, dimmed. This is the regression to watch for: they must remain browsable, since only their presentation changed.+unless the drive genuinely holds more than 20000 visible files.Closes #6027