From issue to pull request, without giving agents the keys
A self-hosted pipeline where coding agents pick up labelled issues and open pull requests that a developer reviews. Different models on real work, and credentials that expire in minutes.
Simple tasks shouldn't wait for a developer to have time. They also shouldn't be done by an agent nobody checks. I built a self-hosted pipeline for the team I work in that does the first without giving up the second.
The flow
- A developer labels an issue as ready for an agent.
- On a schedule, the pipeline picks it up and starts an agent in its own isolated sandbox.
- The agent makes the change and opens a draft pull request.
- A developer runs the full checks and reviews it. Only a person marks it ready.
The runs are spread out in time, so agents don't pile up on the same part of the code.
Labels choose the model
The label also decides which model does the work: Claude, OpenAI, or a coding model we host ourselves. That turns the pipeline into a comparison on real tasks instead of benchmarks. Every commit carries a co-author line that says which model wrote it, so the history shows it too.
Agents never hold real credentials
- Agents only get short-lived tokens from a small token broker, never a long-lived key.
- Commits and pull requests come from a dedicated machine account, so it is always clear what an agent did.
- The token that can publish releases is kept apart; agents never see it.
- Tokens can be rotated centrally within a minute.
The pipeline runs on its own Linux server under a separate service account, with hardened services and backups before every upgrade. Sandbox images are pinned to versions, so a run today behaves like a run last week.
Housekeeping by agents
The same setup does chores nobody wants: a weekly sweep for dead code, and daily releases.
What went wrong
- GitHub's built-in schedules started about seven hours late, so scheduled jobs moved to the server itself.
- A long-running user service kept old group memberships after a permission change, which looked like a permissions bug for longer than I'd like to admit.
- One provider's subscription SDK had a bug in headless mode, so that provider was dropped from the pipeline for now.
Why it works
The agent does the change. A person decides it is done. Everything in between is about making that line impossible to cross by accident.