DEV Community

Nic Flemmer
Nic Flemmer

Posted on

Do you run the checks before or after merging main into an agent's branch?

A coding agent's branch is cut from main, and main keeps moving while it works. By the time the agent says it's done, the branch is a few commits behind.

There are three places to run the tests before the work goes in.

On the branch as the agent left it. Fast, and it tells you the agent's own work passes. It tells you nothing about how that work sits with whatever landed on main in the meantime.

After merging main into the branch. This is what I settled on. A clash between two agents' changes shows up on the branch, where the agent can still fix it, rather than on main. The cost: the checks run again every time main has moved.

Only on main, after the merge. Simple, but a failure now sits on main and you're reverting or fixing forward.

In Styx, the app I'm building, Land does the middle one: it brings main into the task's branch, runs the project's checks there, and only merges if they pass. If a step fails, nothing reaches main. It merges rather than rebases, so the agent's undo points stay valid.

Where do you run them: on the branch as it was, after bringing main in, or only on main? And does that change when two agents are working at once?

Top comments (0)