Skip to content

fix(v1): preserve exact filenames during capture - #2241

Open
gtnv wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
gtnv:fix/untracked-filenames
Open

fix(v1): preserve exact filenames during capture#2241
gtnv wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
gtnv:fix/untracked-filenames

Conversation

@gtnv

@gtnv gtnv commented Aug 4, 2026

Copy link
Copy Markdown

Closes: #2196

untracked filenames lost identity in 2 spots: runtime output (replaced by invalid utf-8) and git parsed savednames (pathspecs). now, snapshotting now reads the raw bytes and rejects any unsupported filenames before capture. however, reset will treat every saved name literally. added test for coverage.


Note

Medium Risk
Touches finalize-time patch capture used for SWE grading; behavior changes only for edge-case filenames but can affect which paths are ignored or whether setup fails on invalid UTF-8 names.

Overview
Fixes two ways pre-agent filenames could be corrupted or mis-handled when building the agent diff for grading.

snapshot_untracked no longer relies on decoded command stdout. It writes git ls-files --others NUL output to a unique temp file, reads it with the byte-preserving runtime API, and decodes paths as UTF-8 so invalid names raise instead of being silently rewritten.

capture_patch unstaging of ignored paths now runs git --literal-pathspecs reset, so names that look like pathspec magic (e.g. :(glob)*.py) stay literal and are not expanded when excluded from the cached diff.

Adds integration coverage for literal pathspec handling during capture and for UnicodeDecodeError on non-UTF-8 untracked names.

Reviewed by Cursor Bugbot for commit c87239c. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix filename preservation during git capture by using literal pathspecs and strict UTF-8 decoding

  • Adds --literal-pathspecs to the git reset step in git.py so filenames containing Git pathspec magic prefixes (e.g. :(glob)) are treated as literal paths rather than pathspec expressions.
  • Rewrites snapshot_untracked to read raw bytes from git ls-files -z output via a temp file instead of decoding with replacement, so filenames are decoded strictly as UTF-8.
  • Risk: snapshot_untracked now raises UnicodeDecodeError on non-UTF-8 filenames instead of silently returning a mangled path.

Macroscope summarized c87239c.

Read snapshot filenames without lossy decoding and exclude them with literal Git pathspec semantics.

Added test for coverage.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c87239c. Configure here.

Comment thread verifiers/v1/utils/git.py
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.

v1: harden capture_patch handling of pre-existing untracked filenames

1 participant