Docs
Docs menu

Autonomy

Let agents start on labelled requests by themselves, after a check that each request is ready, and merge what passes, within limits a repository admin sets.

Usually someone starts each attempt by hand. With an autonomy policy, the node starts agent attempts by itself on requests that carry a label you choose and have acceptance criteria. Each attempt runs the closed loop of revise rounds: it revises its change until CI passes and the pre-reviewer doesn’t ask for changes. A person reviews and merges the result, unless the policy also merges what passes.

A repository can have several policies, one per label and branch: for example a cheaper model for requests labelled docs and a stronger one for bug, or a policy for each person who lends their runners.

Add a policy#

Open Settings → Autonomy (repository admins only), go to Add a policy and fill in:

  • Label: requests that carry it qualify. Adding a label needs write access, so labelling a request is how someone agrees that an agent may start on it. Only one policy can start requests with a given label on a given branch.
  • Implementer and Pre-reviewer: the agent profiles that do the work and review it. They must be different profiles; the page warns when both use the same model.
  • Check the request is ready first: run a readiness check before any code is written (on by default; see The readiness check).
  • Revise rounds and Time limit: as for a single agent’s revise rounds.
  • At most … at a time and At most … a day: how many attempts the policy has unfinished at once (default 2) and starts in any 24 hours (default 10).
  • Expires: a policy lasts at most 90 days (default 30); sign it again to go on.
  • Merge what passes: off by default; see Merge what passes.

Saving signs the policy as you. Edit on a policy signs it again with your changes; another admin who edits it becomes the person its work is for. Each policy shows the worst case its limits allow and what it would start next, and the page lists every policy set or revoked before.

Open in Moru

To keep several policies from adding up to more work than you want, set At most … attempts from all policies at once at the top of the page. It counts every policy’s unfinished attempts; a policy that would go over it waits.

Which requests start#

The node looks every few seconds. A request qualifies when it:

  • is open: not in triage, not closed, with no attempt running and no change yet;
  • carries the policy’s label and has acceptance criteria, which only people with write access write;
  • is for the branch the policy names;
  • isn’t blocked by a request that’s still open;
  • hasn’t been tried by the same policy since its label was last added.

Qualifying requests start in backlog order: ranked requests first, then by priority, then oldest first, policy by policy. The request list marks them Auto, and the ones that start next Next to start.

Open in Moru

A policy never retries an attempt that failed. Start the next one by hand, or take the label off and put it back to let the policy try once more; until then the request loses its Auto mark. A request that carries another policy’s label too can be started by that policy.

The readiness check#

With Check the request is ready first, an attempt’s first job is a readiness check, run with the pre-reviewer’s profile. The agent reads the request, its discussion and the code, changes nothing, and answers:

  • Ready: the implement job starts, with the check’s notes added to its prompt. The prompt marks them as an agent’s reading, not instructions from a person.
  • Not ready: its questions are posted as a thread on the request, and the attempt ends with Not ready. Answer them, adjust the request or its criteria, and start an attempt yourself or put the label back.

The attempt card says whose policy started it. A request the check found ready goes on like any agent’s attempt:

One the check found unclear ends there, with its questions in the discussion:

Replies from people without write access reach the readiness check marked as untrusted, as they do every agent.

Merge what passes#

With Merge what passes on, a change the policy’s attempt made merges without a person once all of these hold for its latest revision:

  1. An attempt of this policy made it, and the attempt ended with its change submitted and its rounds passed.
  2. It isn’t being delivered upstream (a linked repository’s pull request).
  3. It has no open thread.
  4. It stays within the policy’s limits, At most … files (default 20) and At most … lines changed (default 400), and touches nothing under Never merge changes touching, counted on what merging it adds to the branch. CI files (.moru/workflows/, .github/workflows/, .github/actions/) and everything under .moru/ never merge under a policy, whatever it says.
  5. It doesn’t delete or shrink a test, or rewrite lines of one that were there before: tests only grow.
  6. Every revision has a valid attestation from this node, as for any merge.
  7. The repository’s required CI jobs passed on it. A policy can’t merge in a repository without required CI jobs.
  8. The policy’s reviewer finished its pre-review of the revision and didn’t ask for changes.
  9. It’s current with its target branch.
Open in Moru

Then a quiet period starts (Quiet period, default 30 minutes). The change page says when it merges and under whose policy, and the policy’s signer gets a notification. Anyone who can comment holds it: an open thread stops it from merging on its own, and resolving the last thread starts a new quiet period. When the period is over the node checks every condition again, approves the change under the policy and merges it.

A change that is behind its target but applies cleanly is rebased by a rebase job on the signer’s runner: git, no agent and no model. A rebased revision with the same patch keeps the pre-review; any other (or one with binary files, whose patch can’t be compared) gets a new one. Only one change per branch is rebased at a time, oldest attempt first, and none while another change on the branch is on its way to merging (its CI, its pre-review or its quiet period, for up to the policy’s time limit), so changes merge one after another instead of racing. A rebase that can’t work (a commit conflicts when replayed one by one, or the branch already has the change) isn’t tried again on the same tip, and one that fails another way (it timed out, or its runner gave up) is tried three times: then the change waits for a person, and the change page says why. A change that conflicts goes back to its attempt for a conflict round.

Stop a policy#

Revoke on a policy ends it at once. Admins and the person who signed it can revoke it. Attempts it started that haven’t ended stop with Policy stopped: their queued jobs are cancelled, and a job already running finishes, but nothing more starts from it (no readiness hand-off, no new round), and none of its changes merge on their own. The same happens when the policy expires, when its signer loses admin access, or when another person replaces it. Other policies go on.

A node operator can switch every policy on the node off with --autonomy off (moru-node serve). Policies stay in the repositories, nothing starts or merges under them until it’s switched back on, and attempts they started stop as for a revoked policy.

Command menu
Search for a page, repository, change or request, or run a command