Skip to content

0.3.3: stop one large file poisoning every audit in a repo - #4

Merged
TAJD merged 1 commit into
mainfrom
fix/large-file-audit-buffer
Sep 19, 2026
Merged

TAJD merged 1 commit into
mainfrom
fix/large-file-audit-buffer

Conversation

@TAJD

@TAJD TAJD commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Summary

auditChanges read the pre-command contents of each changed file with git show <tree>:<path> under Node's default 1MB execFileSync buffer. Any tracked file over roughly 1MB threw ENOBUFS, and the bare catch set oldText = '' — so the file diffed as if every line were newly added, and all of its pre-existing, human-authored comments were attributed to whatever command had just run.

Observed in a real repo: one 2.5MB untracked HTML artifact caused every Bash call to be blocked, blaming a file the agent had never touched.

Two changes:

  • maxBuffer: 256 * 1024 * 1024 on the git show call.
  • A failed read is no longer taken as proof the file is new. git cat-file -e decides: a path present in the snapshot tree but unreadable is skipped, not blamed. This is the part that actually closes the class, the buffer bump alone just moves the threshold.

Test plan

  • New regression test: a >2MB tracked file appended to without adding comments. Fails on main (audit reports a violation), passes with the fix.
  • npm test — 154 pass, 0 fail.
  • Manifest validation job run locally: manifests ok.

Version bumped to 0.3.3 in package.json and plugin.json together, per the parity gate added in #2.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HB3yGBbL5aiL9m7ZBg9ahM

`git show <tree>:<path>` ran with Node's default 1MB execFileSync buffer.
Any tracked file over ~1MB threw ENOBUFS, the catch set oldText to '', and
the whole file then read as newly added, attributing all of its pre-existing
comments to whatever command happened to run next. In practice a single
2.5MB untracked HTML artifact blocked every Bash call in the repo.

Raise the buffer to 256MB and, more importantly, stop treating a failed
read as proof the file is new: `git cat-file -e` now decides, and a path
that is in the snapshot tree but unreadable is skipped rather than blamed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HB3yGBbL5aiL9m7ZBg9ahM
@TAJD
TAJD merged commit 2e4eb6f into main Sep 19, 2026
7 checks passed
TAJD added a commit that referenced this pull request Oct 5, 2026
A heredoc redirect or tee (e.g. cat <<EOF > script.sh) was being
flagged the same as sed/perl in-place edits and pre-emptively denied,
forcing Edit/Write for a case the existing pre/post snapshot audit
already handles correctly. Reported as live friction: it blocked a
working script-generation approach mid-task.

Rebased onto 0.3.4 (temp-dir exemption + all-targets check); renumbered
from 0.3.3, which #4 already used.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FcfZR5roFkrPHCxKBUgdoC
TAJD added a commit that referenced this pull request Oct 5, 2026
A heredoc redirect or tee (e.g. cat <<EOF > script.sh) was being
flagged the same as sed/perl in-place edits and pre-emptively denied,
forcing Edit/Write for a case the existing pre/post snapshot audit
already handles correctly. Reported as live friction: it blocked a
working script-generation approach mid-task.

Rebased onto 0.3.4 (temp-dir exemption + all-targets check); renumbered
from 0.3.3, which #4 already used.



Claude-Session: https://claude.ai/code/session_01FcfZR5roFkrPHCxKBUgdoC

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant