PR Steward Loop
After a pull request is opened, an agent watches it and handles the follow-up work (failing checks, conflicts, review comments) while escalating anything that needs the author's judgment.
Problem
Opening a pull request is rarely the end of the work. Checks fail, the base branch moves and causes conflicts, and reviewers leave comments, often hours apart. Each item is small, but each one pulls the author back from other work and costs a context switch. With coding agents producing more PRs, this follow-up becomes a large hidden share of an engineer’s day, and PRs sit waiting for the author instead of for review.
- Follow-up tasks are small but arrive at unpredictable times.
- Some comments are mechanical; others are design questions only the author can answer.
- An agent working unattended must not merge, force-push or widen the change.
- Repeated failed fixes waste money and hide a wrong approach.
Solution
Hand the open PR to an agent that watches it for a bounded period, such as up to a week, and stops when the PR is merged or closed. On each event it acts within strict limits. Failing checks are reproduced and fixed. Conflicts are resolved by merging the base branch and rerunning tests. Review comments are answered with a fix or a reply, and comments from bots are treated as claims to verify against the code, not instructions. Anything larger, such as a redesign, a new API, wider scope or an unresolved security concern, is escalated to the author. The agent tries at most a few pushes per issue, then reports what it tried. It never approves or merges, and the author stays responsible for the change.
Diagram
The steward handles small follow-up work on its own and escalates anything that needs judgment. Approval and merge stay with people.
When to use
Use it when
- Engineers lose time to CI failures, conflicts and small review fixes
- PRs often wait on the author rather than the reviewer
- Repos have reliable tests and branch protection
- Everyone who can change the base branch is trusted
Avoid it when
- PRs in the middle of a design debate the team must settle
- Repos where untrusted people can land code the agent will run
- Projects without tests, where "fixed" can't be checked
Trade-offs
Gains
- Fewer context switches for the author
- PRs stay green and up to date while waiting for review
- Repeated failures surface as a report instead of a silent loop
Costs
- Runs with the author's credentials, so trust boundaries matter
- Spend accumulates over a multi-day watch
- Authors may stop reading what was changed on their behalf
Worked example
An engineer opens a PR adding CSV export to the Linkwatch reports page, then goes to a 3-hour planning session. The steward (for example, a `/ship` or `/steward` command) watches the PR.
- CI failsA lint rule flags an unused import. The steward removes it, runs the fast checks locally and pushes.
- Base movesAnother PR changes the same reports module. The steward merges the base branch, resolves a small conflict, reruns the tests and pushes.
- Bot commentA security bot claims the export leaks user emails. The steward checks the code, finds emails are already masked, and replies with the file and line.
- ReviewerA reviewer asks for streaming instead of building the whole CSV in memory. That changes the design, so the steward escalates to the author with a short summary.
- Author returnsThe PR is green and conflict-free. The author decides on streaming, makes the change, and a human approves and merges.
Failure modes
| Failure | Symptom | Mitigation |
|---|---|---|
| Scope creep | Steward rewrites large parts of the PR to satisfy a comment | Size limits per fix; escalate redesigns and new APIs |
| Fix loop | Same check fails after push after push | Cap attempts per issue (for example, 3) and report what was tried |
| Trusting comment text | A bot or outsider comment steers the agent into a bad change | Read comments only from trusted authors; verify bot claims against code |
| Agent merges | Change lands with no human approval | Block merge and force-push in tooling; require human approval in branch rules |