|
| 1 | +# M7 — C4: First-Post Runbook |
| 2 | + |
| 3 | +**Status: DRAFT — pending operator review and sign-off.** This is the artifact required by |
| 4 | +`docs/m7_operator_go_checklist.md` §C item **C4** ("First-post runbook finalized — step-by-step |
| 5 | +execution script for §E"). It follows the C1/C3 precedent — a standalone dated record rather than |
| 6 | +a row-embedded decision. Once reviewed, C4's row cites this document; this document is not itself |
| 7 | +the attestation. |
| 8 | + |
| 9 | +This document **amends no numbered section** of `docs/m7_moltbook_transport_boundary_and_deployment_spec.md`, |
| 10 | +of `docs/m7_first_live_post_governed_envelope.md`, of `docs/m7_operator_go_checklist.md`, or of any |
| 11 | +ruling in `docs/`. It sequences existing obligations into an executable order, names one manual |
| 12 | +control point the code does not enforce (§4 below), and states one terminal condition (§5 below) |
| 13 | +that those documents already imply but do not spell out as a step. **Nothing here authorizes |
| 14 | +transmission** — GO-2 does that, and this runbook only runs once GO-2 is signed and unexpired. |
| 15 | + |
| 16 | +**Cross-reference convention.** A bare `§N` refers to this document. References to another |
| 17 | +document's sections are always named — "envelope doc §5", "checklist §E", "transport spec §9". |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## 1. What this runbook is for, and what it is not |
| 22 | + |
| 23 | +This is the step-by-step sequence executed under checklist §E, once GO-2 is signed. It exists to |
| 24 | +fix the *order* of the human and machine steps §E already lists, because one constraint — the |
| 25 | +300-second envelope window (§2 below) — makes order safety-relevant in a way the checklist's row |
| 26 | +list does not itself enforce. |
| 27 | + |
| 28 | +It does **not** decide what counts as an acceptable outcome — the envelope doc §5 and checklist §E |
| 29 | +already do that. It does not resolve the AMBIGUOUS-verification gap (§5 below states a stop |
| 30 | +condition grounded in an existing ruling; it does not rule on the gap itself). It does not touch |
| 31 | +`moltbook/transport.py`. |
| 32 | + |
| 33 | +## 2. The window that fixes the order |
| 34 | + |
| 35 | +`ActionEnvelope.approve()` sets `approval_expiry = approved_at + 300s` |
| 36 | +(`moltbook/transport.py:74-92`), and `validate_envelope()` checks expiry **first**, before config |
| 37 | +drift or payload drift (`moltbook/transport.py:113-144`). Every human-executed check in checklist |
| 38 | +§E — the clean-tree recheck, the kill-switch precheck, review of the rider — has to complete |
| 39 | +**before** the envelope is approved, not after: approving late in the window and then running |
| 40 | +these checks eats into a fixed 300 seconds that cannot be extended, and a check that runs past |
| 41 | +`approval_expiry` finds an already-rejected envelope, not a rejected-in-time one. |
| 42 | + |
| 43 | +**Consequence for step order:** approval (`ActionEnvelope.approve()`) is the *last* preparatory |
| 44 | +step before `send()` is called, not the first. Everything else — clean-tree confirmation, |
| 45 | +`KillSwitch.engaged` recheck, rider review, GO-2 identifier match — happens against the *candidate* |
| 46 | +payload and commit, before an envelope for it is even constructed. |
| 47 | + |
| 48 | +## 3. The execution model the kill switch requires |
| 49 | + |
| 50 | +`KillSwitch` is instance state — `__init__` sets `self._engaged = False` on the object |
| 51 | +(`moltbook/transport.py:463-465`), and `check_write()` reads that same instance's flag |
| 52 | +(`moltbook/transport.py:475-477`). Checklist §E's second row requires "a tested, reachable |
| 53 | +`activate_manual(operator=...)` path open during the send" — reachable means the operator can call |
| 54 | +`activate_manual()` on the **exact same `KillSwitch` instance** the transport holds, while `send()` |
| 55 | +is running. |
| 56 | + |
| 57 | +A fire-and-forget script (spawned, backgrounded, or run non-interactively) cannot satisfy this: by |
| 58 | +the time the operator could intervene, the process holding that instance may have already returned |
| 59 | +or moved on to the next line. **The send must run inside an interactive session the operator holds |
| 60 | +open for its duration** — a REPL, a debugger, or an interactive script that pauses for operator |
| 61 | +input at the send call itself — so that `activate_manual()` is a call the operator can actually make |
| 62 | +against the live instance, not a note for later. |
| 63 | + |
| 64 | +This is not a new requirement; it is what §E row 2 already requires, stated as an execution-model |
| 65 | +constraint because the checklist doesn't otherwise say how it's satisfied. |
| 66 | + |
| 67 | +## 4. Action-ID binding — manual control point |
| 68 | + |
| 69 | +> **⚠ WARNING — unenforced binding.** `validate_envelope()` (`moltbook/transport.py:113-144`) |
| 70 | +> checks exactly three things: expiry, `governance_config_version`, and recomputed `payload_hash`. |
| 71 | +> It **never checks `action_id`**. `send()` contains no reference to `action_id` for validation |
| 72 | +> purposes anywhere in its body either. **No code anywhere in the transport checks a constructed |
| 73 | +> envelope's `action_id` against GO-2's `authorized_action_id`.** |
| 74 | +
|
| 75 | +The dangerous sequence this enables: GO-2 fixes an `authorized_action_id` in writing → the operator |
| 76 | +constructs the live envelope at step 6 of §7 below → `ActionEnvelope.approve()` silently generates |
| 77 | +a fresh random UUID via `uuid.uuid4()` if `action_id` is omitted from the call |
| 78 | +(`moltbook/transport.py:81-92`) → the resulting envelope has the wrong `action_id`, but still passes |
| 79 | +every check `validate_envelope()` runs (expiry: fine; config version: fine; payload hash: fine, |
| 80 | +since hash is a function of `payload`, not `action_id`) → `send()` transmits it without objection. |
| 81 | + |
| 82 | +**This is the single point in the entire sequence with no structural backstop — assuming this |
| 83 | +document's code inspection above is complete and there is no other indirect enforcement path.** |
| 84 | +Every other GO-2 binding (`payload_hash`, `governance_config_version`) is checked mechanically by |
| 85 | +`validate_envelope()`. `action_id` is not. |
| 86 | + |
| 87 | +**Required control:** the operator MUST explicitly verify, before approval, that the `action_id` |
| 88 | +about to be passed to `ActionEnvelope.approve()` equals GO-2's recorded `authorized_action_id`, and |
| 89 | +must pass it explicitly (`action_id=authorized_action_id`) rather than omitting the argument. This |
| 90 | +is a procedural control filling a gap the code does not fill — **not** a claim that this document |
| 91 | +is establishing a new invariant, and not a suggestion that the code ought to be changed to enforce |
| 92 | +it. That is an architectural question outside C4's scope. C4's job is limited to naming that the |
| 93 | +gap exists and requiring the operator to close it by hand at this specific point. |
| 94 | + |
| 95 | +## 5. The AMBIGUOUS-verification terminal condition |
| 96 | + |
| 97 | +### 5.1 What the code returns |
| 98 | + |
| 99 | +`MoltbookHTTPTransport.send()`'s verification classification (`moltbook/transport.py:1620-1647`) |
| 100 | +has three branches. On `CaptchaOutcome.AMBIGUOUS` — the residual branch, `moltbook/transport.py:1635-1641` |
| 101 | +— it returns, per the values set at `moltbook/transport.py:1636-1637` and the common |
| 102 | +`TransportResult` construction at `moltbook/transport.py:1642-1647`: |
| 103 | + |
| 104 | +``` |
| 105 | +TransportOutcome.SUCCESS |
| 106 | +publication_status = PublicationStatus.PENDING_VERIFICATION |
| 107 | +verification_status = VerificationStatus.REQUIRED |
| 108 | +``` |
| 109 | + |
| 110 | +**This is not a failure and this runbook does not call it one.** The transport's own outcome is |
| 111 | +`SUCCESS` — the write transmitted. The governance problem is narrower and different: `SUCCESS` |
| 112 | +does not, by itself, discharge the envelope doc's rider. Labeling this branch "failure" anywhere in |
| 113 | +this runbook would be an unauthorized semantic conversion of exactly the kind C1 §3.1's |
| 114 | +classification principle exists to prevent, and would misdirect whoever reads the record later. |
| 115 | +This runbook calls it what the record calls it: an open, non-discharging state. |
| 116 | + |
| 117 | +### 5.2 Why no existing procedure routes it |
| 118 | + |
| 119 | +Three procedures could plausibly apply. None does. |
| 120 | + |
| 121 | +- **§9 reconciliation** (`resolve_ambiguous_write()`, `moltbook/transport.py:384-421`) operates |
| 122 | + only on `TransportOutcome.OUTCOME_UNKNOWN` — it raises `ValueError` if called on anything else |
| 123 | + (`moltbook/transport.py:404-405`). The branch in §5.1 returns `TransportOutcome.SUCCESS`, so this |
| 124 | + function is not callable on it, not merely inapplicable in spirit. |
| 125 | +- **Checklist §E row 6** ("published but incorrect") requires `publication_status = PUBLISHED`. |
| 126 | + The branch in §5.1 sets `publication_status = PENDING_VERIFICATION`, which is not `PUBLISHED`. |
| 127 | + Row 6, and the §C5 procedure it invokes, is out of scope for this state on its own stated terms. |
| 128 | +- **Checklist §E row 5** ("`OUTCOME_UNKNOWN` / `AMBIGUOUS_WRITE`") requires the transport-level |
| 129 | + `TransportOutcome` to be one of those two. It is `SUCCESS` here, so row 5 does not fire either. |
| 130 | + |
| 131 | +**No row in §E names this state**, and no reconciliation function is authorized to act on it. This |
| 132 | +matches C1 §8 item 7 and the corresponding `TODO.md` entry: the disposition of a verify-level |
| 133 | +`AMBIGUOUS` outcome was deliberately left unresolved, "an architectural question for its own |
| 134 | +ruling," and explicitly not closed by C2. |
| 135 | + |
| 136 | +**Additional code-grounding for the same distinction:** the `TransportResult` construction shared |
| 137 | +by all three verify branches uses `RetryCategory.IDEMPOTENT_WRITE` (`moltbook/transport.py:1643`). |
| 138 | +Send-level `AMBIGUOUS_WRITE` is a different `RetryCategory` value entirely, paired with |
| 139 | +`TransportOutcome.OUTCOME_UNKNOWN` (`moltbook/transport.py:1522`, `:1558`). Verification-level |
| 140 | +ambiguity and send-level ambiguity are mechanically distinct paths in the transport's own |
| 141 | +vocabulary, not merely distinct by this document's argument. |
| 142 | + |
| 143 | +### 5.3 The existing ruling that governs this send |
| 144 | + |
| 145 | +`TODO.md`'s carried item states the ruling directly: this gap "is not blocking GO-2, since §E is |
| 146 | +human-executed and captures all three statuses." That ruling — not a new one — is what this |
| 147 | +runbook executes. It was made on the premise that a human is present at exactly this moment, |
| 148 | +watching `publication_status` and `verification_status` land, able to hold rather than proceed. |
| 149 | + |
| 150 | +The envelope doc §5(1) independently confirms what "holding" means procedurally: `REQUIRED` is |
| 151 | +named among the values that do **not** discharge the rider, and the rider "stays active for as |
| 152 | +long as either status is open, with no default timeout that closes it out on its own." So this |
| 153 | +runbook does not need to invent a resolution — the governing document already specifies the |
| 154 | +correct state for an unresolved verification: open, and open indefinitely until further action. |
| 155 | + |
| 156 | +### 5.4 The step |
| 157 | + |
| 158 | +If `send()` returns `publication_status = PENDING_VERIFICATION` and |
| 159 | +`verification_status = REQUIRED` (§5.1): |
| 160 | + |
| 161 | +1. **Stop.** Do not retry the send. Do not call `resolve_ambiguous_write()` — it does not accept |
| 162 | + this outcome (§5.2) and calling it would raise, not resolve. |
| 163 | +2. **Record**, per checklist §E row 4: the resulting statuses, the RESOLUTION TRACE, and the |
| 164 | + `CaptchaAttemptRecord` (mandatory per C1 §7 — `condition_id` will show which §3.3 condition |
| 165 | + matched, or that none did). |
| 166 | +3. **Leave the rider open.** Per envelope doc §5(1), it is not discharged. Record the transmission |
| 167 | + timestamp on GO-2's `consumed_at` per §D — that field records that GO-2 was consumed by a |
| 168 | + transmission, not that any obligation closed. |
| 169 | + |
| 170 | + **Interpretation, not an explicit rule:** the materials appear to treat `consumed_at` and rider |
| 171 | + discharge as separate closure questions, because they arise from distinct governance artifacts |
| 172 | + — GO-2 (§D) authorizes one transmission; the rider (envelope doc §5) tracks a separate |
| 173 | + obligation with its own three-part discharge condition. Nothing in either document states this |
| 174 | + separation explicitly. Read it this way absent a ruling to the contrary; do not treat this |
| 175 | + runbook's reading as a settled rule. |
| 176 | +4. **Escalate to the operator for a decision on next action** — resend under a fresh envelope, |
| 177 | + wait, or something else. This runbook claims no authority to choose among those and does not |
| 178 | + attempt to. That decision, if it requires anything beyond waiting, is itself a fresh governed |
| 179 | + action needing its own approval — this step is a stop, not a resolution. |
| 180 | +5. **Do not treat elapsed time as resolution.** Per envelope doc §5(1), there is no default |
| 181 | + timeout. The rider stays open until an operator act closes it under one of envelope doc |
| 182 | + §5(3)'s three named paths — none of which currently covers this state, which is itself part |
| 183 | + of what gets escalated. |
| 184 | + |
| 185 | +This step is a runbook stop condition, not a new governance ruling. It carries forward the |
| 186 | +disposition already fixed by C1 §6, the `TODO.md` entry, and envelope doc §5(1); it settles |
| 187 | +nothing that those documents left open. |
| 188 | + |
| 189 | +## 6. Dry-run rehearsal — what it does and does not cover |
| 190 | + |
| 191 | +`DryRunTransport.send()` requires `envelope.action_id` to start with `dryrun-` |
| 192 | +(`moltbook/dryrun.py:13`, `moltbook/transport.py:1259-1263`) and raises `ValueError` otherwise. The |
| 193 | +rider's `dry_run_rehearsal_reference` (envelope doc §2) must therefore be produced from a |
| 194 | +**separately constructed envelope** carrying a reserved-namespace `action_id` — never the |
| 195 | +`authorized_action_id` GO-2 binds. `moltbook/transport.py:1219-1221` provides |
| 196 | +`make_dry_run_action_id()` for exactly this: use it rather than hand-building the |
| 197 | +`dryrun-` string. Only `payload_hash` and `action_type` carry across between the rehearsal |
| 198 | +envelope and the authorized one; `action_id` deliberately does not, and must not be made to. |
| 199 | + |
| 200 | +`DryRunOutcome.simulated_outcome` is hardcoded to `TransportOutcome.SUCCESS` |
| 201 | +(`moltbook/transport.py:1265`). The rehearsal therefore exercises `validate_envelope()`'s three |
| 202 | +freshness checks (§2 above) faithfully, but **cannot rehearse** a captcha challenge, a captcha |
| 203 | +failure, or the §5 AMBIGUOUS branch — those only exist in `MoltbookHTTPTransport.send()`'s network |
| 204 | +path, which the dry run never calls. Nothing about §5 can be verified by rehearsal; the first time |
| 205 | +the AMBIGUOUS branch can occur at all is during the real send. The dry run also cannot rehearse §4's |
| 206 | +action-ID control point in any way that matters: a dry-run envelope's `action_id` is required to be |
| 207 | +a `dryrun-` id, so it never exercises the real-envelope construction call where the omission risk |
| 208 | +in §4 actually occurs. |
| 209 | + |
| 210 | +## 7. Sequence |
| 211 | + |
| 212 | +Preconditions: GO-2 signed and unexpired; `execution_candidate_commit` matches the current clean |
| 213 | +tree; rider (envelope doc §2) fully populated, including `dry_run_rehearsal_reference` from a |
| 214 | +completed rehearsal under a `dryrun-` id (§6 above). |
| 215 | + |
| 216 | +1. **Open the interactive session** that will hold the `KillSwitch` instance and call `send()` — |
| 217 | + per §3, this is not a background process. |
| 218 | +2. **Clean-tree recheck** — confirm the working tree still matches `execution_candidate_commit`. |
| 219 | +3. **`KillSwitch.engaged` recheck** — confirm `False`, in this same session, on the instance that |
| 220 | + will be passed to the transport. |
| 221 | +4. **Confirm the reachable `activate_manual()` path** — the operator can call it against this |
| 222 | + instance right now, from this session, without any additional setup. |
| 223 | +5. **Rider re-review** — confirm `authorized_action_id` and `authorized_payload_hash` on the |
| 224 | + envelope about to be constructed match GO-2's recorded values exactly. See §4: this is the |
| 225 | + sequence's only unenforced control point. |
| 226 | +6. **Construct and approve the standard `ActionEnvelope`** — the last step before send, per §2. |
| 227 | + Pass `action_id=authorized_action_id` explicitly (§4); do not let it default. This starts the |
| 228 | + 300-second window. |
| 229 | +7. **Call `send()`.** The operator remains present for the duration, kill switch reachable. |
| 230 | + |
| 231 | + **The rechecks in steps 2–5 remain the "immediately before send" checks required by checklist |
| 232 | + §E row 1 and by row 2's first clause; row 2's second clause — a reachable |
| 233 | + `activate_manual(operator=...)` path open *during* the send — is a standing condition |
| 234 | + discharged by the operator presence step 7 requires, not by step 4.** Steps 6 and 7 make no |
| 235 | + change to the working tree, and the operator's own act of initiating the send — which §3 |
| 236 | + requires — is not such a change. For the kill switch the guarantee is stronger than an |
| 237 | + unbroken recheck window: `send()` calls `validate_envelope()`, `kill_switch.check_write()` and |
| 238 | + `eligibility.check_write()` before any network call (`moltbook/transport.py:1472-1474`), and |
| 239 | + `check_write()` is by contract the final outbound-boundary enforcement — "called immediately |
| 240 | + before the actual network write, not just once somewhere upstream" |
| 241 | + (`moltbook/transport.py:448-450`). Step 3's confirmation is therefore re-enforced in code at |
| 242 | + the instant of transmission. |
| 243 | + |
| 244 | + `engaged` is not thereby fixed for the whole of step 7 — the captcha-suspension-risk trigger |
| 245 | + (`moltbook/transport.py:495`) can engage the switch during verification. Per `send()`'s own |
| 246 | + contract, verification "gates PUBLICATION, not transmission — the write has already happened |
| 247 | + by the time it runs" (`moltbook/transport.py:1447-1448`), so it cannot affect the transmission |
| 248 | + that steps 2–5 gate. The operator's reachable `activate_manual(operator=...)` path — row 2's |
| 249 | + second clause above — stays open across that window. |
| 250 | +8. **Record the outcome** — `transmission_status` / `publication_status` / `verification_status`, |
| 251 | + RESOLUTION TRACE, `CaptchaAttemptRecord` if verification ran, `consumed_at` on GO-2 (checklist |
| 252 | + §E row 4). |
| 253 | +9. **Branch on outcome:** |
| 254 | + - `OUTCOME_UNKNOWN` / `AMBIGUOUS_WRITE` → checklist §E row 5 (freeze, escalate per §9). |
| 255 | + - `PUBLISHED` and correct → envelope doc §5(3)(a), operator records acceptance. |
| 256 | + - `PUBLISHED` but incorrect → checklist §E row 6, forward dependency on §C5 (§8 below). |
| 257 | + - `PENDING_VERIFICATION` / `REQUIRED` → §5 above: stop, record, escalate. |
| 258 | + - `NOT_PUBLISHED` with `FAILED` or `EXPIRED` → terminal per envelope doc §5(1); operator records |
| 259 | + disposition. |
| 260 | + |
| 261 | +## 8. Forward dependency on §C5 |
| 262 | + |
| 263 | +Checklist §E row 6 invokes the Published-Outcome Correction and Withdrawal Procedure (§C5), which |
| 264 | +is **not started** as of this document. This runbook records that dependency rather than resolving |
| 265 | +it: if the first send publishes incorrect content, §7 step 9's "published but incorrect" branch |
| 266 | +points to a procedure that does not yet exist. This is recorded here as a known forward reference, |
| 267 | +consistent with how GO-1 authorized preparation before §C's artifacts existed — not a defect |
| 268 | +introduced by this document, and not something C4 can close on its own. |
| 269 | + |
| 270 | +## 9. What this document does not attest |
| 271 | + |
| 272 | +It does not attest that C5 exists, that the AMBIGUOUS-verification gap is resolved, or that a send |
| 273 | +executed under this sequence will succeed. It records the order forced by the envelope window |
| 274 | +(§2), the execution model forced by the kill switch (§3), an unenforced manual control point named |
| 275 | +rather than closed (§4), a stop condition already implied by existing rulings rather than newly |
| 276 | +authorized here (§5), and the dry-run's actual coverage (§6). A material change to the envelope |
| 277 | +doc, the transport spec, or the checklist requires review of this document against the change |
| 278 | +rather than assuming it still holds. |
| 279 | + |
| 280 | +## 10. Version binding |
| 281 | + |
| 282 | +Bound to the transport implementation at **`52a8c9c`** (main, post-C3), to |
| 283 | +`docs/m7_first_live_post_governed_envelope.md` §5 as quoted at §5.3 and §5.4 above, and to |
| 284 | +`docs/m7_operator_go_checklist.md`'s §D and §E as quoted. Does not inherit forward across a |
| 285 | +material change to any of them. |
0 commit comments