Skip to content

[fix] Exclude hidden files from the Files configuration [AGE-4124] - #6523

Open
ashrafchowdury wants to merge 4 commits into
mainfrom
fix/hide-hidden-files-from-files-config
Open

[fix] Exclude hidden files from the Files configuration [AGE-4124]#6523
ashrafchowdury wants to merge 4 commits into
mainfrom
fix/hide-hidden-files-from-files-config

Conversation

@ashrafchowdury

Copy link
Copy Markdown
Contributor

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=0 returns a scalar total), 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). The git_aware flat view now drops hidden paths before total is 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 and depth=1 are 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. useSessionDriveSummary drops hidden paths from its record-log recents and its depth=1 root fallback. The rule is named once as isSummaryDrivePath rather than spelled out at each of the three call sites, following the same one-question rule isListableDrivePath already 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_CAP bounded the descent in raw objects but reported the count after curation, so the two were measured in different units. .git and gitignored directories were already pruned during the walk, but hidden and runner-internal ones were not. A drive with a large .claude/ or agents/ tree spent its whole budget on files that were then filtered away, and reported N+ 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:

if (
    _is_git_plumbing(dir_rel)
    or _is_internal_mount_path(dir_rel)
    or _is_hidden_path(dir_rel)
    or _path_gitignored(dir_rel, True, specs)
):
    continue

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=1 still keeps them, a hidden tree and an agents/ 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 than isListableDrivePath, since the explorer depends on the wider question.

Verified against a live EE stack on a session holding a clone of this repo:

result
Files count 14145, not capped
dotfiles in the flat listing and count 0 of 14145
hidden entries still served to the explorer 255, including .claude, .github, .gitignore

What to QA

  • Ask an agent to create notes.md, .env, and a .config/ folder with a file inside. The Files count in the configuration panel reads 1 file, not 3, and the list shows only notes.md.
  • Open the Files browser from that count. .env and .config/ are both still there, dimmed. This is the regression to watch for: they must remain browsable, since only their presentation changed.
  • Open a session with a cloned repo. The count no longer ends in + unless the drive genuinely holds more than 20000 visible files.
  • The count and list cache for 30 seconds, so give it a moment or hard-refresh before judging.

Closes #6027

…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.
@linear-code

linear-code Bot commented Sep 4, 2026

Copy link
Copy Markdown

AGE-4124

@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agenta-documentation Ready Ready Preview Sep 4, 2026 9:37am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Team

Run ID: b5ed2abc-16cd-4997-979f-ac766a24cce2

📥 Commits

Reviewing files that changed from the base of the PR and between f7476f7 and a93dbf7.

📒 Files selected for processing (1)
  • web/packages/agenta-entities/src/drive/useSessionDrive.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/packages/agenta-entities/src/drive/useSessionDrive.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Curated file listings now exclude hidden files, directories, and internal runner paths from results and totals.
    • File-count limits apply only to visible files, making “N+” indicators more accurate.
    • Git-aware listings now omit hidden paths and .gitignore while preserving existing filtering rules.
    • Summary drive views consistently exclude hidden paths, while raw and shallow views retain hidden entries.
  • Tests

    • Added coverage for hidden-path filtering, count limits, Git-aware listings, and supported agent file paths.

Walkthrough

The 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.

Changes

Hidden path filtering

Layer / File(s) Summary
Backend curated listing filtering
api/oss/src/core/mounts/service.py, api/oss/tests/pytest/unit/test_mounts_file_ops.py
Curated flat listings exclude hidden files from results and totals. Pruned traversal skips hidden and internal directories before applying count limits. Tests cover filtering, count limits, raw listings, and shallow listings.
Session summary path filtering
web/packages/agenta-entities/src/drive/useSessionDrive.ts, web/packages/agenta-entities/tests/unit/summary-drive-path.test.ts
Session summaries use isSummaryDrivePath to exclude hidden paths from record-derived entries and root-listing fallbacks. Tests cover hidden paths, internal paths, and agent mounts.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to a93db

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.67% which is insufficient. The required threshold is 60.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: excluding hidden files from the Files configuration.
Description check ✅ Passed The description directly explains the hidden-file count and listing bug, the backend and frontend fixes, preserved browse behavior, and related tests.
Linked Issues check ✅ Passed The changes satisfy issue #6027 by excluding hidden paths from the displayed count and configuration list while preserving hidden paths for raw listings, browsing, and underlying system use.
Out of Scope Changes check ✅ Passed The count-budget pruning, frontend summary filtering, and associated tests directly support the linked issue and correct count behavior. No unrelated changes are evident.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/hide-hidden-files-from-files-config

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between ded2cc3 and 6729733.

📒 Files selected for processing (4)
  • api/oss/src/core/mounts/service.py
  • api/oss/tests/pytest/unit/test_mounts_file_ops.py
  • web/packages/agenta-entities/src/drive/useSessionDrive.ts
  • web/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.

Comment thread api/oss/src/core/mounts/service.py
Comment thread web/packages/agenta-entities/src/drive/useSessionDrive.ts Outdated
Comment thread web/packages/agenta-entities/src/drive/useSessionDrive.ts
…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.
web/AGENTS.md caps in-code comments at one short line.
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-pr-6523.up.railway.app/w
Project agenta-oss-clone-spike
Image tag pr-6523-338f52f
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-09-04T09:42:33.769Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(feat) Exclude hidden files from file configuration

1 participant