Phase 1 pilot rollout runbook¶
One copy of the stage checklist per pilot repository. The operator copies the stage table into the pilot's record, which is kept outside git, and fills in the date, who did it and the SHA-256 of the gate report at each stage.
Every criterion below reads a field of the Phase 1 gate report's repositories[] (the JSON of pnpm graft gate report --phase 1). Every command exists. The thresholds of stage 2 are the code's RUNBOOK_STAGE2 constant (src/pilot/gate-phase1.ts), and a test checks that this page quotes them.
Graft never changes branch protection, rulesets, CODEOWNERS or repository settings, and nothing in a repository changes a mode. Every branch protection step below is a human step done by a repository admin. A repository moves between stages only through pnpm graft mode set.
Background: the modes, the policy, the guard, MCP, the gate, the security review and the Phase 0 onboarding guide.
Roles¶
- Operator. Runs Graft and the CLI.
- Repo admin. Changes branch protection and repository settings.
- Tech lead. Classifies would-be failures and guard comments as "Graft right" or "Graft wrong".
- Product owner. Makes the go/no-go calls and the gate call.
Stage 0: deployment ready (once per deployment)¶
All of these hold before any repository leaves stage 2:
- Every process (server and workers) runs the Phase 1 step 7 build. Until then, lower
GRAFT_MODE_CEILINGonly with a full stop (see modes, rolling back). GRAFT_MODE_CEILING=reporton every process.GITHUB_APP_SLUGis set on the server.- The manifest is chosen: the full manifest for any repository that will reach stage 4, the report manifest otherwise.
/mcpis behind the proxy, over HTTPS, andGRAFT_TRUST_PROXYlists the proxy's addresses (configuration).- The HUMAN-TODO smoke tests and real-GitHub checks of steps 2 to 6 are done and recorded (HUMAN-TODO), including:
- the step 3 label-lag measurement and whether the issue events API serves
Link: rel="last"(step 7, D11: a PR with more than 1,000 issue events cannot be break-glassed); - the step 4 review 2, finding B check (two workflows with the same job name);
- the step 5 T1 (b) check:
sha: nullon a directory entry inPOST …/git/trees.
No-go: any of them open.
Stage 1: install in report mode (day 0)¶
- Phase 0 onboarding §1 to §7 (onboarding).
- Extract the review-time baseline of the 12 weeks before day 0:
- Record the incidents of that period:
- Create the labels
graft:break-glassandgraft:revert(repo admin). - Check the modes: every mode is
report.
- Check the deployment: no FAIL.
- Tell the team what the would-be line on
graft/policyand the guard comments mean.
Stage 2: watch (at least 14 days and at least 30 merged PRs)¶
Weekly:
The tech lead opens every PR counted in repositories[].wouldFailAtMerge.total (by reason in repositories[].wouldFailAtMerge.byReason) and every guard comment, and classifies each one:
- Graft right: the policy says what the team wants and the PR really lacked it;
- Graft wrong: the policy is misconfigured, or Graft has a defect.
Before stage 3 the team also encodes in graft.yaml any CODEOWNERS approval rule it relies on, because stage 3 drops CODEOWNERS review.
Go to stage 3 when all of these hold:
repositories[].merged.total ≥ 30, and the report window is at least 14 days.repositories[].wouldFailAtMerge.total / repositories[].merged.total ≤ 0.10, and no "Graft wrong" case among the PRs of the last 7 days (repositories[].last7.totalof them).repositories[].last7.invalidOrMissingPolicy = 0.- If the policy names a team:
members: readis granted (pnpm graft mode show --repo <owner/repo>prints no teams note), and nowould_failwith reasonapprovals_missinginrepositories[].last7was caused by an unverified team (read it in the check details). pnpm graft pilot doctor --installation <id>: no FAIL, and no WARN inmodes,permissions,teamsorpublic_enforce.- The repository does not use a merge queue, and it is private or internal:
repositories[].privateistrue. A public repository stays in report mode in Phase 1 (step 7, D10). - The team has named who may use
graft:break-glass.
No-go: fix the policy or report the defect. The last 7 days must then meet criteria 2 and 3 again.
Stage 3: enforce policy_mode¶
In this order:
- Operator, once per deployment. Set
GRAFT_MODE_CEILING=enforcewhile no repository requests enforce (so raising it changes nothing). Restart every process. Check thatpnpm graft mode show --repo <owner/repo>prints the ceilingenforcefrom the worker. - Repo admin. Make
graft/policya required status check with the Graft App as the expected source. Keep the existing required reviewers. - Operator.
Within about a minute pnpm graft mode show --repo <owner/repo> says effective enforce (repositories[].modes.policy.effective), and an open PR's graft/policy is success or failure.
4. Two working days with both protections. Go to 5 when every failure the team reported was explained by the policy, and no check stayed in_progress past the card wait.
5. Repo admin. Drop "Require approvals" and "Require review from Code Owners" from branch protection. graft/policy now counts the approvals.
6. Watch 14 days (from repositories[].enforceSince.policy). Stay while:
- no merged PR is classified by the tech lead as approved by Graft when the policy should have required a human;
- at most 1 incident is linked to a PR of class auto in the stage (repositories[].incidentsOnAuto);
- repositories[].mergedWhileFailing = 0, unless each one was a deliberate admin bypass.
Rollback of stage 3¶
On any no-go above, or on request. The order matters, because a neutral check passes a required check on GitHub:
- Repo admin. Restore "Require approvals" (and Code Owners review if it was used).
- Operator.
Check pnpm graft mode show --repo <owner/repo>, and that open PRs are neutral within about a minute.
3. Leave graft/policy required, or remove it: neutral passes either way.
Emergency¶
Graft is down, or every check is stuck in_progress. For one repository (the fast path):
- Repo admin. Restore the required reviewers, and remove
graft/policyfrom the required checks. - Operator. Roll back as above.
For every repository at once (lowering the ceiling, slower): the ceiling turns graft/policy neutral on every enforcing repository, and neutral passes a required check, so a repository whose required reviewers were dropped (stage 3 step 5) would merge with no review.
- Operator. List every repository past stage 3 step 5, from the stage record. When the database is up, cross-check it: every repository whose
repositories[].modes.policy.effectiveisenforce, in the latestpnpm graft gate report --phase 1 --installation <id> --since <day 0> --out <dir>for each installation, or withpnpm graft mode show --repo <owner/repo>per repository. - Repo admin, on every one of them. Restore "Require approvals" (and Code Owners review if it was used). Check each one off in the stage record.
- Operator, only then. Set
GRAFT_MODE_CEILING=reportand restart. Once every process runs the step 7 build, a rolling restart is safe (step 7, D2): the first new worker's start lowers every process. Finish the roll: an old-config worker that restarts during it storesenforceagain until the next new worker start (step 7 review 1, finding 4). Then checkpnpm graft mode showon each repository.
If Graft cannot be brought back up, the ceiling cannot publish neutral: use the per-repository path on each repository. Removing graft/policy from the required checks is the only thing that unblocks merges then.
Stage 4: enforce guard_mode (not before 14 days in stage 3)¶
Prerequisites:
- the full manifest with contents: write is accepted, then:
- "Automatically delete head branches" is on;
- the default branch has required checks, so revert PRs are tested;
- in stages 2 and 3, no guard comment classified "Graft wrong" in the last 14 days.
repositories[].guard.missedandrepositories[].guard.caughtare not criteria: a quiet default branch is fine.
Then:
Stay while no revert PR blames the wrong PR.
Rollback:
Close unwanted open revert PRs by hand and turn off their auto-merge in the GitHub UI: Graft never disables it. Deployment-wide: GRAFT_GUARD_REVERT=off and a restart.
Stage 5: auto-merged reverts (optional, step 7 D12)¶
Only after 14 days in stage 4 with repositories[].guard.caught ≥ 3 and no wrong revert. Only guard.auto_merge_reverts: [trivial], added to graft.yaml in a reviewed PR. Only if changes to .github/workflows/ require a review (CODEOWNERS or a ruleset) and "Allow auto-merge" is on.
Rollback: remove the key in a reviewed PR.
Stage 6: mcp_write (optional, any time after stage 3)¶
- Tokens go only to agents that already have read access to the repository, one per repository:
- The agents use the reads for at least 7 days.
- The agents that will call
open_changesign their commits (step 7, D8): otherwise no approval on their PRs counts. - Tell the team that a commit made on an MCP-opened PR in the web UI, or by "Update branch", is committed by
web-flow, and then no approval on that PR counts (step 7 review 1, finding 2). Recommended, not required: the HUMAN-TODOweb-flowcheck on real GitHub is done and recorded. Graft already treats everyweb-flowcommit as unverified, so the check is needed only before that rule is relaxed (step 7 review 2, nit F). - Then:
Rollback:
A leaked token:
Deployment-wide: GRAFT_MCP=off and a restart.
Gate review (weekly, product owner and operator)¶
Per pilot repository:
Then, for all five pilots:
pnpm graft gate report --phase 1 --installation <id 1> --installation <id 2> --since <since> --out <dir>
Read the gate verdict, the preview and the per-repository table. The calling rule is in HUMAN-TODO.
The stage record¶
Copy this table into the pilot's record (outside git), once per repository.
| Stage | Date | Who | Gate report SHA-256 | Go / no-go and why |
|---|---|---|---|---|
| 0 deployment ready | ||||
| 1 report mode | ||||
| 2 watch | ||||
| 3 policy enforce | ||||
| 3 rollback (if any) | ||||
| 4 guard enforce | ||||
| 5 auto-merged reverts | ||||
| 6 mcp_write |