How we merge 300 changes a month
The hard part is the queue.
Writing code in parallel turned out to be the easy half. The hard half is everything after: the checks, the merge, the database change and the deploy, done in order, by many agents at once. Until 27 October a person did that ordering, which was me, and pull requests, migrations and deploys were missed while they waited for me. Now one script does it. Every agent ships through the same command, and the command takes a lock before anything that must happen one at a time: a lock for claiming a migration number (55 numbers claimed so far), a lock for applying a change to the production database, and a lock held from bringing a branch up to date until it is merged. Each lock is a folder in the git directory every worktree shares, created in a single step that either fully happens or does not happen at all, so two agents can never both hold it. A second agent waits in the queue instead of racing. One more number, because parallel agents cost money. When we measured a week of our usage in October, subagents were 66% of it, and 89 of them had started on the most expensive model because nobody had set one. Parallel is cheap to start and easy to overspend on. Set the model for each agent on purpose.
Custom software development in Dubai