Repository navigation
Enroll the rolling-custody candidate: merge-approval envelope and an operable merge-master approval for it (act A4) - #735
Conversation
…able for it (act A4) Brett Heap, 2026-09-06 on #656: "author the envelope PR now as a narrow first candidate." His merge word on this pull request is the grant, for the ONE class enrolled here and for nothing else. The Gate-Rules Council's 2026-08-28 unanimous refusal stands for the class it refused (a class over openspec/changes/**, whose admitted surface lies wholly inside the canonical GATE_INTEGRITY_FLOOR and so can never convene), and add-substantive-review-lane task 3.2 stays OPEN beyond this candidate. .github/merge-approval-envelope.yml enrols exactly one candidate, `intent-rolling-custody`: author openxfactory[bot], exact head ref intents/rolling, base main, path allowlist ideation/dashboard/intents/** plus ideation/dashboard/gate-records/**, require_all_checks true, self-excluding check name. Both prefixes are what scripts/ideation_dashboard/intent_apply_lane.py actually writes (DEFAULT_INTENTS_DIR and gate_console.DEFAULT_RECORDS_DIR); the lane commits with `git add -A`, so any delivery touching anything else falls outside the allowlist and parks for the human gate, which is what makes this narrow. .github/CODEOWNERS routes the file to a human owner — .github/workflows/ was owned, but that entry does not cover a file beside the workflows directory, and widening a grant must be reviewed. .github/workflows/merge-master-approval.yml keeps its job id (so no required-check context moves) and its advisory floor verdict, and gains the approval path xFactory's caller has run since 2026-07-28. Config and core both come from the base branch; an unenrolled head ref reaches `skip` before any fact is gathered; the repository gate floor is composed OVER the envelope, so a never-clearable path refuses whatever the envelope says; every fact set is gathered provably complete or the candidate parks; the decision is the pinned core's; the output emitter refuses an unrenderable reason rather than escaping it, because one newline could otherwise publish decision=approve. The workflow's own GITHUB_TOKEN stays READ-ONLY: the only write authority is a per-run App token minted after the core decides, scoped permission-pull-requests write on this repository alone. No merge call and no auto-merge — the aggregation's intent-apply lane arms that on its side (ruling D-3). The dispatch path resolves its candidate from the envelope's governed head refs, because that is what the aggregation dispatches: `gh workflow run merge-master-approval.yml --repo opensoft/openxFactory --ref main`, with no inputs (xFactory PR #304). Its enrollment preflight goes live by itself when this lands. tests/review_lane_pin/test_review_lane_caller.py asserted an ABSENCE. The reason for that absence is kept in the docstring rather than deleted, because it still holds for the class it covers; what the module asserts now is the narrow grant and the single door — one candidate with those exact fields, a refused-ground check over the allowlist, the review submission and every credential-wiring step gated on steps.envelope.outputs.decision, the mint scoped to pull-requests, no write scope on the workflow token, the closed-world decision shape, the floor composition, and the continued absence of every merge-shaped step. Six new negative controls put each one mutation from failing. Verified: actionlint clean; bash -n and strict mode on all twelve shell blocks; pytest tests/review_lane_pin 146 passed, 2 skipped. The envelope was validated by the pinned core itself and exercised against the real facts of #176 — matched as intent-rolling-custody, parked required_check_not_green because that head carries zero check-runs. Refs #656 Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01MDVAo41VtZqJQpuawwJeYC
There was a problem hiding this comment.
Hi @brettheap! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
There was a problem hiding this comment.
🟡 Changes recommended
The workflow currently mints an App token without issues: write while later calling Issues comment endpoints, and it masks dispatch candidate-resolution API failures as a no-op, both of which break stated/expected lane behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR enrolls a single, narrowly-scoped merge-approval candidate (intent-rolling-custody) by introducing a base-branch merge-approval envelope and updating the merge-master-approval workflow to evaluate that envelope and (only when approved) submit an approving review via a GitHub App token; the accompanying tests and CODEOWNERS rules pin the grant’s exact shape and guard against widening or adding merge authority.
Changes:
- Add
.github/merge-approval-envelope.ymldefining exactly one enrolled candidate class and its allowlisted surface. - Extend
.github/workflows/merge-master-approval.ymlto evaluate the envelope (fail-closed) and submit an APPROVE review when the envelope decision isapprove. - Update
tests/review_lane_pin/test_review_lane_caller.pyand.github/CODEOWNERSto pin the envelope/workflow invariants and require human review of envelope edits.
File summaries
| File | Description |
|---|---|
tests/review_lane_pin/test_review_lane_caller.py |
Replaces “approval must be impossible” assertions with “approval is possible through exactly one narrow door” invariants and negative controls. |
.github/workflows/merge-master-approval.yml |
Adds envelope evaluation, gated App-token minting, gated approval submission, and sticky PR outcome reporting. |
.github/merge-approval-envelope.yml |
Introduces the single enrolled intent-rolling-custody candidate class with strict author/head/base/path/check constraints. |
.github/CODEOWNERS |
Adds explicit ownership for the envelope file to force reviewed human changes for any widening. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…he candidate's key set Redo of the security verifier for PR #735 (act A4), plus the three open Copilot review threads: - The merge-master App token minted only pull-requests: write, but the sticky-comment step posts through the Issues Comments API (what a pull request's conversation thread actually is), which pull_requests does not gate. Add permission-issues: write to the mint and correct the three comment blocks that claimed otherwise. - The workflow_dispatch candidate-resolution loop masked a failed `gh pr list` with `|| true`, contradicting this file's own stated fail-closed posture ("a fact that cannot be obtained is not a fact that is empty"). A failed listing now aborts the run with a named error instead of silently falling through to "nothing to evaluate". - NegativeControls.setUpClass read its three source files unconditionally, so a missing one surfaced as a bare FileNotFoundError rather than a clear assertion; it now names the missing file. Covered by a new test that mocks ENVELOPE to a missing path. - Governance verifier's low finding: pin the enrolled candidate's key set by asserting the absence of open_finding_title_prefixes and open_finding_labels, so either key silently reappearing (as xFactory's own doc-health-nightly candidate carries) would break a test. Verified live: the review-submission gate and the refused-ground allowlist check were each mutated and confirmed red, then restored and confirmed green; actionlint is clean on the workflow. Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01CHAHvr9zFHRd4kWVnZLK9k
There was a problem hiding this comment.
🔵 Needs a closer look
A small gap in the new negative-control denylist can miss --auto when it appears without a trailing space, weakening the intended structural guard against auto-merge enablement.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
tests/review_lane_pin/test_review_lane_caller.py:161
MERGE_SHAPEDincludes the needle"--auto "(with a trailing space). That will miss agh pr merge --autoinvocation if--autoappears at end-of-line or before a newline (no trailing space), weakening the intended structural guard against auto-merge enablement.
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
…1/5.2 ticked on the D-2 evidence) (#832) Path A PR-5, the last of the 2026-09-06 plan memo's sequence, on Brett Heap's word "merge pr-5 when green" (2026-09-09). Authority: his ruling of 2026-09-05T23:38Z "rule path A, 4.5 is a deferred successor" (#656) and ruling D-2 (the live exercise). - tasks.md: § 4.4 / § 5.1 / § 5.2 ticked on the D-2 evidence (three `- [ ]` heads removed, every ratified sentence kept byte-identical); § 4.5 untouched as a DEFERRED SUCCESSOR (#714 → 3d1b8cc). - Archived WITH promotion via `scripts/proposal-support.py . archive --date 2026-09-09` under the pinned @fission-ai/[email protected] (never a bare `openspec archive`); origin retained (declaration unchanged since da1b0e9); six frozen files R100. - Promoted: `openspec/specs/ideation-intent-plane/spec.md` NEW (7 requirements / 11 scenarios, every block byte-identical to the archived delta) and `openspec/specs/document-lifecycle/spec.md` 18 → 19 requirements ("Gates happen on main"); the new capability's `## Purpose` written by this act (no SHALL; replaces the CLI's TBD stub). openspec/specs 60 → 61; floor regeneration OWED (GRACED covered-pending 1, `created_by_candidate`), `contracts/review-lane-floor-snapshot.yaml` deliberately not edited here. - README OpenSpec Records row → archived; sweep-ledger row re-seeded with the tool (`--seed-ledger --moved-by '#832'`, one line moved); no thirteenth archive-date disposition. - Evidence (merged + green): #718 d179cc0, #727 07624d5, #735 6d3237e, xFactory #304 b2db7e47, #313 ddd19650, #345 90435875, #781 450bb60, #808 2ef7d8c, #814 c991c0f, #816 8924230, xFactory #362 119280a8, #830 202c170, xFactory #369 c2313277; D-2 live exercise: act B refusal 36d07ec, act A apply e970dfe, first autonomous merge #176 → 7681e40 (codexfactory[bot] APPROVED 2026-09-09T06:37:22Z). - Copilot round 1: one factual finding taken (a missing "where" in Purpose); two wording findings answered and resolved. Refs #656 (stays OPEN). Rule 6 LANDING window observed. Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_012LiNG5Ume1boEfxSNeCmpu
Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox)
Act A4 on openxFactory #656. Brett Heap, 2026-09-06: "author the envelope PR now as a narrow first candidate."
What this asks for, stated plainly
Your merge word on this pull request is the grant, and it is a grant for exactly one candidate class. Nothing here widens beyond
intent-rolling-custody. The Gate-Rules Council's 2026-08-28 unanimous refusal stands for the class it refused — a class overopenspec/changes/**, refused because its admitted surface lies wholly inside the canonicalGATE_INTEGRITY_FLOORand so can never convene — andadd-substantive-review-lanetask 3.2 stays OPEN beyond this candidate. This PR is not that grant and does not pretend to be.What lands
1.
.github/merge-approval-envelope.yml— one candidate,intent-rolling-custodytarget_reposopensoft/openxFactoryexpected_authoropenxfactory[bot](verified:gh api repos/opensoft/openxFactory/pulls/176 --jq .user.login)expected_head_refintents/rolling(exact, never a pattern)expected_base_refmainpath_allowlistideation/dashboard/intents/**,ideation/dashboard/gate-records/**require_all_checkstruecheck_exclusionsmerge-master-approval(self-reference deadlock)revert_sufficestrueBoth prefixes were read out of
scripts/ideation_dashboard/intent_apply_lane.pyrather than assumed:DEFAULT_INTENTS_DIR = "ideation/dashboard/intents/"andgate_console.DEFAULT_RECORDS_DIR = "ideation/dashboard/gate-records/"._write_intentnever overwrites an existing intent, so both trees are append-only. The apply lane commits withgit add -A, so any delivery that touches a governed artifact outside those two trees falls outside the allowlist and parks for the human gate — that is what makes this narrow, and it is the same operator note xFactory'sdoc-health-nightlycarries after the council's own R5 narrowing of 2026-08-26.The envelope's header records the grant (who, when, on which issue) and that no other class is enrolled.
.github/CODEOWNERSnow routes the file to@brettheap:.github/workflows/was owned, but that entry does not cover a file beside the workflows directory, and widening the grant must be a reviewed human act.2.
.github/workflows/merge-master-approval.yml— operable for envelope candidatesMirrors xFactory's implementation, which has run this candidate shape since 2026-07-28. Same job id (
merge-master-approval), so no required-check context moves and no ruleset is touched. The advisoryrepository_gate_floorverdict still runs on every pull request, unchanged.How an approval is gated — all of these, conjunctively:
pull_request_targetresolves the workflow definition and the base checkout frommain; no step checks out or executes head content. A PR cannot alter the rules that govern its own approval, and a PR that edits the envelope lands outside the envelope's own allowlist.skip, with no facts gathered at all. The head ref is tested against the envelope's own governed set first.FLOOR_MATCHED != 0, where an empty value from a skipped or failed floor step also refuses). The allowlist and the floor are disjoint today, so this can only fire on a future widening.changed_files, the check-run and commit-status listings against their owntotal_count, both paginated, with atotal_countthat moves between pages parking rather than mixing snapshots. No|| echo '[]'anywhere: a failed read is an unobtained fact, never an empty one.opensoft/codexFactory@ad15a898'sscripts/merge_master/envelope.py, at the commitcontracts/review-lane-pin.yamlalready pins. This repository re-implements none of it.reasoncomes out of the core carrying externally-supplied check-run and status names;$GITHUB_OUTPUTiskey=valueand the last write wins, so one newline in a reason could otherwise publishdecision=approve. Unrenderable values are refused outright, anddecisionis one of four literals.steps.envelope.outputs.decision == 'approve'is the sole condition on which any review is submitted, and it is written by nothing but the core's exit code.GITHUB_TOKENstays read-only (contents/pull-requests/checks/statuses, allread). The only write authority is a per-run App token minted fromMERGE_MASTER_APP_ID/MERGE_MASTER_APP_KEYafter the core decides, scopedpermission-pull-requests: writeon this repository alone. That is stricter than xFactory's caller, which carriespull-requests: writeon its own token.The
workflow_dispatchpath now resolves its candidate from the envelope's governed head refs, because that is what the aggregation actually dispatches:gh workflow run merge-master-approval.yml --repo opensoft/openxFactory --ref main, with no inputs (xFactory.github/workflows/intent-apply.yml, PR #304). Its enrollment preflight — "openxFactory carries no merge-approval envelope … so no dispatch" — goes live by itself the moment this lands.3.
tests/review_lane_pin/test_review_lane_caller.py— the amendmentThe module used to assert an absence: no App token, no review submission, no envelope file. The reason for that absence is kept in the docstring rather than deleted, because it is still in force for the class it covers. What the module now asserts instead is that the approval exists behind exactly one door and that the door is this narrow: exactly one candidate with that author, head ref, base and those two path prefixes;
require_all_checks: true; a refused-ground check that fails if the allowlist ever reachesopenspec/,contracts/,governance/,.github/,scripts/,health/or the wallet; the review-submitting step gated on the envelope decision; every step wiring the approver credential gated on it too; the mint scoped topull-requests; no write scope on the workflow token; the closed-world decision shape; the floor composition; and the continued absence of every merge-shaped step. Six new negative controls make each of those one mutation from failing.Authority and design
add-ideation-intent-plane): the authenticated intent was the decision — this approval is custody, not decision. The approval body says so..github/merge-approval-envelope.ymlcandidatedoc-health-nightlyand.github/workflows/merge-master-approval.yml.MERGE_MASTER_APP_ID/MERGE_MASTER_APP_KEYbeing shared with this repository, and the App installation holdingcontents: writeso GitHub counts its approval. Until then the lane evaluates, names the missing configuration in the job summary, and parks — exactly where the candidate sits today.Verification
actionlintclean on the workflow.bash -nandset -euo pipefailon all twelve embedded shell blocks (asserted by test).python3 -m pytest -q tests/review_lane_pin— 146 passed, 2 skipped (the pre-existing cross-repository freshness skips), 48 subtests passed.intent-rolling-custodywith author, base, allowlist and both completeness proofs holding, and parksrequired_check_not_greenbecause that head presently carries zero check-runs — absence is never greenness. Synthetic variants confirm approve on a green head,path_allowlistpark on anopenspec/specs/**path,expected_authorpark on a human author, andcandidate_classskip on a foreign head ref.Refs #656
Offered for Brett Heap's word.
🤖 Generated with Claude Code
https://claude.ai/code/session_01MDVAo41VtZqJQpuawwJeYC