fix(filetracking): exclude build caches from tracked paths - #602
fix(filetracking): exclude build caches from tracked paths#602solvemproblr wants to merge 1 commit into
Conversation
Rollouts that compile inside the workspace record their compiler scratch as file changes. A single Go build cache can contribute thousands of patches and tens of megabytes of diffs to one trace, which buries the agent's actual edits. Extend DEFAULT_EXCLUDE_PATTERNS with tool and framework caches and a few more compiled artifacts. Go's cache is named go-build<random>, so it is matched as a name glob; trailing-slash entries only match a directory by exact name. Names that are sometimes real source directories (build, dist, target, coverage, tmp) stay tracked and are filtered in the viewer instead. Co-authored-by: Cursor <cursoragent@cursor.com>
a17c263 to
252a4f8
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 252a4f8. Configure here.
| # HUD CLI state written into env dirs (e.g. deploy's .hud/config.json). | ||
| ".hud/", | ||
| ".tmp/", | ||
| "go-build*", |
There was a problem hiding this comment.
Glob excludes non-cache go-build names
Medium Severity
go-build* is matched with fnmatch on every entry basename, so it is not limited to Go compile-cache directories. Any file or directory whose name starts with go-build is skipped and never appears in patches. That silently hides real source such as go-build.go, go-build.sh, or a go-builder package, and those exclusions cannot be recovered downstream.
Reviewed by Cursor Bugbot for commit 252a4f8. Configure here.


Summary
Rollouts that compile inside the workspace record their compiler scratch as file changes. On a trace we looked at this week, a single Go build cache under
.tmp/go-build<random>/produced thousands of patches and ~22 MB of the trace's 31 MB span payload, burying the nine files the agent actually edited and making the trace viewer unusable.This extends
DEFAULT_EXCLUDE_PATTERNSwith tool/framework caches (.tmp/,go-build*,.gradle/,.tox/,.pytest_cache/,.mypy_cache/,.ruff_cache/,.terraform/,.next/,.nuxt/,.svelte-kit/,.output/,.turbo/,.parcel-cache/) and a few more compiled artifacts (*.pyo,*.class,*.dll,*.dylib,*.exe). List-only change, 19 lines.Notes for review
Go's cache is matched as a name glob, not a directory entry.
_matchescompares trailing-slash patterns by exact name (name == dir_name/ substring), so it does not glob. Since the cache is namedgo-build<random>,go-build*/would silently never match — it has to be written without the slash, wherefnmatchruns against the entry name and still prunes the directory in_walk_directory. Worth keeping in mind when adding entries later.The list is deliberately conservative. Exclusions here are unrecoverable: the patches are never emitted, so nothing downstream can opt back in. Names that are sometimes genuine source directories —
build,dist,target,coverage,tmp— are therefore not added, even though the trace viewer filters them. The viewer's filter is presentation-only and has a toggle, so it can afford to be aggressive; this one cannot.I did not touch the size caps (
_MAX_DIFF_BYTESis 50 MiB per scan,_MAX_DIFF_FILE_BYTES1 MiB per file). Those are what allowed the payload to grow this large even with noise present, and are worth revisiting, but they change behavior for legitimate large diffs too, so they felt like a separate call.Test plan
pytest hud/environment/tests/{test_file_tracker,test_file_tracking,test_manifest}.py— 25 passed, no changes needed to existing expectationsruff checkandruff format --checkclean