After a turn, a coding agent leaves changes on its branch. If your tests pass, why not let it merge them?
I added exactly that setting to a tool I'm building, Styx: 'Land on its own when the agent goes quiet and the checks pass'. It's off by default. With it on, each time an agent finishes a turn with changes, Styx brings main into the branch, runs the project's checks and merges only if they pass. A failure stops it before main is touched, and the chat says why.
The obvious problem is that the checks are only as good as the tests. And the agent may have written some of those tests itself, so green can mean 'it agrees with itself'.
The argument for it is that a quick merge of a small, checked change is how people already work on a branch they own, and a bad merge is a revert away.
So where's your line?
- Never. I read the diff every time.
- On a side project, with green tests.
- Only for changes a second agent has reviewed.
- Only for certain kinds of change, like docs or tests.
Would you turn it on, and what would it need to have checked first?
Top comments (2)
Your third option, as long as the reviewer didn't write the code or its tests and has to show each problem on a real case. That held up a merge of mine on a tax deadline calculator. The suite passed, and an independent reviewer found 10 defects the tests couldn't catch, since they encoded the same legal assumptions the builder had written down. For a return filed after an estimated assessment, the calculator counted the late-filing surcharge over 14 months, 420 €, instead of 11 and 330 €.
The revert argument assumes the blast radius is pure code. Where that falls apart in practice is migrations, config files that sync to live infrastructure, and other agents that immediately branch off the new HEAD.
If I turn that on, the first rule is a separate test checkout: the test runner resets tests/ back to origin/main before running the suite, so the agent cannot edit its own grader into passing. The second is diff boundaries. If it touches anything outside an explicit whitelist of leaf packages, it stops for a human look regardless of whether CI went green.