diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 52b0cf4f4..dee195252 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -677,6 +677,7 @@ jobs: publish: name: Publish npm package and GitHub Release + environment: release needs: - verify-tag - release-qualification @@ -696,10 +697,24 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 permissions: + actions: read attestations: write contents: write id-token: write steps: + # GitHub can create an environment with no configured reviewers. + - name: Verify release approval + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/approvals" | + jq -e 'any(.[]; .state == "approved" and .user.login == "wallstop" and + any(.environments[]; .name == "release"))' >/dev/null || { + echo "::error::This run needs wallstop approval for the release environment." + exit 1 + } + - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: diff --git a/.llm/context.md b/.llm/context.md index 6039bb988..2e4517288 100644 --- a/.llm/context.md +++ b/.llm/context.md @@ -28,12 +28,17 @@ - Keep ignored `progress/` and `.artifacts/` local; never force-add them or their metadata. - Keep `PLAN.md` below 100 lines as a routing page. Follow [plan maintenance](./skills/plan-maintenance/SKILL.md); issues own durable decisions. -- Aggregate related local commits into at most one PR per session. Push once practical local - verification is complete. Do not push after every commit or run unrelated audits per edit. +- Work toward zero open issues. Agents may select issues, push, repair and merge ordinary PRs + through the protected branch, and close issues with verified acceptance evidence. Keep one + active agent PR at a time. Target three hours elapsed per session, including CI and review. + Finish the active PR before starting another. Follow the agent task workflow for merge gates. - Use the GitHub connector/extension first, local git second, and `gh` last. Follow [GitHub access](./skills/github-access/SKILL.md). Never print credentials. -- Human review remains required. Where present, `GOAL.md` adds maintainer-local release criteria; - it is git-ignored and absent from fresh checkouts. +- Maintainers review ordinary merges asynchronously. Obtain advance human approval for changes + that weaken merge or release controls or grant publishing authority. Reserve 4.0.0 launch + for explicit human wallstop approval of the candidate and destinations in + [readiness issue #575](https://github.com/Ambiguous-Interactive/DxMessaging/issues/575). + Close it last. Local `GOAL.md` adds release criteria when present. ## Tooling diff --git a/.llm/skills/agent-task-workflow/SKILL.md b/.llm/skills/agent-task-workflow/SKILL.md index d4704fb43..5ea2d018e 100644 --- a/.llm/skills/agent-task-workflow/SKILL.md +++ b/.llm/skills/agent-task-workflow/SKILL.md @@ -25,6 +25,52 @@ Use existing reports, profilers and test runners; do not add a custom orchestrat and measured costs. [Coding conventions](./references/repository-conventions.md) carries the language, test and documentation rules; read only the relevant sections. +## Session and review + +1. Record the start time. Resume the open agent PR, including a draft from an earlier session. + Check default-branch regressions and findings on merged PRs before new backlog work. + A different contributor's independent PR does not occupy the slot. +1. Choose one testable outcome. Combine issues with the same cause and acceptance evidence. + Close an evidence-only investigation directly when its criteria are met, including a + demonstrated negative result. Preserve the verdict and limitations on the issue. +1. After practical local checks, open one PR. Repair failures at their cause. Verify all + applicable checks and the three required contexts named in the repository guidelines on the + current revision. Require completed automated reviews. Scan inline threads, review bodies + and discussion, including out-of-diff findings. Fix or record a reasoned disposition for + each actionable finding. Recheck review and CI evidence after every push. +1. Confirmed CodeRabbit throttling on the current head is an exception for that review only. + Record the head, explicit limit notice, full feedback scan and prior finding dispositions. + Pending or absent review alone is insufficient. Honor GitHub blocking review decisions. +1. Before merging, check the current head, base, merge eligibility and pending decisions. + Use a normal protected merge bound to the verified head. Enable native auto-merge only if + every prerequisite, including review, is enforced when it fires. Never use the maintenance + App's bypass. Verify the merge SHA and linked issue closures before selecting the next task. +1. Budget elapsed time, including waits. Reserve time for the task, local checks, a + representative CI and review cycle, and one repair. Use recent comparable lane timings. + At three hours finish only the active PR and record why it overran. At an external + blocker, hand off the PR head, evidence, blocker and next action. Resume it next session. + +## Maintainer review and rollout + +Use merged PRs as the human review queue. Record wallstop's last reviewed revision and the +outstanding compare range in [#575](https://github.com/Ambiguous-Interactive/DxMessaging/issues/575). +Advance the revision only on human attestation. Link each actionable finding to a new or +reopened issue. Give a default-branch regression priority for repair or revert. + +Before enabling ordinary autonomous merges, verify a distinct agent identity, effective +branch protections, ordinary merge permission without bypass, and the protected release +environment. Until verified, prepare changes for human merge. Obtain advance human approval +for changes that weaken controls or grant publishing authority. For the 4.0.0 release PR, +tag, manual dispatch, registry publication and Store submission, follow the +[release approval procedure](../../../docs/ops/npm-release-publishing.md#release-approval). + +For the first ten enabled sessions, record start/end time, overruns, blockers, merged PRs, +issues opened/closed/reopened, time from green and reviewed to merge, CI retries, reverts +and post-merge findings. Use GitHub timestamps and existing session records. Mark missing +clocks unmeasured. Compare like task types and report sample sizes and fraction within three +hours. Investigate each overrun. Suspend autonomous merges on a bypassed gate or an unguarded +launch path. + ## Optional coordinator Use one owner for a coupled change. A coordinator may assign independent work only when the @@ -32,7 +78,7 @@ session authorizes delegation. Default pilot limit: two implementation workers, Give each worker its own worktree, fixed base revision, disjoint allowed files, checks, and stop rule. Workers return a commit, evidence and unresolved findings. They do not push or operate shared Unity. -The coordinator owns integration, the session's one PR, combined verification and exclusive Unity +The coordinator owns integration, the active PR, combined verification and exclusive Unity access. Serialize conflicting files and all host/editor changes. Never switch or project the shared checkout while another owner is using its editor. Batch independent read-only tool calls. @@ -47,6 +93,6 @@ One successful coordinated session is feasibility evidence, not that evaluation. ## Completion Verify selected versus executed cases and preserve the source revision for each result. Report -changes, why they help, measured results and remaining limitations. Publish one prepared PR only -after practical local checks. Human acceptance and release-readiness remain separate gates. +changes, why they help, measured results and remaining limitations. Report the actual open issue +count and external inputs. Keep #575 open until its human and technical criteria pass. `GOAL.md`, when present, adds maintainer-local criteria; it is git-ignored and absent from fresh checkouts. diff --git a/.llm/skills/plan-maintenance/SKILL.md b/.llm/skills/plan-maintenance/SKILL.md index febc5361f..a2beefe13 100644 --- a/.llm/skills/plan-maintenance/SKILL.md +++ b/.llm/skills/plan-maintenance/SKILL.md @@ -36,7 +36,11 @@ research bibliographies, implementation notes, or completed checklists into `PLA ## Task lifecycle -1. Confirm the linked issue is still open before selecting it. +1. At session start and after each merge, refresh issues, open agent PRs and maintainer findings + on GitHub. Resume the active PR first. Otherwise select ready work that unblocks others and + fits the remaining time. Remove merged PRs from the queue. +1. Mark work blocked only on a named external input. Record what makes it ready and continue + independent ready work within the one-active-PR limit. 1. Put the hypothesis, RED condition, GREEN checks, stop rule, and evidence location in the issue when issue writes are authorized and available. Otherwise, use the current progress record and keep a short pending-issue-sync item in `PLAN.md` with the exact access or authorization condition. diff --git a/.llm/skills/pull-request-writing/SKILL.md b/.llm/skills/pull-request-writing/SKILL.md index 6f2977099..ddb63d519 100644 --- a/.llm/skills/pull-request-writing/SKILL.md +++ b/.llm/skills/pull-request-writing/SKILL.md @@ -22,17 +22,12 @@ one idea per sentence, active voice. - Deciding which measurements, tables, or logs belong in the body. - Writing the pull request that closes several issues at once. -## Session delivery boundary - -- Open at most one pull request per agent session. Draft and stacked pull requests count toward - this limit. -- Before opening a pull request, check whether the current session already opened one. Reuse that - pull request and bundle related commits into it. -- If more work does not belong in the same review, keep it local and leave a handoff for a later - session. Do not open a second pull request. -- Run practical local checks before the single push. Do not use separate pull requests as CI probes. -- If a session already opened several pull requests, stop new work. Consolidate into the earliest - suitable pull request, close the redundant pull requests, and avoid restarting their workflows. +## One active pull request + +Resume the existing agent PR, including a draft. Group changes that share a cause and +acceptance evidence. Push after practical local checks. Confirm the merge and issue closures +before opening another PR in the same session. Follow the +[session and review procedure](../agent-task-workflow/SKILL.md#session-and-review). ## Rules @@ -65,8 +60,8 @@ change leaves something open that a reader must know about. - A pull request closing several issues has one `Why / What changed / How we know` block per issue, so it is longer overall. The ceiling is per block, not per page. It still does not get a preamble. -- Move deep evidence to the issue or to a `progress/` record and link it. The body carries the - verdict, not the working. +- Link durable issue evidence. Identify changed user-facing copy and residual risks for + asynchronous maintainer review. Local progress files are unavailable to GitHub readers. ### Simplified Technical English diff --git a/docs/ops/npm-release-publishing.md b/docs/ops/npm-release-publishing.md index 6e0d57f3e..d9371326e 100644 --- a/docs/ops/npm-release-publishing.md +++ b/docs/ops/npm-release-publishing.md @@ -34,11 +34,26 @@ Configure npm Trusted Publishing for: - GitHub organization: `Ambiguous-Interactive` - GitHub repository: `DxMessaging` - Workflow: `.github/workflows/release.yml` -- Environment: only if the GitHub release job uses one +- Environment: `release` Trusted Publishing uses OIDC. The workflow uses a pinned npm CLI with Trusted Publishing support. +## Release Approval + +Configure the GitHub `release` environment with wallstop as the required reviewer, restrict +it to release tags, and disable administrator bypass. Match the environment in the npm trusted +publisher binding. Keep the agent on a separate account without approval or bypass authority. +Verify these settings before enabling autonomous merges. The publish job checks this workflow +run's environment review before publishing. + +Before merging the 4.0.0 release PR, obtain a decision from human wallstop in +[release readiness](https://github.com/Ambiguous-Interactive/DxMessaging/issues/575). +Record the version, PR head and candidate tree, and authorized publication destinations. +Confirm the merged tree matches before dispatch. Obtain a new decision if the candidate +changes. This decision also applies to manual tagging, registry publication and Asset Store +submission. An agent operating through wallstop's account cannot supply human approval. + ## Release Trigger The normal path never creates the tag by hand: diff --git a/docs/ops/release-operations.md b/docs/ops/release-operations.md index a32f7a410..828713179 100644 --- a/docs/ops/release-operations.md +++ b/docs/ops/release-operations.md @@ -69,7 +69,8 @@ organization password manager. ## Release Model The [release-readiness criteria](https://github.com/Ambiguous-Interactive/DxMessaging/issues/575) -define release acceptance. The pipeline runs prepare dispatch, PR, tag, +define release acceptance. Obtain [4.0.0 launch approval](./npm-release-publishing.md#release-approval) +before merging the release PR. The pipeline runs prepare dispatch, PR, tag, exact-revision qualification, release dispatch and publication: 1. An operator dispatches `.github/workflows/release-prepare.yml` from the diff --git a/scripts/__tests__/test_unity_validation_tiers.py b/scripts/__tests__/test_unity_validation_tiers.py index e83ac15a3..e07508cbf 100644 --- a/scripts/__tests__/test_unity_validation_tiers.py +++ b/scripts/__tests__/test_unity_validation_tiers.py @@ -284,6 +284,34 @@ def setUpClass(cls): cls.script = cls.document["jobs"]["release-qualification"]["steps"][1]["run"] cls.versions = json.loads((ROOT / ".github/unity-versions.json").read_text())["all"] + @unittest.skipIf(os.name == "nt", "release approval runs in Bash") + def test_publish_requires_wallstop_review_for_the_release_environment(self): + publish = self.document["jobs"]["publish"] + self.assertEqual(publish.get("environment"), "release") + self.assertEqual(publish["permissions"]["actions"], "read") + gate = publish["steps"][0] + self.assertEqual(gate["name"], "Verify release approval") + self.assertNotIn("if", gate) + self.assertFalse(gate.get("continue-on-error")) + review = {"user": {"login": "wallstop"}, "state": "approved", "environments": [{"name": "release"}]} + cases = [ + ("no review", [], False), ("wrong reviewer", [dict(review, user={"login": "other"})], False), + ("wrong environment", [dict(review, environments=[{"name": "staging"}])], False), + ("rejected", [dict(review, state="rejected")], False), ("approved", [review], True), + ("API unavailable", None, False), + ] + mock = """gh() { + [[ "$*" == "api repos/o/r/actions/runs/42/approvals" && -n "$REVIEWS" ]] || return 1 + echo "$REVIEWS" + } +""" + for name, reviews, allowed in cases: + with self.subTest(name=name): + env = dict(os.environ, GITHUB_REPOSITORY="o/r", GITHUB_RUN_ID="42", + REVIEWS=json.dumps(reviews) if reviews is not None else "") + run = subprocess.run(["bash", "-c", mock + gate["run"]], env=env, capture_output=True, text=True) + self.assertEqual(run.returncode == 0, allowed, run.stdout + run.stderr) + def test_publication_requires_all_release_lanes(self): needs = self.document["jobs"]["publish"]["needs"] self.assertIn("release-qualification", needs)