Skip to content

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.

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.

  1. Write the policy as a JSON file. Its name, without .json, becomes the policy’s name. The repo policy lists the fields.

  2. 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>
  3. 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/verdict and agents/suite and 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.

app-change names three agents besides its own.

  • builder writes the change.
  • reviewer reviews it.
  • verifier checks 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.

  1. Choose Pipelines, then app-change.
  2. Choose the repo chip and pick the repo that has the policy.
  3. 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.

  1. route has an agent pick a playbook from change, bug, docs and dependency, as the policy allows. A docs change may touch only documents. A dependency change may touch only manifests, the lockfile and the build log.
  2. For a bug, triage decides 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 to reproduce, which writes a check that fails because of the bug. The other answers close the issue, ask the reporter, or hand off.
  3. understand writes understanding.md with three sections. plan writes plan.md with the sections Concern, Done means, Keep, Files and Size.
  4. approve_plan is a gate. Any teammate can approve the plan. The static gates fail any code written without a plan a person approved.
  5. implement changes the code in the box. The runner commits and pushes it, and the agent does not.
  6. verify runs the static gates, then the box’s commands, then each changed check on main’s code and on the change.
  7. review has reviewers on other models judge the diff. confirm has a fresh agent check the plan’s Done means and Keep items.
  8. open_pr opens the pull request, with what the runner saw in its description.
  9. protected is a gate that passes by itself when the change touches no protected path, dependency or existing check.
  10. approve_suite is a gate, and suite runs the full suite on the change merged into main.
  11. approve_merge is a gate, and merge merges the pull request at the commit every gate judged.
  12. approve_deploy is a gate, and deploy releases 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.

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.

  • The spend cap is the lower of the pipeline’s and the policy’s maxSpendUsd.
  • The time cap is the policy’s maxRunMinutes of 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.minutes is replaced by a fresh session, up to liveness.replacements times in a stage. Then a person decides.
  • A machine that stops reporting fails the stage at once, and the run waits on a person.