request_merge_when_green
Open a PR (same surface as request_review) AND mark it for auto-merge once branch protection / CI gates pass. Profile-restricted: only permitted on registry profile=permissive, or profile=standard with explicit fleet allow. Never permitted on profile=strict — those repos require human merge.
Upholds: MR-3 · MR-12
Side effects: Creates a branch, applies file edits, opens a PR, sets the auto-merge label per the repo’s branch-protection config.
Constraints
Section titled “Constraints”REPO_IN_REGISTRY— target_repo must appear in registry.yaml.PROFILE_PERMITS_AUTOMERGE— registry.yaml entry’s profile must be ‘permissive’, or ‘standard’ with the invoking fleet listed in fleets_allowed AND the fleet entry having auto_merge: true (extension to registry schema in TASKSET 8). Profile ‘strict’ rejects this verb unconditionally.FILES_NONEMPTY— files array must contain ≥1 entry.NO_PRIVILEGED_PATHS— Same as request_review: no edits to .github/workflows/, *.env, secrets/, deploy/credentials/.GROUNDING_NONEMPTY— Same as request_review (MR-12).DEFAULT_BRANCH_PROTECTED— target_repo’s default_branch must have at least one required status check configured. Auto-merging into an unprotected branch is forbidden — defeats the purpose.
Input shape
Section titled “Input shape”titlestring(required)rationalestring(required)filesarray(required)branchstringmerge_methodstring(required) enum:squash,merge,rebaselabelsarraygrounding→request_review.schema.json#/input/properties/params/properties/grounding(required)
Output shape
Section titled “Output shape”pr→PRRefauto_merge_enabledbooleandiff_preview→DiffPreview
Example
Section titled “Example”Input:
{ "envelope": { "verb": "request_merge_when_green", "target_repo": "smo1-io", "idempotency_key": "1a6ff917e42dd6680b14c3d7e8f9012b3c4d5e6f7a8b9c0d1e2f304152637485", "dry_run": true, "actor": "fleet:smo1-implementer", "triggered_by": { "kind": "audit_fail", "ref": "ci-run-12345" } }, "params": { "title": "fix(zoomies-edge): handle empty UTM gracefully", "rationale": "Audit run flagged null-deref on missing UTM; one-line guard. Permissive-profile repo; trivial fix; auto-merge appropriate.", "files": [ { "path": "zoomies-edge/src/utm.ts", "operation": "modify", "contents": "..." } ], "merge_method": "squash", "grounding": [ { "kind": "finding", "ref": "docs/findings/20260429-1230-utm-nullderef.md" } ] }}Output (output_dry_run):
{ "envelope": { "verb": "request_merge_when_green", "status": "dry_run", "idempotency_key": "1a6ff917e42dd6680b14c3d7e8f9012b3c4d5e6f7a8b9c0d1e2f304152637485", "mr_citations": [ "MR-3", "MR-12" ] }, "result": { "auto_merge_enabled": true, "diff_preview": { "files": [ { "path": "zoomies-edge/src/utm.ts", "operation": "modify" } ], "branch": "petrova/automerge/1a6ff917", "commit_message": "fix(zoomies-edge): handle empty UTM gracefully" } }}Recipe
Section titled “Recipe”Schema: spec/verbs/request_merge_when_green.schema.json
Upholds: MR-3, MR-12.
Emits: PR (same as request_review) PLUS auto-merge enabled.
When to use
Section titled “When to use”Trivial fix on a permissive-profile repo where the human doesn’t need
to approve each PR — branch protection + CI gates are sufficient. Or
on a standard-profile repo when the invoking fleet has explicit
fleets_allowed permission.
Never works on strict-profile repos. The verb refuses unconditionally.
Required params
Section titled “Required params”Same as request_review, plus:
{ "merge_method": "squash | merge | rebase"}Constraints (additional to request_review’s)
Section titled “Constraints (additional to request_review’s)”- Target repo’s
registry.yamlprofile must bepermissive, ORstandardwith the invoking fleet listed infleets_allowed. - Default branch must have at least one required status check configured (auto-merge into an unprotected branch is forbidden — defeats the purpose).
Dry-run
Section titled “Dry-run”cat > /tmp/petrova-input.json <<'JSON'{ "title": "fix(zoomies-edge): handle empty UTM gracefully", "rationale": "Audit run flagged null-deref on missing UTM; one-line guard.", "files": [{"path": "zoomies-edge/src/utm.ts", "operation": "modify", "contents": "..."}], "merge_method": "squash", "grounding": [{"kind": "finding", "ref": "docs/findings/20260429-1230-utm-nullderef.md"}]}JSONpetrova request_merge_when_green smo1-io --input /tmp/petrova-input.jsonWhat “auto-merge enabled” actually means
Section titled “What “auto-merge enabled” actually means”The verb sets the GitHub auto-merge label on the PR. Branch protection
- CI must still pass. The PR will merge once green, not immediately
on open. If you want immediate merge, you’re in
strict-profile territory and should be usingrequest_reviewwith a human approver.