Skip to content

feat(guardrails): dual AI review gate — require LGTM from both Codex and GLM 5.1 before merge #143

@terisuke

Description

@terisuke

Feature Request

Background

Currently gh pr merge is blocked by guardrails and merges must be done manually via GitHub UI. The current guardrail merge gate checks for a single code-reviewer agent pass (review_state === "done").

Proposal

Require LGTM from two independent AI pipelines before a PR can be merged — analogous to requiring two human approvals, but using models with different training and architectures to eliminate shared blind spots.

Suggested reviewers:

  • codex — OpenAI Codex CLI (/codex review skill)
  • glm-5.1 via zai-coding-plan provider — GLM 5.1 as the second opinion

Both must return LGTM before gh pr merge is unblocked.

Motivation

This mirrors the pattern already used in Claude Code (dual AI review loop). The rationale:

  1. Model-specific blind spots — Codex and GLM 5.1 have different training data and architectures; each catches issues the other may miss.
  2. No self-review bias — A single model reviewing its own output has confirmation bias.
  3. Consistent with existing design — The guardrail already enforces denyFree, denyPreview, and CI gates as layered quality gates. Dual-review extends this principle.
  4. Asymmetric failure mode — A false LGTM from one model is much less likely to be replicated by a structurally different model.

Implementation Sketch

In guardrail.ts, extend the merge gate state tracking:

// New state fields
review_codex_state: "done" | ""
review_glm_state: "done" | ""

In tool.execute.before bash check for gh pr merge:

if (str(data.review_codex_state) !== "done" || str(data.review_glm_state) !== "done") {
  throw new Error(text("merge blocked: dual review required — run /codex review AND glm-5.1 code-reviewer before merging"))
}

In tool.execute.after for task completions, detect which agent/model completed:

if (agent === "codex" || cmd.includes("codex review")) mark({ review_codex_state: "done" })
if (model.includes("glm-5.1")) mark({ review_glm_state: "done" })

Acceptance Criteria

  • gh pr merge is blocked until both review_codex_state and review_glm_state are "done"
  • Either review becoming stale (new push after review) resets the corresponding state
  • The block message clearly names which review(s) are still pending

Related

  • Current single-reviewer gate: guardrail.ts L672–683
  • Codex review skill: /Users/teradakousuke/.claude/skills/codex/SKILL.md
  • Review loop skill: /Users/teradakousuke/.claude/skills/review-loop/SKILL.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions