Safeguard
Security Guides•

What size and scope limits should a fix PR have?

Cap files, lines, directories, dependencies and daily volume for automated fix PRs. A starting table of limits and what to do when a change exceeds them.

Safeguard Security Team
4 min read

Limit each fix pull request by files, lines, directories and new dependencies, and limit how many a bot opens per day. When a change exceeds a cap, it should fall out of the automatic path and go to a person. Caps turn a surprising change into an obvious one.

Why caps work

A bad fix that touches one line is easy to review and cheap to revert. A bad fix that touches forty files is neither. OWASP's guidance on excessive agency recommends limiting functionality and enforcing authorization outside the model, and notes that rate limiting can reduce damage from unwanted actions. Size and scope caps are those ideas applied to a diff.

They also help reviewers. A pull request that fits a screen gets read. One that does not gets skimmed.

Starting limits

These are examples to tune against your own history, not standards.

LimitExample starting pointIf exceeded
Files changedA small handfulRoute to a person
Lines changedA few dozen for dependency fixesRoute to a person
DirectoriesOne service or packageSplit or reject
New dependenciesZero unless the finding requires oneReject and flag
Open bot pull requestsA fixed small number per repositoryQueue the rest
Opened per dayA fixed number per repositoryDefer
Path allowlistManifests, lockfiles, in scope sourceReject out of scope paths

Derive your numbers from the last three months of accepted fixes. If ninety percent of accepted dependency fixes changed fewer than five files, a cap slightly above that covers normal work and flags the rest.

Different caps for different categories

A patch level dependency update and a source code change are not the same risk. Give each category its own limits. Container base image changes can touch many layers and deserve a lower volume cap and closer review. Code changes should have tight line limits, since each line carries logic.

Scope: where the change may land

Size is one axis and location is the other. Define allowed paths and block the rest outright:

  • Allow dependency manifests and lockfiles for the area of the finding.
  • Allow source files named in the finding.
  • Block workflow definitions, deployment files, protection settings, secret stores and the bot's own configuration.

Enforce it in code at the pull request stage, using a required check that inspects the diff. See validate AI generated patches with deterministic checks.

Volume caps and queue health

A cap on open pull requests prevents a flood, but a full queue means reviewers are behind. When the cap is hit repeatedly, that is a signal to fix review capacity or grouping, not to raise the cap. See how many fix PRs a bot should have open at once.

When a change exceeds a cap

  1. The bot does not open it as an automatic candidate.
  2. It is labeled for human attention with the reason.
  3. A person decides: split it, accept it with extra review, or defer.
  4. The decision is recorded.

Never solve repeated cap hits by raising the limit without looking at why they happen.

Review the caps

Each quarter, review rejection rates by cap. A cap that never triggers may be too loose. One that triggers constantly may be too tight, or may point at a repository that needs manual attention.

Safeguard offers autonomous remediation with fix PRs, off by default with every category on Manual, so limits like these are something to decide before any category moves.

Try it yourself

Click through it at your own pace, or open it full screen. Watch how a change moves from finding to a gated decision.

Quick check

What is the right line limit?

There is no universal number. Base it on your own accepted fixes, set slightly above normal, and review it each quarter.

Should caps apply to human fixes too?

Not necessarily. Caps exist because automated changes arrive without a person who wrote and understands them.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.