Skip to content

ci: manual-merge-guard to prevent auto ship on main - #80

Merged
zts212653 merged 1 commit into
mainfrom
codex/manual-merge-guard
Feb 12, 2026
Merged

zts212653 merged 1 commit into
mainfrom
codex/manual-merge-guard

Conversation

@zts212653

Copy link
Copy Markdown
Collaborator

Summary

  • add manual-merge-guard workflow to enforce manual approval policy on merged PRs to main
  • classify non-compliant merges with scripts/ci/manual_merge_guard.py
  • add unit tests for decision logic (tests/unit/test_manual_merge_guard.py)
  • update governance docs + PR template to require human approval and no self-merge auto-ship

Why

On current plan, private repo branch protection/rulesets are unavailable (403), so we need a free-tier guardrail to stop "PR opened then auto-shipped" behavior.

Policy enforced by fallback

  • merged PR on main must have independent APPROVED review
  • self-merge (author == merged_by) is non-compliant by default
  • non-compliance triggers incident issue and (mode dependent) rollback PR

Rollout

  • repository variable set: MANUAL_MERGE_GUARD_MODE=alert-only (safe rollout)
  • after 3-5 clean days, can switch to revert-pr

Verification

  • pytest -q tests/unit/test_manual_merge_guard.py => 5 passed
  • ruff check scripts/ci/manual_merge_guard.py tests/unit/test_manual_merge_guard.py => clean
  • python -m compileall -q scripts/ci/manual_merge_guard.py tests/unit/test_manual_merge_guard.py => success

Add a free-tier post-merge guard that detects non-compliant merges to main and automatically creates incident/rollback artifacts. This gives us a practical enforcement path when branch protection and rulesets are unavailable on private repositories.

Key changes:

- Add .github/workflows/manual-merge-guard.yml triggered on pull_request_target closed events for merged PRs to main.

- Add scripts/ci/manual_merge_guard.py to classify merge compliance (independent approval required; self-merge blocked by default; allowlist + fail-open on API outage).

- Add tests/unit/test_manual_merge_guard.py using Red->Green TDD for core decisions.

- Update CONTRIBUTING.md, docs/governance/branch-protection.md, docs/guides/Team_Agent_Collab_Playbook.md, and .github/pull_request_template.md to codify manual approval workflow.

Operational defaults:

- Set repository variable MANUAL_MERGE_GUARD_MODE=alert-only for safe rollout.

- Keep MANUAL_MERGE_GUARD_ALLOW_MERGERS unset by default (strict baseline).
@zts212653
zts212653 merged commit cc00377 into main Feb 12, 2026
6 checks passed
@zts212653
zts212653 deleted the codex/manual-merge-guard branch February 12, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant