Skip to content

auto-merge: the bee-gated merge autopilot for trinity PRs (closes #12145's trinity half) - #1742

Merged
gHashTag merged 1 commit into
mainfrom
lane/auto-merge
Oct 25, 2026
Merged

gHashTag merged 1 commit into
mainfrom
lane/auto-merge

Conversation

@gHashTag

Copy link
Copy Markdown
Collaborator

The TRINITY merge autopilot (Trinity-S-AI-DNA/t27#12145, trinity half): .github/workflows/auto-merge.yml, the cross-repo subset of t27's Auto Merge Ready PRs gate, for pull requests on trinity main. Its pair PR is the cron card Trinity-S-AI-DNA/t27#12169 (specs/crons/trinity-auto-merge.t27); the card lands only together with this workflow, per the crons registry honesty rule.

Owner approval (owner-approved-foreign label)

On 2026-10-25, in the agent session driving the T27F live lane (OpenCode, t27/trinity repos), the owner said, verbatim: "сам!! одобряю тебе сделать все owner-approved-foreign" -- approving the owner-approved-foreign label for the pull requests of this lane. This PR adds a GitHub Actions workflow (YAML), which is foreign code under the only-t27 rule; the label is applied for that reason.

The gate

Schedule every 10 minutes (*/10 * * * *) plus workflow_dispatch (with a dry_run input). For each OPEN pull request on trinity main:

  1. Work-report recovery (live now). If the body carries a t27-work-report block and the head SHA has no T27 work report commit status (missing, or stale after a push -- a pushed head is a new SHA that carries none), dispatch the existing PR work report and blog workflow (pr-blog-report.yml) with pr=N. A FAILURE status is not re-dispatched: that means the report block itself is missing or stale, which only the author fixes.
  2. Merge --squash, only when ALL hold:
    • the T27 work report commit status is success on the head SHA;
    • the bee-reviewed label is present, was applied by the reviewer bee's own login (vars.BEE_REVIEWER_LOGIN, default t27-bees[bot]), and post-dates the head -- the head's time is the latest of its committer date, the first check run started on it, and the last force-push (the same rule t27's gate reads; every read fails closed);
    • no required check of the base branch is failing (read from the base ruleset; an unreadable ruleset makes every check required, as in t27's gate; pending or never-posted required checks are not green);
    • the pull request is mergeable (open, not draft, no conflicts).
  3. Never merge a pull request without the bee-reviewed label.

The merge half is DORMANT by design

Owner's rule, 2026-10-02: "the Queen must not merge by herself!! the Queen only manages!" No reviewer bee runs on trinity yet, so the bee's login can have applied no bee-reviewed label here, so the gate fails closed for every pull request and merges NOTHING until the reviewer bee reaches trinity. That is deliberate. The work-report recovery half is the part that works today. Not carried over from t27 (they live with the bee): the bee's own APPROVED review of the head and the discounted-check master look-back -- when the bee reaches trinity, those come with it.

The workflow checks out nothing (no PR head is ever executed), uses only contents: write, pull-requests: write, actions: write (the last for the dispatch), pins every merge with --match-head-commit, and treats a batch that merged nothing as a failure, as t27's gate does.

{
  "version": 1,
  "head_sha": "590eafd458692f294bef1fb98ab688434b569424",
  "summary": "The trinity merge autopilot: a scheduled workflow that recovers missing work-report statuses by dispatch and squash-merges only what a reviewer bee labelled after the head push.",
  "changes": [
    ".github/workflows/auto-merge.yml: the Auto Merge Ready PRs sweep for trinity main, scheduled every ten minutes plus workflow_dispatch, mirroring t27's gate in the cross-repo subset",
    "dispatch half: every open PR on main whose body carries a t27-work-report block gets pr-blog-report.yml dispatched when its head carries no T27 work report commit status",
    "merge half, dormant by design: squash-merge only with a success T27 work report status, a bee-reviewed label the bee's own login applied after the head arrived, no failing required base check, and a mergeable PR",
    "no checkout anywhere: the workflow reads the API only, never executes pull request head code, and pins every merge with match-head-commit"
  ],
  "tests": [
    {"command": "python3 yaml.safe_load on auto-merge.yml", "result": "the workflow YAML parses with the intended shape", "status": "passed", "evidence": "Loaded name, cron */10 * * * *, permissions and the five steps locally before the push."},
    {"command": "bash -n on every run block", "result": "all five step scripts pass bash syntax checking", "status": "passed", "evidence": "Extracted each run block through the YAML parser and ran bash -n per block; every exit code was 0."},
    {"command": "mirror read against t27 auto-merge-ready-prs.yml", "result": "head-arrival timing, label identity and fail-closed reads copied into the subset", "status": "passed", "evidence": "Fetched the t27 workflow via the API and compared each gate rule; the dormant mechanism is the LABELED_BY identity check."}
  ],
  "limitations": [
    "The merge half merges nothing until the reviewer bee reaches trinity; that is deliberate, per the owner's rule of 2026-10-02.",
    "The bee's APPROVED-review identity gate and the discounted-check master look-back stay in t27; they arrive here with the bee.",
    "No live run yet: validated by local YAML and bash parsing plus the mirror read, not by a scheduled execution on GitHub."
  ],
  "tags": ["t27f", "autopilot"],
  "blog": {
    "title": "The bee-gated merge autopilot arrives on trinity",
    "summary": "A ten-minute sweep now guards trinity pull requests: it recovers missing work-report statuses by dispatch, and holds every squash merge behind the reviewer bee's own label arriving after the head.",
    "outline": [
      "Trinity pull requests now have their own merge autopilot: a scheduled sweep every ten minutes that reads each open PR through the GitHub API and judges it against the same gate t27 built for its own lane.",
      "The live half is work-report recovery: a head whose T27 work report status is missing gets the existing PR work report and blog workflow dispatched automatically, so a failed run never leaves a pull request ungated.",
      "The merge half is dormant by design: it demands a bee-reviewed label applied by the reviewer bee's own bot login after the head push, and no reviewer bee runs on trinity yet, so nothing merges until it arrives.",
      "The gate mirrors t27's auto-merge-ready-prs.yml: label after head arrival, required checks green, a mergeable state, match-head-commit pinning, and a hard refusal to merge anything the bee has not reviewed."
    ]
  }
}

…ort dispatch half live, merge half dormant until the reviewer bee reaches trinity (refs Trinity-S-AI-DNA/t27#12145)
@github-actions

Copy link
Copy Markdown
Contributor

X Brain Health Check

Score: 100.0/100
Status: 🟢 HEALTHY
Threshold: 80/100

X Brain is above merge threshold

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Brain Stress Test Results

Tests: 261/261 passed, 0 leaked
Status: 🟢 PASS
Gate: every test in zig build test-brain-stress passes and none leaks

@gHashTag
gHashTag merged commit f1ad386 into main Oct 25, 2026
33 of 34 checks passed
@github-actions github-actions Bot added status:completed Done and removed status:in-progress 🔵 Agent working labels Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

owner-approved-foreign Owner approved hand-written non-t27 code in this PR status:completed Done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant