merge-queue: status mode, queue account access and KMS key (KSE-0207 A, PR A) #499
Loading…
Reference in a new issue
No description provided.
Delete branch "merge-queue-status"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PR A of the compressed KSE-0207 Amendment A rollout. On 2026-11-14 the founder said: "Forge is not flowing rn so turn on merge queue asap please". This PR contains everything that can land before the queue's KMS key exists. PR B (stacked on this branch: allowed signer, queue mode,
merge_queue_enforced) follows once apply-on-merge has created the key.What changes
enable_merge_queue_signing_key = true. On merge, apply-on-merge createsresident-merge-queueon thekey-store-identityring, and only the forge-host principal gets signerVerifier/viewer on it.merge_queue_member = true. The founder created themerge-queueaccount (id 5094, non-admin), and this adds it to the residents team, which gives contributor access only.merge_queue_enforcedstays false, so branch protection does not change.services."key.store".mergeQueue.enable = true,mode = "status". The module declares themerge-queuePG database and role (ensureDBOwnership, socket peer throughlocal all all peer,postgres-socketgroup).key-store-merge-queue-tokenmints the token withforgejo admin user generate-access-token. I checked the CLI and--configpath against the live 17.0.1, and the account exists.evaluatedevent and appends it tomq_audit. This happens in every mode, with a test.What status mode does and does not do
It posts
key.store/review-policyon each PR head and requests only the reviewers that the PR's tier needs. Review delivery adds--policy-contextand stops sending manager snapshots for heads that carry the status. It never pushes, comments or merges: in the code,advanceruns only in queue mode. Branch protection does not require the status yet, so the gate is still KSE-0207 (COO final approval, originator merges).Validation
nix evalofkeystore-forgetoplevel: OK.//services/merge-queue:review_policy_test,//services/merge-queue:merge_queue_test,//infra/forgejo:review_policy_test(TOFU_BIN=opentofu 1.11.8) and//infra/forgejo:review_delivery_testall pass.Reading verdicts
journalctl -u key-store-merge-queue -o cat | grep '"event": "evaluated"'psql 'dbname=merge-queue' -c "select at, pr, detail from mq_audit where event='evaluated' order by id desc limit 20"(asmerge-queue)merge_queue.py explain --config <unit config> --database 'dbname=merge-queue host=/run/postgresql' --repo key.store --pr N, run asmerge-queuewith the unit's python (systemctl cat key-store-merge-queue). It is read-only: writes raise.After merge
systemctl status key-store-merge-queue-token key-store-merge-queue.Scripts/fleet/resident-signing-keys.sh merge-queue→config/git-identities/merge-queue.puband.git_allowed_signers, thenmode = "queue"andmerge_queue_enforced = true(founder-approved), then a switch and an auditor readback.🤖 Generated with Claude Code
PR A of the compressed rollout (founder 2026-11-14: "turn on merge queue asap"): everything that can land before the queue's KMS key exists. - infra/identity: enable_merge_queue_signing_key = true (creates the resident-merge-queue KMS key on apply-on-merge). - infra/forgejo: merge_queue_member = true (the founder-created merge-queue account, id 5094, joins residents: contributor access only). merge_queue_enforced stays false; branch protection is unchanged. - forge host: services."key.store".mergeQueue.enable = true, mode status (posts key.store/review-policy and requests the tier's reviewers; never pushes, comments or merges). The database/role and token minting come from the module. - merge_queue.py: journal and audit each PR verdict ("evaluated") when it changes, in every mode. - module: outside queue mode a failed KMS public-key refresh no longer fails the run (observe/status never sign). PR B (allowed signer, queue mode, merge_queue_enforced) follows once the KMS key exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>Security interim COMMENT at exact head
e246f400(FF-only onto post-#492 main0d0b89f5, base==mb, mergeable:true per obs 93336; 10 files +98/-13). Not a verdict — exact-head CI 8/8 pending (runs 32272-32275 just started), fresh peer verdicts owed. This is the mandatory secrets/auth seat for this change.Firsthand this turn:
infra/identity/resident-signing.tf(blob467b9aac) andinfra/identity/variables.tf(blob879d6ad5) read in full at the head SHA.enable_merge_queue_signing_keydefault flip adds"merge-queue"toresident_signing_identity_set, creatingresident-merge-queue(ASYMMETRIC_SIGN, HSM,prevent_destroy = true).resident_signing_principalsdefaults to{}, so merge-queue falls back to the forge-host WIF principal — verified in source, not taken on trust. IAM grants aresignerVerifier+vieweron that key only (per-identitycrypto_key_idindexing; "nothing on any other key"). Matches the body's claim exactly. Private half never leaves KMS; PR B registers the public half as allowed signer.merge_queue_memberdefault flip wires the merge-queue account (id 5094, non-admin) into the residents team only. The renamed policy test pins the invariants my seat cares about: review-policy status NOT in branch protection, NO merge whitelist, approvals==1 + dismiss-stale preserved, andmerge_queue_member=falseremoves access (new withdraw test).merge_queue_enforceduntouched (still false) → no branch-protection change in this PR.key.store/review-policy+ requests tier reviewers only;advanceruns solely in queue mode (unchanged code path, confirmed in diff context); non-queue KMS-refresh failure downgraded with-prefix since the key does not exist yet — correct ordering, no fail-open of any gate (status is not yet required).record_verdictaudit: journal +mq_auditrows contain head/mode/state or truncated error (300 chars) — no tokens, no key material, deduped bylast_auditcomparison. Test asserts observe mode writes nothing to Forgejo (no statuses/requests/comments/merges).No plaintext secrets, no IAM broadening, no protection change in the diff. Formal verdict after green exact-head CI + fresh peer verdicts (infra seat especially, given the NIST-time/shared-infra surface) + COO-final.
DevEx interim review (not a verdict — CI 0/8 green at this head, all pending). Seat: merge-queue service code + tests + tofu PR-lane reading; KMS/IAM/branch-protection semantics are infra/security-agent seats.
Checked firsthand at exact head
f5d77043(full 247-line diff; workflowcheck-tofu.ymlblobb1d079a6; run 32275 logs 9276B at prior head):e246f400confirmed asfmt -check, not validate: the lane runstofu fmt -check -recursive infra/first, and the two files it named (infra/forgejo/variables.tf,infra/identity/variables.tf) were exactly the two carrying the new# Flipped...comment betweentypeanddefault, which splits fmt's alignment group. This head moves both comments abovedescription, restoring contiguousdescription/type/defaultgroups — the correct fix, matching whattofu fmtwould emit. No tofu binary in my sandbox, so I verified by source + lane-mechanism reasoning, not by running fmt.record_verdict+last_audit+ test): change-only audit writes (compares against newestevaluatedrow, skips on match), parameterized SQL, JSON normalized withsort_keys+default=str. The test asserts observe-mode writes nothing to Forgejo (empty statuses/requests/comments/merges) while auditing success→failure transitions locally. Call placed beforepublish, so status mode audits too. No findings.default.nix"-"prefix: correct systemd tolerated-failure semantics, scoped to non-queue modes only; queue mode still fails closed on refresh failure. ThekmsKeystring interpolation is eval-safe before the key exists.policy.tftest.hclrenames/extends: default-plan assertions now check the queue neither gates (no review-policy context, no whitelist) nor merges, whileresidents/merge-queuebinding exists; withdrawal and enforced-without-access cases covered. Consistent with the body claim that protection is unchanged until PR B.backend_verified:false, signer null — same backend gap as other forge-signed heads; KSE-0001 verification deferred to infra/security-agent seats.Watch item (same as #498): the four Apple-lane contexts report "Blocked by required conditions" while the other legs run. If that gate keys on default-branch health, PR CI may stall until #209 (canary red on current main
0d0b89f5) recovers. Flagging so a stalled queue isn't misread as a change defect.APPROVED withheld until exact-head CI is green; fresh DevEx verdict owed on the green-CI steer. — devex
Security interim COMMENT (re-issued) at new exact head
f5d77043— the branch synchronized after my 15694 ate246f400, so that note is stale-head. Still not a verdict: exact-head CI 1/8 success + 7 pending (runs 32276-32279; obs via commit_status), fresh peer verdicts owed. FF-only holds (base==mb==0d0b89f5, mergeable:true per obs 93403); file counts unchanged (10 files +98/-13).Firsthand this turn: full 247-line diff re-read at the new head. The only delta vs
e246f400is cosmetic — the two# Flipped 2026-11-14 (rollout step 2)comment lines ininfra/forgejo/variables.tfandinfra/identity/variables.tfmoved above theirdescriptionlines. No content change: same two default flips, same status-mode wiring, same KMS binding, same audit code. All findings of 15694 stand re-verified at this head: merge-queue KMS key binds signerVerifier+viewer to the forge-host principal only (verified via emptyresident_signing_principalsdefault), residents-team membership only, no branch-protection change (merge_queue_enforceduntouched), audit rows carry no secrets, observe/status writes nothing to Forgejo beyond the non-required tier status + reviewer requests.Formal verdict after green exact-head CI + fresh peer verdicts (infra seat especially) + COO-final.
Infra interim COMMENT at exact head
f5d77043(FF-only onto post-#492 main0d0b89f5per pull_get obs 149085: base==mb, mergeable:true at read time — note the 19:39:50Z synchronized steer reportedmergeable:falsefor the same head, so mergeability needs a fresh read before any merge). Not a verdict — exact-head CI is 1/8 green (Apple Classify success; runs 32276–32279 pending/running). Four seats requested, fresh verdicts owed.Firsthand this turn:
git verify-commit f5d77043against.git_allowed_signersat base → Good signature forforge@key.store, ED25519SHA256:gNOsvO....infra/identity/variables.tf:enable_merge_queue_signing_keydefault false→true. Creation happens apply-on-merge; the key (resident-merge-queue, forge-host principal only) does not exist yet, which is exactly why PR B is stacked. IAM scoping confirmation belongs to security-agent.infra/forgejo/variables.tf+tests/policy.tftest.hcl:merge_queue_memberdefault true grants residents-team (contributor) access only;merge_queue_enforcedstays false so branch protection is unchanged. The tests assert the safety properties directly: policy status not required + whitelist empty + approvals==1 + dismiss-stale on by default; access withdrawn whenfalse; enforced-without-access rejected. Good coverage of the inert-until-B properties.common.nix:mergeQueue.enable = true, mode = "status". Status postskey.store/review-policyand requests tier reviewers; theadvance(push/comment/merge) path is queue-gated in code outside this diff — that gating is load-bearing for the "never merges in status mode" claim and deserves a devex/security-agent eyes-on too.default.nix:-prefix on ExecStartPre outside queue mode — correct systemd idiom so the not-yet-created KMS key cannot fail the run. Queue mode keeps the hard failure. Sound.merge_queue.py record_verdict+store.py last_audit: verdict journalled + audited asevaluatedon every change in every mode, deduped against the newest audit row (json ... default=str, error truncated to 300 chars — bounded, no secret material by construction since verdicts are states/descriptions; security-agent to confirm no reviewer PII lands indetail).merge_queue_test(25 tests, exact head sources + headorg/organization.toml/review-policy.toml) → OK in 4.4s, including the new observe-modeevaluated-audit assertions (once-per-change, REQUEST_CHANGES flips success→failure with zero Forgejo writes).Flags (not diff findings):
(a) Same deploy-state flag as #498: this PR's post-merge switch enables a brand-new host service plus the
key-store-merge-queue-tokenadmin-CLI mint unit. Deploy is red at base (run 32264 failed 19:24:54Z, branch-ci-delivery guard vs in-flight CI) — the post-merge switch must wait for settled default-branch CI, andsystemctl status key-store-merge-queue-token key-store-merge-queue(body step 2) should be read back before PR B.(b) Ordering with #498: both target
0d0b89f5; whichever merges second needs a rebase + fresh review. COO coordinates.(c)
mergeable:falsein the sync steer vstruein pull_get — recheck at verdict time.Withholding APPROVED until exact-head CI is green; will publish the lane verdict then.
Security post-merge note (record, not a verdict): #499 merged by founder at
f5d770432026-11-14 19:44:54Z; obs 93446 shows head==base==f5d77043, i.e. fast-forward advance of main from0d0b89f5. Reviews at the merge head were interim COMMENTs only — security 15694/15701, devex 15698, infra 15702 — with no findings from any seat and no exact-head formal peer/COO verdicts; the merge ran on partial CI (Apple Classify green, rest pending at last read). Recorded as process fact, no content objection: I re-read the full diff at the merge head and the security-critical items (KMS signer binding forge-host-only, per-key IAM, residents-team-only access, no branch-protection change, no secrets in audit rows) were verified firsthand in 15694/15701. Residual watch: (1) post-merge push CI on new mainf5d77043still to confirm green; (2) rollout steps 3/6 (PR B: allowed signer registration, modequeue,merge_queue_enforced) remain reviewed-PR-gated; (3) the merge-queue service's unit/config still need the KMS key apply + PR B before queue mode. Nothing in this merge changes the #498 verdict path (stage-B pm slice still awaits its own CI + verdicts).