Skip to content

ci(gam): install governed auto-merge (IGV-D-028) - #139

Merged
yakimoto merged 3 commits into
mainfrom
gam/install-public-auto-merge
Sep 8, 2026
Merged

ci(gam): install governed auto-merge (IGV-D-028)#139
yakimoto merged 3 commits into
mainfrom
gam/install-public-auto-merge

Conversation

@wave-av-agent

@wave-av-agent wave-av-agent Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Install Governed Autonomous Merge (GAM) — public-repo edition

IGV-D-028 (claude-workstation#4825): the operator is no longer the merge gate on public repos.
This PR installs .github/workflows/auto-merge.yml from governance/templates/public-auto-merge.yml
(template sha256 c5a25074d341525a) into wave-av/sdk, opened by the wave-av-agent App.

What it does once armed

The workflow performs the merge, acting as the App, iff every objective gate passes:

  • label autonomy:auto-merge present, applied by someone with write/maintain/admin (checked server-side);
  • PR author is the wave-av-agent App (or a login in the repo variable GAM_AUTHOR_ALLOWLIST);
  • not a draft, base is the default branch, no T3 path (migrations, private keys, CODEOWNERS, this workflow);
  • the base branch lists at least one REQUIRED status check (verified in code — GAM refuses to be the only gate);
  • mergeStateStatus == CLEAN, 0 unresolved review threads;
  • at least GAM_MIN_REVIEWERS (default 2) distinct LLM reviewers finished non-failing on the head SHA.

On a merge-queue-governed base it ENQUEUES via GraphQL pinned to the head SHA; otherwise it merges
with --merge --match-head-commit. Never --squash, never --admin, never a checkout of PR-head code.
Every failed gate leaves a comment saying why; nothing is silent.

Inert until enabled (fail-closed)

  1. Secrets WAVE_AGENT_APP_ID + WAVE_AGENT_PRIVATE_KEY visible to this repo (org-level, public visibility).
  2. Repo variable AUTONOMY_ENABLED=1 — the kill-switch, read first at the job level. 0 disarms instantly.
    Until both hold the workflow bills zero minutes and merges nothing.

Why this PR is merged by a person

A workflow cannot merge the PR that creates it. This install PR is one of the last operator merges
on this repo; every later PR authored by the App and labelled autonomy:auto-merge lands through the
workflow. Design, measurements and receipts: governance/docs/IGV-D-028-public-merge-path.md
in claude-workstation.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by Sourcery

Install the fail-closed Governed Autonomous Merge workflow for public-repository pull requests.

New Features:

  • Add a governed autonomous merge workflow for eligible public-repository pull requests, using the wave-av-agent App to enqueue or merge changes after all configured gates pass.

Enhancements:

  • Enforce fail-closed validation for authorization, authorship, review completion, required base checks, merge readiness, protected paths, and head-SHA consistency, with explanatory comments for deferred or refused merges.
  • Provide workflow triggers, concurrency control, configurable reviewer and author policies, and an immediate repository-level autonomy kill switch.

CI:

  • Add the GitHub Actions workflow that evaluates pull requests on labeling, synchronization, review-check completion, or manual dispatch.

Review in cubic

Template sha256 c5a25074d341525ac4b3c1980eb571d8e1074e50e807f6844bad0b14508a6c2f. Inert until WAVE_AGENT_* secrets are visible and AUTONOMY_ENABLED=1.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@wave-av-agent wave-av-agent Bot added the autonomy:auto-merge RF.P1 reviewer routing (#1039) label Sep 8, 2026
@codeant-ai

codeant-ai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Skipping PR review because a bot author is detected.

If you want to trigger CodeAnt AI, comment @codeant-ai review to trigger a manual review.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @wave-av-agent[bot], this account has used its review budget of 2,500,000 diff characters for the last 7 days.

You can request another review in 2 days and 17 hours by commenting @sourcery-ai review.

@sourcery-ai

sourcery-ai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds the public-repository GAM workflow, implementing App-controlled, fail-closed gate evaluation and head-SHA-pinned merge or merge-queue enqueue behavior with explicit audit comments and kill-switch controls.

Sequence diagram for governed autonomous pull request merge

sequenceDiagram
    participant Event as GitHub event
    participant GAM as GAM workflow
    participant App as wave-av-agent App
    participant GitHub as GitHub API
    participant Queue as Merge queue

    Event->>GAM: Trigger on label, synchronize, reopen, check_suite, or dispatch
    GAM->>GAM: Read AUTONOMY_ENABLED first
    alt Kill-switch disabled
        GAM-->>Event: No-op
    else Enabled
        GAM->>GitHub: Resolve open PR and read PR facts
        GAM->>App: Mint installation token
        App-->>GAM: App token
        GAM->>GitHub: Verify gates and required checks
        alt Gate fails
            GAM->>GitHub: Comment reason and optionally remove label
        else All gates pass
            alt Base has merge queue
                GAM->>GitHub: enqueuePullRequest(expectedHeadOid)
                GitHub->>Queue: Enqueue pinned head SHA
                GAM->>GitHub: Comment enqueued result
            else Direct merge
                GAM->>GitHub: gh pr merge --merge --match-head-commit
                GAM->>GitHub: Comment merged result
            end
        end
    end
Loading

Flow diagram for fail-closed GAM gate evaluation

flowchart TD
    A[Workflow triggered] --> B{AUTONOMY_ENABLED == 1?}
    B -- No --> C[No-op]
    B -- Yes --> D[Resolve open PR]
    D --> E[Mint wave-av-agent App token]
    E --> F{App token available and identity verified?}
    F -- No --> G[Comment deferred; merge nothing]
    F -- Yes --> H[Read PR facts and branch rules]
    H --> I{All objective gates pass?}
    I -- No --> J[Comment reason; defer or remove label]
    I -- Yes --> K{Merge queue enabled?}
    K -- Yes --> L[enqueuePullRequest pinned to HEAD SHA]
    K -- No --> M[Merge with --merge and --match-head-commit]
    L --> N[Comment audit result]
    M --> N
Loading

File-Level Changes

Change Details Files
Install a fail-closed governed autonomous merge workflow for public repositories.
  • Adds event triggers for labeled, synchronized, reopened, completed check-suite, and manually dispatched PR evaluations.
  • Requires the autonomy kill-switch, App credentials, and at least one required base-branch status check before processing.
  • Mints a narrowly scoped wave-av-agent App token and verifies the token identity before gate evaluation.
  • Evaluates label authorization, App/allowlisted authorship, PR state and base branch, protected T3 paths, merge cleanliness, review-thread resolution, and distinct non-failing LLM reviewer coverage.
  • Comments on deferrals/refusals and removes the autonomy label for rejected PRs.
  • Enqueues merge-queue PRs at the exact head SHA or directly merges with --merge and --match-head-commit, without admin or squash bypasses.
.github/workflows/auto-merge.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@greptile-apps

greptile-apps Bot commented Sep 8, 2026

Copy link
Copy Markdown

Greptile Summary

Installs a fail-closed GitHub Actions workflow that evaluates App-authored pull requests for governed autonomous merging.

  • Attributes the auto-merge label to an authorized repository collaborator on every run.
  • Rejects drafts, non-default bases, sensitive paths, unresolved review threads, and insufficiently protected branches.
  • Counts distinct external reviewer publishers before merging or entering the merge queue.
  • Pins both direct merges and merge-queue submissions to the evaluated head SHA.

Confidence Score: 4/5

The PR is not yet safe to merge because the unresolved reviewer-identity gate can still count publishers that are not established independent LLM reviewers.

The latest change improves distinctness by counting publisher identities rather than context-name variants, but the previous reviewer-identity finding remains partially unfixed: any non-Actions check or status publisher is still accepted when either its publisher or context name matches the broad reviewer regex, without binding that publisher to an expected reviewer App.

Files Needing Attention: .github/workflows/auto-merge.yml

Important Files Changed

Filename Overview
.github/workflows/auto-merge.yml Adds the governed auto-merge workflow and improves label attribution and reviewer counting, but the existing reviewer-identity finding remains only partially addressed.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Workflow event] --> B{Autonomy enabled?}
  B -- No --> Z[No operation]
  B -- Yes --> C[Resolve candidate PR]
  C --> D[Mint wave-av-agent token]
  D --> E[Read PR and label timeline]
  E --> F{Labeler, author, base, and paths valid?}
  F -- No --> R[Defer or refuse with comment]
  F -- Yes --> G{Required checks and merge state valid?}
  G -- No --> R
  G -- Yes --> H{Threads resolved and reviewer floor met?}
  H -- No --> R
  H -- Yes --> I{Merge queue enabled?}
  I -- Yes --> J[Enqueue at expected head SHA]
  I -- No --> K[Merge with matching head commit]
Loading

Reviews (3): Last reviewed commit: "ci(gam): install public governed auto-me..." | Re-trigger Greptile

Comment thread .github/workflows/auto-merge.yml Outdated
Comment thread .github/workflows/auto-merge.yml Outdated
Comment thread .github/workflows/auto-merge.yml Outdated
@macroscopeapp

macroscopeapp Bot commented Sep 8, 2026

Copy link
Copy Markdown

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR adds a substantial GitHub Actions merge authority that can mint write-capable App tokens and autonomously land pull requests once enabled. The workflow is outside the author’s ownership domain, and an unresolved security concern remains about unbound reviewer identities, so its authorization and merge gates require human review.

Not approved because:

  • Credit balance exhausted. Approvability relies on correctness review in order to determine eligibility

Review your spending limits in Billing settings. You can add or adjust custom eligibility rules. Learn more.

Template sha256 c921bfa8caee7483f5fb4ccaef3b4a5ba20b6b1ff79bfef35cfe4f281290aa97. Inert until WAVE_AGENT_* secrets are visible and AUTONOMY_ENABLED=1.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Comment thread .github/workflows/auto-merge.yml Outdated
Comment thread .github/workflows/auto-merge.yml Outdated
Template sha256 21ce6e77f5dee00807b4c2f8ed35278b3c7b9da9bbc0418e15ba92e5dea81062. Inert until WAVE_AGENT_* secrets are visible and AUTONOMY_ENABLED=1.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@wave-av-agent

wave-av-agent Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Three heads, three Greptile rounds; every finding and what changed (IGV-D-028 template, claude-workstation):

  • Label authorization bypassed / later events bypass authorization / label audit fails open — the labeler is resolved from the PR timeline (last labeled event for autonomy:auto-merge) on every run; an unreadable timeline or a label with no event defers (no fallback to the triggering sender); the actor's permission is checked server-side (write/maintain/admin).
  • Reviewer checks / identities can be forged — only external-App publishers count (app.slug != github-actions, statuses not by github-actions[bot]), distinctness is by publisher not context name, and any change under .github/workflows/ or .github/actions/ is T3 (refused, label stripped).
  • Check suites resolve unreliablycheck_suite.pull_requests[0].number first; SHA search only as fallback.
  • App author is rejected — measured on api-spec#97: GraphQL author.login is wave-av-agent (__typename: Bot); both spellings are accepted anyway.
  • Failure comment is skipped — the fail-closed comment step runs under always().

For the merger: this PR is inert until the org secrets WAVE_AGENT_APP_ID / WAVE_AGENT_PRIVATE_KEY are visible here and AUTONOMY_ENABLED=1 is set. The cancelled duplicate of the required check Secrets + content policy on each head comes from public-repo-guard.yml running one job name from several triggers with cancel-in-progress: true; the latest run is the one that counts, and that workflow is a separate fix.

@yakimoto
yakimoto added this pull request to the merge queue Sep 8, 2026
Merged via the queue into main with commit 3aec164 Sep 8, 2026
29 of 31 checks passed
@yakimoto
yakimoto deleted the gam/install-public-auto-merge branch September 8, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autonomy:auto-merge RF.P1 reviewer routing (#1039)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant