# Equipo merge authority, thin v1

Status: 2026-11-11, revision 3.1 ("thin v1"), being built. Revision 3
drew REQUEST CHANGES from Astra round 3 (the last round); Paul chose
"Refuse old runners" for its Critical, and the controller directed the
other four findings. Those rulings are folded in (§13).
Revision 1 (7eba9c8) and revision 2 (4ab106f) drew REQUEST CHANGES from
Astra; the controller cut the scope (§11 lists what moved to v2, §12
maps the round 2 findings). Drafted by Claude (Opus 5.5) on
`merge-authority` from main ac4a809. Builds on slice 4c
(`docs/superpowers/plans/SLICE4C-PROGRESS.md`) and the housekeeping
decision classes (`2026-11-08-equipo-housekeeping.md` §3). Not
implemented.

## 0. Why, and the shape

Paul, on the card "Merge Swipe from the edge to go back doesn't work
without checks? [Merge] [Wait for checks]": "How do we give the
co-ordinator authority to merge stuff like this? I think it needs to be
able to make a decision ... we can give it heuristics and best
practice." Equipo decides, and asks only when its policy says so.

Thin v1 is one rule checked at one moment: **right before Equipo sends a
merge request to the hub, a pure function on the instance decides
whether Equipo may send it on its own.** Nothing is queued on a
decision; a decision that is not "merge now" leaves the task where
today's code leaves it, with a better card.

Invariants, each tested:

1. **The gate is code, on the instance.** No model output can make it
   merge. A runner supplies measured facts; missing facts mean ask.
2. **Never looser.** The coordinator can only tighten. Loosening needs
   an owner's tap or form.
3. **One door.** Every merge request goes through `authorizeMerge`
   synchronously, with the hub's `expect_sha`, and each call writes one
   audit row.
4. **Never retroactive.** Only a candidate whose review ran on a
   `wire.ProtocolMergeFacts` runner after the upgrade can merge without
   checks on its own; an open card is never re-decided automatically.
5. **Refuse old runners** (Paul). Every automatic merge, checks passed
   included, needs the primary at `wire.ProtocolMergeFacts` both when the
   step is dispatched and at every hub request. A lower protocol is
   refused, never downgraded, and the decision becomes an ask card with a
   recommendation. Code names the capability, never a protocol number.

## 1. Decision classes

| Class | Meaning | What happens |
|---|---|---|
| `act` | Equipo may send the merge request now | the request goes; a receipt (§6) |
| `ask` | approved, but a criterion of §2.3 fails | the merge card, once per SHA, worded as Equipo's call (§4) |
| `never` | not approved, checks failed or running, branch moved, task ended, cancelled or merging already | nothing (fix rounds and Needs you as today) |

The housekeeping principal may still never merge, open a merge card or
change a merge policy (`hkForbid`, unchanged).

## 2. The gate

### 2.1 `mergegate.Decide`

New package `internal/equipo/mergegate`, pure (no store, clock or I/O).

```go
type Inputs struct {
	Candidate      string       // newest pushed candidate; "" when the branch moved
	Verdict        string       // newest finished review verdict on Candidate
	Checks         string       // passed | failed | none | cannot_run | "" (running)
	ChecksReason   string
	OutsideSandbox bool         // checks_sandbox none
	Eligible       bool         // k.MergeEligible == Candidate (slice 4c)
	Person         bool         // a person chose Merge for this SHA (§2.4)
	Change         *ChangeFacts // §3; nil when missing or refused
	Protocol       int          // the primary's protocol on its current connection
	Policy         Policy       // §7; defaults when no row
	Hold           string       // §4.3
	Revert         *RevertCheck // §6; only for a revert task
}

type Criterion struct{ Name string; OK bool; Value, Limit string }

type Decision struct {
	Class   string      // act | ask | never
	Stance  string      // merge | wait, for ask
	Checks  bool        // act with checks passed
	Reasons []Criterion // every criterion evaluated, fixed order
}

func Decide(in Inputs) Decision
```

### 2.2 Order

1. **Never** when `Candidate == ""`, `Verdict != approve`, `Checks ==
   failed` or `Checks == ""`.
2. **A person's Merge** (`Person`): `act`. The person decided; holds
   and policy are shown on the card they answered, not re-applied.
3. **Checks passed**, not outside the sandbox, `Eligible`: `act` with
   `Checks: true` unless `Policy.Mode == ask` or `Hold != ""` (then
   `ask`, options Merge, Not now). Not eligible: `ask` (slice 4c's adopt
   card). Outside the sandbox: `ask`, as today. The runner must speak
   `wire.ProtocolMergeFacts` here too (Refuse old runners). A pass from a
   Mac re-run (mac-recheck, `chat_steps.recheck_by`) on the exact
   candidate is eligible when the passing result lands. The controller's
   ruling on an asked SHA: the re-run's pass may merge on its own (still
   through `authorizeMerge`, judged like a merge without checks less the
   environment rule) only when the card asked solely because checks
   could not run (the SHA's newest `decision` or `card_refresh` audit row
   fails `environment_reason` alone) or the person chose Wait for a Mac
   on that SHA's card; then the re-run withdraws the card. For any other
   reason (sensitive, large, ships, held, ask mode, or no recorded reason,
   which fails closed) the SHA stays asked: the card stays open and the
   pass re-decides its words once, as a `card_refresh` (audited, never
   acted on). A SHA never asked about decides afresh as usual. A re-run
   that fails takes the normal fix round; a result on another SHA counts
   for nothing.
4. **Without checks**: `act` only when ALL hold, else `ask`:

| Criterion | Holds when |
|---|---|
| `approved_exact_sha` | `Verdict == approve` on `Candidate`, branch at it |
| `environment_reason` | `Checks == cannot_run`, `ChecksReason` in `{needs_macos, runner_offline}` |
| `runner_reports_facts` | `Protocol >= 3` |
| `facts_present` | `Change != nil` (accepted under §3.4) |
| `small` | `Change.Lines <= Policy.MaxLines`, `Change.Files <= Policy.MaxFiles`, `Change.Binary == 0` |
| `not_sensitive` | no old or new path matches §3.3, `!Change.Special`, `!Change.Signing` |
| `main_does_not_ship` | `Policy.MainShips == no`, answered by an owner (§7.3) |
| `policy_allows` | `Policy.Mode == rules` |
| `no_hold` | `Hold == ""` |
| `revert_exact` | only for a revert task: §6.3 |

`none`, `checks_timeout`, `checks_unavailable` and `needs_network` are
not environment reasons and always ask. No policy value waives a
criterion; size applies in every mode.

### 2.3 `authorizeMerge(task, candidateSHA)`

`func (t *txn) authorizeMerge(k *taskRecord, sha, at string, person bool)
(Decision, error)` builds the inputs inside the write transaction (the
current roster is checked there for `person`: the creator, still an
owner), calls `Decide`, writes one audit row (§8) and returns the
decision. It is the only function that may return `act`, and it is
called at two moments:

**(a) Before dispatch.** The only code that creates a merge step,
`startMerge`, calls it first and creates the step only on `act`.
Callers of `startMerge`:

| Caller | `person` | Natural trigger |
|---|---|---|
| `autoMerge` from `advance` | false | the candidate is at Ready to merge, on any report or sync |
| `answerMerge` (Merge) | true | the person's tap |
| `MergeTask` (task page Merge) | true | the person's tap |
| merge Retry | true | the person's tap |

`autoMerge` calls it only while the task has no merge card for this SHA
(`merge_asked != candidate`) and no merge step for this SHA has ended.
So once Equipo asked, only the person acts, and a failed automatic
attempt is not repeated on its own (Ready to merge with the reason and
Retry, as today). On `ask` it raises the card and sets `merge_asked`; on
`never` it does nothing.

**(b) Right before each hub request.** The runner's forge calls
`Confirm` immediately before every hub merge request: the first, a
re-request after an uncertain answer, and every resumption while the
hub's own CI is pending (`internal/runner/forge/merge.go`,
`MergeBranch`; it inspects the remote first, so a request already sent
is settled from the default branch before any new request). A protocol
3 runner sends that `Confirm` as a lease check with the new optional
`purpose: "merge_request"` (beside the existing `publication`
purpose). `Store.Authorize` for that purpose:

- re-runs `authorizeMerge` (with `person` from the merge step's
  `decided_by`), on every call, after the ordinary attempt checks;
- on `act`, grants;
- otherwise refuses with the reason `merge_not_authorized`, and in the
  same transaction raises the ask card for the SHA (once) when the
  class is `ask`.

The runner maps that refusal to a terminal failure `merge_not_authorized`
before anything is sent (the forge record stays `prepared`; `Confirm`
runs before the record moves to `requested`). The instance applies it as
any other non-conflict merge refusal: back at Ready to merge, with the
card. Nothing is withdrawn, so `withdrawnSettle` is not involved, and
the step's first lease (which only starts the step, before any
inspection) is unchanged.

**No queued automatic merge.** `autoMerge` decides only when the
person's primary is online; the gate's `runner_protocol` criterion then
needs it at `wire.ProtocolMergeFacts` for every automatic merge, checked
or not. Offline, nothing is decided or created and the next sync's
`advance` is the next trigger. A person's Merge may wait
for the primary as today. The runner's existing bounded wait while the
hub's CI is pending (10 minutes) holds no decision: each resumption
calls `Confirm`, which decides again.

**Runners below `wire.ProtocolMergeFacts`** never get an automatic
merge: at dispatch the gate asks (stance merge when only the protocol
fails: "your runner needs an update before I merge on my own"). The
fence: when a runner holding an automatic merge step reconnects below
that protocol, every lease it asks for that step is refused
`merge_not_authorized`, whatever it carries (its purpose is dropped by
`Encode`), and the attempt is settled failed in the same transaction
with the ask card raised. A request such a runner already sent before
it reconnected is settled by the merge watch, which reports the
landing as today. There is no dispatch-only path: a person's Merge is
the only merge an older runner carries, and their decision stands.

**Merge on the card after a refusal.** The card's Merge (and the task
page's) accepts a candidate whose newest merge step failed and ended:
it runs that step again as its next attempt, decided by the person.

### 2.4 What a person's Merge means

A person's Merge (card, task page, Retry) is `decided_by: person:<id>`
on the merge step. It is bound to the SHA by `expect_sha` and to the
person by the roster check at both moments. It is not stored anywhere
else and never outlives the step.

## 3. Change facts

### 3.1 What the runner measures

New optional `wire.ChangeFacts` on the Review step's report, sent only
on a protocol 3 connection:

```go
type ChangeFacts struct {
	ReviewStep string       `json:"review_step"`
	Attempt    int64        `json:"attempt"`
	Repo       string       `json:"repo"`
	Base       string       `json:"base"` // merge-base(task base, candidate)
	SHA        string       `json:"sha"`  // the candidate
	Files      int          `json:"files"`
	Lines      int          `json:"lines"` // added + deleted, text files
	Binary     int          `json:"binary"`
	Special    bool         `json:"special"`
	Signing    bool         `json:"signing"`
	Entries    []Entry      `json:"entries"`
	Complete   bool         `json:"complete"`
	Revert     *RevertCheck `json:"revert,omitempty"` // §6.3
}
type Entry struct {
	Status  string `json:"status"`
	Old     string `json:"old"`
	New     string `json:"new"`
	OldMode string `json:"old_mode"`
	NewMode string `json:"new_mode"`
}
```

Computed with no model, in the review tree, from the exact pair:
`git diff --raw -z -M --no-abbrev <base> <sha>` (status, both paths of
a rename or copy, modes), `git diff --numstat -z -M <base> <sha>`
(lines; `-` is binary) and `git diff -U0 <base> <sha> --` limited to
`.pbxproj`, `.xcconfig` and `Info.plist` files (the signing rule). The
two listings must name the same entries; disagreement, an error, or
more than 200 entries gives `Complete: false`.

### 3.2 Special entries

`Special` when any entry has mode `120000` (symlink) or `160000`
(gitlink) on either side, or its old and new modes differ, or it adds a
file with mode `100755`.

### 3.3 Sensitive areas

A table in `mergegate/sensitive.go`, matched against the old and the
new path of every entry, case-insensitive. Tokens are path segments
split on `/`, `.`, `-`, `_` and lower-to-upper case changes, matched
whole (`keyboard` is not `key`). Every glob matches at any depth.

| Class | Globs | Tokens |
|---|---|---|
| `migrations` | `**/migrations/**`, `**/migrate/**`, `**/*.sql`, `**/schema.*`, `**/*.prisma` | `migration`, `migrations`, `schema` |
| `auth_secrets` | `**/.env*`, `**/*.pem`, `**/*.key`, `**/*.p12`, `**/*.p8`, `**/*.keystore`, `**/*.jks` | `auth`, `authn`, `authz`, `oauth`, `oidc`, `saml`, `jwt`, `login`, `logout`, `signin`, `signup`, `session`, `sessions`, `password`, `passwords`, `passwd`, `credential`, `credentials`, `secret`, `secrets`, `token`, `tokens`, `key`, `keys`, `keychain`, `crypto`, `cipher`, `encrypt`, `decrypt`, `cert`, `certs`, `certificate`, `tls`, `ssl`, `permission`, `permissions`, `acl`, `rbac` |
| `payments` | | `payment`, `payments`, `billing`, `stripe`, `checkout`, `invoice`, `invoices`, `subscription`, `subscriptions`, `purchase`, `purchases`, `storekit`, `iap`, `paywall`, `refund`, `refunds` |
| `ci_config` | `**/.amadan/**`, `**/.github/**`, `**/.gitlab-ci.yml`, `**/.circleci/**`, `**/.buildkite/**`, `**/Makefile`, `**/GNUmakefile`, `**/makefile`, `**/*.mk` | |
| `dependencies` | `**/go.mod`, `**/go.sum`, `**/go.work*`, `**/package.json`, `**/package-lock.json`, `**/npm-shrinkwrap.json`, `**/yarn.lock`, `**/pnpm-lock.yaml`, `**/bun.lock*`, `**/Cargo.toml`, `**/Cargo.lock`, `**/Gemfile*`, `**/requirements*.txt`, `**/pyproject.toml`, `**/poetry.lock`, `**/Pipfile*`, `**/uv.lock`, `**/Package.swift`, `**/Package.resolved`, `**/Podfile*`, `**/Cartfile*`, `**/*.gradle*`, `**/gradle.lockfile`, `**/composer.json`, `**/composer.lock`, `**/mix.exs`, `**/mix.lock`, `**/.gitmodules`, `**/vendor/**` | |
| `release_signing` | `**/*.entitlements`, `**/*.mobileprovision`, `**/ExportOptions*.plist`, `**/fastlane/**`, `**/*.xcconfig`, `**/.goreleaser*`, `**/VERSION` | `release`, `releases`, `signing`, `entitlements`, `provisioning` |
| `infrastructure` | `**/*.tf`, `**/*.tfvars`, `**/*.hcl`, `**/Dockerfile*`, `**/docker-compose*`, `**/*.service`, `**/fly.toml`, `**/vercel.json`, `**/netlify.toml`, `**/render.yaml`, `**/Procfile`, `**/app.yaml`, `**/carlos.toml` | `terraform`, `ansible`, `pulumi`, `cloudformation`, `infra`, `infrastructure`, `deploy`, `k8s`, `helm` |

**Signing**: an added or removed line in a `.pbxproj`, `.xcconfig` or
`Info.plist` naming `CODE_SIGN`, `DEVELOPMENT_TEAM`,
`PROVISIONING_PROFILE`, `ENTITLEMENTS`, `PRODUCT_BUNDLE_IDENTIFIER`,
`MARKETING_VERSION`, `CURRENT_PROJECT_VERSION`, `CFBundleVersion` or
`CFBundleShortVersionString`. A `.pbxproj` change that only adds a file
reference is not sensitive by itself.

A project may add globs (`extra_sensitive`, at most 20, each <= 200
bytes). Nobody can remove a default.

### 3.4 Acceptance

Stored on the review step (`change_facts`) only when: the report comes
from the person's primary and the runner the step is placed on, on a
protocol 3 connection; `ReviewStep` and `Attempt` are this step's
current attempt; `Repo` is the task's project; `SHA` is the step's
`CandidateSHA`; `Base` is a valid SHA; `Complete`; the counts match the
entries; every path passes `cleanPath`; every mode is one of git's.
Otherwise dropped (the verdict still counts; `facts_present` fails).
`Decide` reads only the facts on the review step whose verdict it uses.

## 4. Asking, with a recommendation

### 4.1 The card

The existing `merge` card, once per SHA, in the creator's conversation,
its question composed by the instance from the decision:

- `Stance: merge` when the only failing criteria are `small` or
  `policy_allows`: "I'd merge: %s." with up to three passing phrases
  ("approved by Review", "a small change, %d lines in %d files",
  "nothing ships until a release").
- `Stance: wait` otherwise: "I'd wait: %s." with up to two failing
  phrases ("it touches payments (%s)", "I don't know yet whether %s's
  main ships to users", "the runner didn't say what changed", "this
  project asks before every merge", the coordinator's hold text).

Options: `needs_macos`, or `runner_offline` with a macOS need:
**Merge**, **Wait for a Mac**; other cannot-run reasons and `none`:
**Merge**, **Wait for checks**; checks passed but asked: **Merge**,
**Not now**.

### 4.2 Wait

Wait only waits; it is never consent. The task stays at Ready to merge
with Merge offered (today's behaviour), and nothing re-runs the checks
on the same SHA in v1 (a checks retry on the same SHA is v2). The
`merge_asked` guard stays: once Equipo asked about a SHA, only the person
acts on it; nothing (a policy answer, a sync, a later checks result)
re-arms the automatic merge for that SHA.

### 4.3 The coordinator: stricter only

- Tool `hold_merge{task, reason}` (own task; stage before Done,
  including Ready to merge and Merging before the hub request): sets
  `merge_hold` (plain text, <= 200 bytes). `Decide` then never acts on
  its own for that task; an automatic request not yet sent is refused at
its `Confirm`. A person's Merge is not refused by a hold (they saw it on
the card).
  No tool releases a hold; a person's Merge is the release for that SHA.
- The coordinator's words reach the gate only as `Hold`.
- `read_task` shows the newest decision (class, stance, reasons).

## 5. What happens on the hub's answer

`mergeDone` gains the landing's provenance, from new optional fields on
the merge step's report (protocol 3):

- `merge_source`: `hub` when the SHA is from this request's `200
  {merged, sha}` answer; `reconciled` when the forge settled it from
  the default branch; `cached` when it returned an earlier record.
- `merge_parents`: the merge commit's parents, read from the fetched
  default branch after the answer (empty if the fetch failed).

`forge.MergeOutcome` gains `Source` to carry this; the forge's other
behaviour is unchanged. The forge's fallback at
`internal/runner/forge/merge.go:243` (substituting the tip when the
landing commit is not found) is **not** changed here; it is filed as a
separate small issue for every merge. Instead, for an automatic merge
without checks, the instance treats any report whose `merge_source` is
not `hub`, or whose `merge_parents` are not exactly two with the
candidate second (the hub's merge commit), as **unverified**: the task is done (the
commit is on the default branch), `merge_verified` is false, the
receipt has no Undo, and the audit row says `landed_unverified`.

## 6. Receipt and Undo

### 6.1 The receipt

An `act` merge without checks writes, in `mergeDone`'s transaction, a
receipt card (kind `merge_receipt`) in the creator's conversation
instead of the `chat.merged_without_checks` line, idempotent per task
(`merged:<task>`, the existing key): "Merged [%s](%s) into %s without
checks: %s." (`%s` the passing phrases of §4.1). It is visible at once,
bound to the task (`task_id`), revision 1. Undo is offered only when
`merge_verified` and for 7 days (`housekeeping.UndoWindow`). Merges with
checks passed and a person's merges keep today's lines and no receipt.

### 6.2 Undo creates an ordinary task

The creator's Undo (card answer `undo`, or `POST
/api/v1/tasks/{id}/undo-merge`, owner, current card revision) creates, in
one transaction, an ordinary task through the store's task insert (no
similarity check), title "Revert %s in %s" (short SHA, project), brief
"Revert merge commit <sha> with `git revert -m 1 <sha>` and change
nothing else.", `revert_of` = the task, `revert_sha` = the verified
merge SHA, and starts it as `start_task` does (owner, execution on).
It then runs Engineering, checks, Review and the gate like any task.
The receipt's revision grows and it shows "Reverting: [%s](%s)."

Refused (409, with a line to the creator) when not verified, outside the
window, or a revert task for it exists; a teammate gets 404, a non-owner
403.

Any Undo puts the project in ask mode at once (§7.2: `mode: ask`,
reason `reverted <sha>`), until an owner says otherwise.

### 6.3 Exact revert

The revert target travels to the runner as an optional `revert_sha` on
the Review step's dispatch (protocol 3). The runner adds to the change
facts `revert: {sha, on_top, exact}`: `on_top` when the candidate's
parent is the reverted merge commit itself, and `exact` when
additionally the candidate's tree equals that merge commit's first
parent's tree (`git rev-parse <candidate>^{tree}` and `<sha>^1^{tree}`).
`revert_exact` holds only for `on_top && exact` for the task's
`revert_sha`. A revert made after main moved on, or one that changed
more, is asked about. Since Undo sets ask mode, the revert task asks
anyway in v1; `revert_exact` makes the card's stance merge ("I'd merge:
it exactly reverts %s.").

## 7. Policy per project

### 7.1 Storage

Migration **0061** (main has 0058 project stars, 0059 usage rounds and 0060 Mac recheck;
the next free number if another branch lands 0060 first). Tables `chat_merge_policies` and `chat_merge_audit`;
columns `chat_steps.change_facts`, `chat_steps.decided_by`,
`chat_steps.merge_source`, `chat_steps.merge_parents`,
`chat_tasks.merge_hold`, `chat_tasks.merge_verified`,
`chat_tasks.revert_of`, `chat_tasks.revert_sha`. Additive; registered in
`chat.Models` and `Schema`; the migration check covers them.

`chat_merge_policies` (team record, one row per project):
`project_id`, `mode` (`rules` | `ask`), `mode_reason`, `max_lines`
(default 300, 0 to 2000), `max_files` (default 15, 0 to 100),
`main_ships` (`unknown` | `yes` | `no`), `ships_answered_by`,
`ships_asked` (bool), `extra_sensitive` (JSON), `words` (<= 300 bytes,
display only), `revision`, `updated_by`, `updated_at`. No row means
`rules`, 300, 15, `unknown`.

### 7.2 Setting it

- **In conversation**: tool `set_merge_policy{project, words, mode?,
  max_lines?, max_files?, main_ships?, add_sensitive?}`. Each field is
  compared with the stored one. If every changed field is tighter (to
  `ask`, smaller numbers, `main_ships: yes`, added globs), it applies at
  once, with one coordinator line and an audit row. If any is looser,
  nothing applies: a confirm card "Change how Equipo merges %s: %s?
  [Save] [Cancel]" goes to the person, and Save (an owner, current
  policy revision) applies all of it. "for Woodstar, merge when Review
  approves" is `mode: rules` (and the ships answer); "always ask me
  about Suite" is `mode: ask`. The instance never parses the words.
- **On the project page**: a section "How Equipo merges" (partial
  `merge_policy.html`, one include line in `work_project.html`, to stay
  clear of the Projects and Tasks work) shows the policy in plain
  sentences, the words, the mode reason, and the last five decisions
  with their reasons. An owner's form edits the fields (CSRF, policy
  revision, current roster); teammates see it read only.
- `GET/PUT /api/v1/projects/{id}/merge-policy` mirror the form.

### 7.3 Does main ship to users?

`main_ships` starts `unknown`, which fails `main_does_not_ship`. When a
decision fails on it and `ships_asked` is false, the same transaction
sends one card to the task's creator if they are an owner: "Does
merging to %s's main ship to users? [It ships] [It doesn't]", and sets
`ships_asked`. An owner's answer on the current policy revision sets
`main_ships` and `ships_answered_by`, with an audit row. It applies to
decisions made after it: the card already open for that task stays open
until the person acts, because `autoMerge` never decides a SHA that has
a card (§2.3). Nothing in the repository is evidence either way. The
project page edits it too.

## 8. Audit

`chat_merge_audit`, append only: `id`, `project_id`, `task_id`, `kind`
(`decision`, `answer`, `merged`, `landed_unverified`, `undo`,
`policy`, `ships`, `hold`), `at` (`dispatch`, `confirm`,
`dispatch_only`, or the form or tool), `candidate_sha`, `merge_sha`,
`class`, `stance`, `decided_by` (`policy`, `person:<id>`,
`coordinator:<id>`), `reasons` (every criterion), `inputs` (counts, the
first ten matched paths, policy revision, protocol, checks reason,
review label, hold), `created_at`. Written in the transaction of the
effect, with the instance's audit event as every write; a rolled-back
effect leaves no row; a replayed report adds none (keyed on step,
attempt and kind).

## 9. Wire and versions

`wire.ProtocolMergeFacts` (protocol 4; spend-1's protocol 3 is
`wire.ProtocolSpend`), all new fields
optional and `omitempty`:
`StepReport.change`, `StepReport.merge_source`,
`StepReport.merge_parents`, `LeaseCheck.purpose`,
`DispatchCommand.revert_sha`. `wire.Encode` clears them for any peer
below `wire.ProtocolMergeFacts` (its own downgrade step, chained after
the others). Instance first, then runners, as today.

| Combination | Behaviour |
|---|---|
| new instance, runner below `ProtocolMergeFacts` | every automatic merge asks (Refuse old runners); a person's Merge works as today |
| old instance, new runner | protocol 2 welcome: the new fields are never sent |
| a runner reconnects below it holding an automatic merge | the fence refuses its leases for that step; settled, asked |

## 10. Tests

Built on this branch (targeted `-run` locally; `make ci` with
`CGO_ENABLED=0` on hosted CI is the final gate, never on docs-t1). Each
guard is broken in turn and a test watched failing (progress log).

**Gate (`internal/equipo/mergegate`)**: `TestDecideEachCriterion`,
`TestDecideNever`, `TestDecideChecksPassedPath` (protocol included),
`TestDecidePersonMerge`, `TestDecideStance`, `TestDecideNeverLooser`
(20,000 random inputs against an independent oracle),
`TestSensitivePaths`, `TestValidPolicy`, `TestTighter`.

**Wire**: `TestWireProtocol3Downgrade` (a `ProtocolMergeFacts` frame is
unchanged there and loses every merge authority field one protocol
below and at protocol 1).

**Runner**: `TestReviewReportsChangeFacts`, `TestRevertCheck`,
`TestMergeConfirmPurpose`, `TestMergeSource`, `TestLeaseRefusalReasons`.

**Store contracts (`internal/thintest`)**:
`TestContractMergeAuthorityAct`, `TestContractMergeAuthorityAsks`,
`TestContractMergeFenceOldRunner` (protocol 1 at dispatch, checks passed
included; reconnect below the protocol refused at the lease and asked;
Merge on the card retries the failed attempt), `TestContractConfirmRechecks`
(a hold on a checked merge, ask mode on an unchecked one, between
dispatch and request), `TestContractNoQueuedAutoMerge`,
`TestContractShipsQuestion`, `TestContractWaitNeverMerges`,
`TestContractUndoMerge` (revert task, ask mode, revert target and exact
revert on review, teammate 404, second Undo 409, an unverified landing
has no Undo), `TestContractMergePolicyTool` (tighter, looser card,
bounds, member read only, the project page section),
`TestContractFactsAcceptance`, `TestContractRosterDenial`. The slice 4c
merge contracts and the page tests that end in Equipo's merge run on a
`ProtocolMergeFacts` runner; at protocol 1 they now ask.

Gates kept green: `make budget`, gofmt, `go vet ./internal/...`,
`scripts/runner-dead-references.py`, `TestPlan3ReleaseBoundaries`, the
migration and model check.

### Copy inventory

All in `internal/equipo/copy.go`, each marked `COPY REVIEW REQUIRED`,
each listed in the Plan 3 copy inventory: the card stances and phrases
(§4.1); "Wait for a Mac"; the receipt and "Reverting: [%s](%s)." (§6);
Undo's refusal lines; "Merged [%s](%s), but I couldn't tell which commit
on main it is, so I can't undo it."; the ships question and its two
answers (§7.3); the policy confirm card and the tightening line (§7.2);
the project page section's sentences; the `hold_merge` and
`set_merge_policy` tool descriptions; the Stopped line for
`merge_not_authorized`.

## 10a. Operating rule: deploy with no merge in flight

The fence for older runners (§2.3) settles every automatic merge step
the moment such a runner connects. What it cannot stop is an older build
that is already part-way through a hub merge request when the instance
changes: that request goes on, and the forge record and the merge watch
settle its landing afterwards. So deploy with no merge in flight: before
an instance swap, check that no merge step is queued or running, and
restart every runner on the new build right after it. A runner that has
never connected, or installs from `install.sh`, gets the new build.

## 11. Moved to v2

- Verification on the merged commit when checks can run, as its own
  durable record.
- The trust counter with generations and credits.
- Automatic fix-task intents after a failed verification.
- A deterministic revert step (v1's Undo is an ordinary task).
- Fixing the forge's tip fallback for every merge (a separate issue).

## 13. Round 3 findings and the rulings

1. Critical, a runner reconnecting below the protocol: Paul chose
   "Refuse old runners" (invariant 5, §2.3 fence).
2. Clearing `merge_asked`: the guard stays; nothing re-arms (§4.2).
3. Merge after a confirmation refusal: the card's Merge retries the
   failed, ended attempt (§2.3).
4. The same-SHA checks retry: removed from v1 (§4.2), v2.
5. `make ci` with `CGO_ENABLED=0` on hosted CI is the final gate (§10).

## 12. Round 2 findings and where they went

1. Wait as consent: Wait never consents (§4.2).
2. Open card reconsidered: `autoMerge` never decides a SHA that has a
   card (§2.3, §7.3).
3. Withdrawal versus reconciliation: no withdrawal; a refused
   `merge_request` lease before any request, after inspection (§2.3);
   holds allowed while Merging (§4.3).
4. Guessed landing: provenance from the hub answer and parents; anything
   else is unverified with no Undo; the forge fallback is a separate
   issue (§5).
5. and 6., 7. Verification, trust and fix intents: moved to v2 (§11).
8. Revert target and exactness: `revert_sha` on the dispatch; tree
   equality on top of the merge commit (§6.3).
9. Protocol 1: automatic merges without checks need protocol 3; older
   runners are gated at dispatch only, as recorded (§2.3, §9).
10. Receipt rules and copy inventory restored (§6.1, §10).
