Run a change through a repo policy
A repo with a policy gets the coding framework. A coding agent’s change to it passes gates that the runner runs and records, and the runner takes no agent’s word for a result, apart from the review and the verdict. The reviewer and the verifier run on the author’s machine, so their reports are advice. A process holding that machine’s token could post one. Read the change yourself before you approve its merge. A person approves the plan before any code exists, and the repo’s owner approves the suite, the merge and the deploy. This page is for an admin who sets that up and for the people who answer its gates. The repo policy lists every setting, and What the runner checks on a change lists every gate.
Put a repo under a policy
Section titled “Put a repo under a policy”You need shell access to the server, the repo already added to the team, and a team member to act as the repo’s owner.
-
Write the policy as a JSON file. Its name, without
.json, becomes the policy’s name. The repo policy lists the fields. -
For a repo on the team’s forge, give the owner a forge user. The owner’s approval reaches the forge as that user.
Terminal window node --env-file=.env server/admin.ts forge-login <owner login> <forge user> -
Set the policy.
Terminal window node --env-file=.env server/admin.ts set-policy <team> <repo clone url> <policy.json> <owner login>This records a new version of the policy, points the repo at it with the owner, and prints the policy’s name, version, repo and owner. On a repo on the forge it also protects the default branch. Nobody pushes to it, merging needs a pass on each of
agents/gates,agents/review,agents/verdictandagents/suiteand the owner’s approval, which a new push makes stale, and a change to a protected path merges only when the owner forces it.
Running set-policy again with an edited file records version 2, and so on. A run reads the repo’s current policy each time it needs it, so a new version also applies to runs already under way.
A repo with a policy is never read for pipelines. Its pipelines/ folder, if it has one, holds code.
Set up the agents
Section titled “Set up the agents”app-change names three agents besides its own.
builderwrites the change.reviewerreviews it.verifierchecks it against the plan.
Each needs a model set. The reviewer’s model and the verifier’s model must each differ from the builder’s, and two reviewers may not share a model. If any of that fails, the review or verification stage fails and says why, since a judge on the author’s model is not independent. A verifier from the same model family as the builder passes, and its verdict notes that the check is weaker.
If the policy names a verification skill and a feature map, both must exist on the repo’s main branch, or the verification stage fails and names what is missing.
Start the run
Section titled “Start the run”- Choose Pipelines, then app-change.
- Choose the repo chip and pick the repo that has the policy.
- Write the request as the first line and the details below it, and choose Start the run.
The pipeline runs in a box. The run stops at once if the policy’s sandbox is box and the pipeline runs on a home machine. The request can also arrive from the pipeline’s webhook, as Start a run describes.
What the run does
Section titled “What the run does”routehas an agent pick a playbook fromchange,bug,docsanddependency, as the policy allows. Adocschange may touch only documents. Adependencychange may touch only manifests, the lockfile and the build log.- For a
bug,triagedecides whether the report is new, a duplicate, already fixed, not a bug, answered by an existing fix, or needs one question answered. A new bug goes on toreproduce, which writes a check that fails because of the bug. The other answers close the issue, ask the reporter, or hand off. understandwritesunderstanding.mdwith three sections.planwritesplan.mdwith the sections Concern, Done means, Keep, Files and Size.approve_planis a gate. Any teammate can approve the plan. The static gates fail any code written without a plan a person approved.implementchanges the code in the box. The runner commits and pushes it, and the agent does not.verifyruns the static gates, then the box’s commands, then each changed check on main’s code and on the change.reviewhas reviewers on other models judge the diff.confirmhas a fresh agent check the plan’s Done means and Keep items.open_propens the pull request, with what the runner saw in its description.protectedis a gate that passes by itself when the change touches no protected path, dependency or existing check.approve_suiteis a gate, andsuiteruns the full suite on the change merged into main.approve_mergeis a gate, andmergemerges the pull request at the commit every gate judged.approve_deployis a gate, anddeployreleases what was merged.
A failed verify, a review or confirmation that asks for a fix, a failed suite, or a merge the owner turns down sends the change back to implement, with what failed. implement runs up to 6 times. A pull request that cannot be opened or merged goes to a person, and a turned-down protected change or suite ends the run.
Answer a gate on a policy run
Section titled “Answer a gate on a policy run”Only the repo’s owner can answer protected, approve_suite, approve_merge and approve_deploy. The gate names the owner, and a teammate who tries gets only <login> can answer this. Anyone who can see the run can answer approve_plan.
The owner’s questions from a review or a verifier come to the owner too. A review that still blocks after the policy’s rounds, or that raises a finding about security, auth, billing, data, migrations or concurrency, asks the owner to send the change back, overrule the finding, or stop the run. A verdict below the policy’s floor asks the owner to accept it, send the change back, or stop.
What can stop a run before it ends
Section titled “What can stop a run before it ends”- The spend cap is the lower of the pipeline’s and the policy’s
maxSpendUsd. - The time cap is the policy’s
maxRunMinutesof working time. Time spent at a gate or a hand-off does not count. - The repo’s daily spend and the daily spend of reports from people outside the team are capped. The run stops before it starts, and says so once on the report’s issue.
- The repo’s runs per hour and its runs at once are capped. A run over either waits its turn and says why.
- An agent with no tool call or finished turn for the policy’s
liveness.minutesis replaced by a fresh session, up toliveness.replacementstimes in a stage. Then a person decides. - A machine that stops reporting fails the stage at once, and the run waits on a person.