Run autonomous maintenance loops that open pull requests on a Rails app

Ben Halpern moved Forem's performance and maintenance work into nine autonomous OpenHands loops. In a month they shipped 351 pull requests and cut average Rails request time from 70ms to 16ms.

Done withCustom agentinGitHub· Nov 11, 2026

What they did

Halpern runs Forem, the open-source Rails app behind DEV. Halpern put its routine engineering into autonomous loops on top of OpenHands: nine workflows covering performance, Rust, errors, tests, dependencies, issues, pull request review, merging and worktree cleanup. Loops fire about every ten minutes in isolated git worktrees, each with a cap on work in progress. A router spreads runs across Claude Opus 5.5, Gemini 4 Argon and GPT-6.1 Sol and hands off when one provider is in a rate-limit cooldown. Every open pull request is rechecked for CI failures or review comments on a 5, 10, 20 and 40 minute back-off, and the agent tries repair rounds. Halpern later built a custom dashboard over OpenHands to watch all of it.

How it went

Over a month the loops shipped 351 pull requests and average Rails request time fell from 70ms to 16ms. Halpern says it meant no longer acting as a go-between for dashboards and terminals. Running eight or nine loops at once made chat logs useless for knowing what was going on, which is why the dashboard exists. The post names problems it surfaced, such as a stale git lock wedging a worktree and orphaned worktrees left by parallel git gc runs.

Worth knowing

This post is mostly about the dashboard; the loop numbers come from Halpern's earlier post, which is summarised here. Plan for the operations side: rate-limit cooldowns, stuck worktrees and pull requests stuck in repair rounds need to be visible, or you end up reading transcripts to find out why a loop stopped.

Try it

With Custom agent· 5 parts to fill in

Run as a maintenance loop on [repository]. Every [interval], pick one candidate from [the slowest endpoints in my APM, open error reports, or outdated dependencies], work on it in a fresh git worktree, and open a pull request with the change and the evidence it helped. Never have more than [number] open pull requests at once. Recheck your open pull requests for CI failures and review comments and fix them, but stop after [number] repair rounds and flag the pull request for me. Never merge without my approval.

Square brackets are the parts to fill in. The prompt is ours; the story is theirs.

Where they said it

Related