Overview
By default, job PRs that only modify files underlogs/ are automatically squash-merged after the agent job completes. This enables fully autonomous agent workflows while maintaining safety through path restrictions.
How it works:
- Agent job completes and creates a PR
auto-merge.ymlworkflow runs- Checks all changed files against
ALLOWED_PATHS - If all files are within allowed paths → auto-merge
- If any file is outside allowed paths → leave PR open for manual review
Configuration
Auto-merge behavior is controlled by two GitHub repository variables (Settings → Secrets and variables → Actions → Variables tab).AUTO_MERGE
Kill switch for all auto-merging.
| Value | Behavior |
|---|---|
| (unset or any value) | Auto-merge enabled |
false | Auto-merge disabled — all job PRs stay open for manual review |
ALLOWED_PATHS
Comma-separated path prefixes that the agent is allowed to modify and still get auto-merged. If any changed file falls outside these prefixes, the PR stays open.
| Value | Behavior |
|---|---|
| (unset) | Defaults to /logs — only log files auto-merge |
/ | Everything allowed — all job PRs auto-merge |
/logs | Only log changes auto-merge |
/logs,/docs | Log and documentation changes auto-merge |
/ is optional (logs and /logs are equivalent).
To set allowed paths:
Examples
Safe Default (Recommended)
Only auto-merge log changes:- PR changes only
logs/job-123/session.log→ Auto-merged - PR changes
src/index.js→ Stays open for review - PR changes
logs/job-123/session.logANDREADME.md→ Stays open for review
Allow All (Original Behavior)
Auto-merge everything the agent changes:Manual Review Everything
Require manual review for all PRs:- All PRs stay open regardless of changed files
- Useful during initial testing or when making risky changes
Multiple Allowed Paths
Allow logs and documentation changes:- PR changes only
logs/files → Auto-merged - PR changes only
docs/files → Auto-merged - PR changes both
logs/anddocs/files → Auto-merged - PR changes
logs/andsrc/files → Stays open for review
Workflow Details
Theauto-merge.yml workflow runs automatically after agent jobs complete. Here’s what it does:
Workflow Logs
If a PR is blocked, the workflow logs show exactly why:Safety Considerations
Why Path Restrictions Matter
Without path restrictions, an agent could:- Modify your application code
- Change security settings
- Alter CI/CD workflows
- Delete critical files
Choosing Allowed Paths
/logs (Recommended Default)
/logs (Recommended Default)
Safe for: Agent logging, session transcripts, debugging outputRisk level: Low — logs are read-only for humans, write-only for agentsUse when: You want the agent to autonomously track its work without polluting PR reviews
/docs
/docs
Safe for: Documentation updates, README changes, guidesRisk level: Medium — documentation can mislead users if incorrectUse when: You trust the agent to maintain accurate documentation and you review it periodically
/ (Everything)
/ (Everything)
Safe for: Fully autonomous agents with high trustRisk level: High — agent can change anythingUse when: You have strong rollback procedures, comprehensive tests, and full trust in the agent’s decision-making
Gradual Expansion
Start restrictive and expand as you gain confidence:- Week 1:
/logsonly — agent can only log - Week 2:
/logs,/docs— agent can update documentation - Week 3:
/logs,/docs,/tests— agent can add test cases - Month 2:
/— full autonomy (if appropriate)
Troubleshooting
PR Not Auto-Merging
Check theauto-merge.yml workflow logs for the blocked files:
- Files outside
ALLOWED_PATHS AUTO_MERGE=falseis set- Workflow failed due to GitHub API rate limits
- PR conflicts require manual resolution
Accidentally Merged Unwanted Changes
Revert the merge commit:ALLOWED_PATHS to prevent recurrence.
Want to Merge a Blocked PR
If the workflow blocked a PR but you want to merge it:- Review the changes manually
- Merge via GitHub UI or CLI:
Best Practices
Start Restrictive
Begin with
/logs only. Expand permissions gradually as you gain confidence in the agent’s behavior.Monitor Blocked PRs
Regularly review PRs that were blocked. If the agent frequently needs to change certain paths, consider adding them to
ALLOWED_PATHS.Audit Auto-Merged PRs
Periodically review auto-merged PRs to ensure the agent is making appropriate changes within allowed paths.
Test Before Expanding
Before adding a new path to
ALLOWED_PATHS, test the agent’s behavior in that area with AUTO_MERGE=false.Integration with Other Features
With Cron Jobs
Cron jobs that create PRs follow the same auto-merge rules:logs/summaries/, it auto-merges. If it writes to reports/, it stays open.
With Skills
Skills can modify files, and those changes are subject to auto-merge rules:With Multi-Step Jobs
If a job makes multiple commits, all changed files across all commits are checked:Related Configuration
- Security — Understand the security implications of auto-merge
- Deployment — Set up GitHub variables in production
- Building Skills — Create skills that respect auto-merge boundaries