# Fix rounds: setting up Claude to fix pins

Source: https://pinprompt.veren-technology.com/docs/reference/fix-rounds

Fix rounds let a reviewer press **Submit review** and have Claude fix the pins in one run, with one pull request per round. This page is for the owner who turns it on.

## What it needs

1. **The server's Anthropic API key** (`ANTHROPIC_API_KEY`). The same key Claude drafting uses. The first round makes the agent and its sandbox on Anthropic's side and remembers them; nothing else to configure. To pin them yourself, set `PINPROMPT_FIX_AGENT_ID` and `PINPROMPT_FIX_ENVIRONMENT_ID`.
2. **The project connected through the workspace's GitHub App, with write access** (Check setup's push row compares `GET /app` with `GET /app/installations/{id}` through `installationGrant`, so a change not yet accepted on the installation is named as such, then mints a token with the round's scope; `forgetInstallationTokens` drops cached tokens first), because pinprompt writes the round's branch and opens the pull request. Apps made before fix rounds only asked to read pull requests: on GitHub, open the app's settings → Permissions and set **Contents: Read and write** and **Pull requests: Read and write**, save, then accept the new permissions on each installation (GitHub emails the installation's owner). A project connected with a personal token can't run rounds (Check setup's push row is red, `NEEDS_APP`): a personal token can't be narrowed to read-only for the agent's checkout.
3. **A required review on the base branch** (enforced): merging into the base branch must need at least one approving review, through a ruleset ("Require a pull request before merging", 1 approval) or classic branch protection. Claude can't push (below) and pinprompt never merges, but a person with write access could merge unreviewed, so pinprompt checks this: Check setup fails without it, the owner's switch won't turn on, and each round checks again before it starts (`GithubClient.reviewRule`: rulesets via `GET /repos/{repo}/rules/branches/{branch}`, then classic protection, which an app can only read with Administration: read). The answer is host-agnostic (`ReviewRule` in `@pinprompt/spec`: enforced, missing, unreadable, unsupported) and `reviewRuleCheck` in core turns it into the check, so another host's adapter only has to answer the same question. **Unsupported** is a plan that can't protect branches at all (GitHub Free, private repositories: 403 "Upgrade to GitHub Pro…"): the check is amber, and the project's owner may accept it (`acceptReviewWaiver`, `POST /api/v1/projects/:id/fix-setup {key, accept}`). The acceptance is stored on the project (`rules.reviewWaiver`: key, who, when; never set by the Rules form) and keyed to host, repository, branch and visibility, so a change asks again, and a repository that gains a review rule goes back to the strict check. Whatever the plan, `GithubClient` refuses to merge, submit reviews, call GraphQL (auto-merge) or change protection and rulesets (`refusedGithubCall`), or write any ref but a round's own branch (`ROUND_BRANCH`: `refs/heads/pinprompt/<key>-r<n>-<id>`, from `roundBranch`) (no force, no deletes, no Contents API writes), or write anything at organization, enterprise or team level.
4. **The switch**: Settings → Rules → "Claude fixes pins in rounds", the roles that may start runs, and a cap per round.

**Check setup** (Settings → Rules) says what's missing when one of these isn't there; until then a submitted round sorts the pins and leaves them in Agent ready for developers' agents (MCP).

## What a round does

- One Claude session per round, on a fresh checkout of the project's base branch (Settings → Code and content, else the repository's default branch).
- Claude works group by group and runs the repository's quick checks. Its checkout's token can only read (`fixCloneScope`: Contents read, that repository only), so it can't push. For each group it calls the `commit_group` tool with every changed file (whole content, base64 for binaries, or delete), and pinprompt writes one commit on the round's branch itself through the Git Data API (`GithubClient.commitToRoundBranch`: blobs, a tree on the parent's tree, a commit, then a fast-forward ref update; the branch starts from the base branch on the first commit). The branch name is unique per round (`pinprompt/<project key>-r<n>-<last 8 of the round id>`). A branch already on GitHub must end in this round's own commits, or in one commit titled `Round <n>, group …` on top of them or of the base (a commit whose answer was lost); anything else is `ForeignBranchError` and fails the round. Paths must stay inside the repository; `.git` is always refused, and `.github/` (workflows, actions) unless the owner turned on *Let Claude change CI files* (`rules.fixRounds.ciFiles`, owner only; a form that doesn't post it keeps the stored value). `package.json` scripts and `.gitmodules` are ordinary files: a person reviews them in the pull request, but CI may run them first; at most 200 files and 8 MB per call. pinprompt's own token is `fixRoundScope` (Contents and Pull requests write, that repository only) and never reaches the agent.
- `report_group` moves the group's pins: being fixed → To check with Claude's one-line summary (only once `commit_group` wrote its commit), or back to people with the reason.
- When it ends, pinprompt opens one pull request from that branch, links it on every fixed pin, and people merge as usual. Claude never pushes, opens or merges anything itself.
- The read-only token never enters Claude's sandbox either: Anthropic's git proxy adds it to git traffic for that repository only. The sandbox can reach package registries (installs) and nothing else on the web.

## Cost and limits

- The cap per round (default $15, $3 for Fix this pin now) is also set as the session's hard budget on Anthropic's side, so a run stops at it even if pinprompt is down.
- Spend shows on the round in the panel (team only). A typical 40-pin round is estimated at $5–6.
- A run longer than 3 hours is stopped.

## Not in this release

- A picture of the fixed page on each pin (next): for now the pin links the pull request, and the PR preview shows on the item when the GitHub connection reports deployments.
- Sanity drafts for content groups: Claude fixes content that lives in the repository and hands back content that lives in Sanity.
- The extension's Submit button and panel need extension 0.2.0 or later (the Chrome Web Store's 0.1.0 doesn't have them; the download on /extension does).
