File Edit Restrictions
GitAuto restricts which files the model can edit during a test-generation run. By default, only test files and explicitly allowed files can be modified. Markdown files and GITAUTO.md are always editable. When errors are found in source files during the read-edit-test loop, those specific files are added to the allowlist so the model can fix them.
Why This Exists
Without restrictions, the model modifies production source code while trying to make tests pass. It changes function signatures, removes validation logic, or "fixes" the source to match wrong tests. The result is a PR that passes tests but breaks the application. File edit restrictions prevent this by making source files read-only unless errors explicitly point to them.
Why Models Edit Production Code
Models optimize for making tests pass, not for respecting file boundaries. If modifying a source file makes the test pass more easily, the model will do it - changing a function's signature, adding an export, or weakening a type constraint. The model sees test failure as the problem and any edit as a valid solution, with no inherent concept of "this file is off-limits." Training reinforces this: the reward signal is making tests pass. If modifying source code achieves that goal faster, the model has learned that is a valid strategy. No training signal distinguishes "good fix" from "you were not supposed to touch that file."
How It Works
Before each tool call that writes or modifies a file, GitAuto checks whether the target path is in the allowlist. Test files (matching patterns like *.test.ts, *_test.py, etc.) are always allowed. If a CI error or type-check error references a specific source file, GitAuto adds that file to the allowlist for subsequent iterations. Any attempt to edit a file outside the allowlist is blocked, and the model is told to focus on test files instead.
Related Features
- Error Files Editable - dynamically unlocks source files when errors point to them
Need Help?
Have questions or suggestions? We're here to help you get the most out of GitAuto.
Contact us with your questions or feedback!