Skip to content

Add LGTM comment as override alongside PR approval #42

@jdelfino

Description

@jdelfino

Summary

GitHub doesn't allow PR authors to approve their own PRs. In a solo-developer + agent workflow, the human is often the PR author, which breaks the "PR approval as universal override" mechanism. Add LGTM comments as an alternative override that works for solo devs, while keeping PR approval for multi-contributor repos.

Files to modify

  • .github/agent-workflow/scripts/lib/approval.js
  • .github/agent-workflow/scripts/lib/override.js (new)
  • .github/agent-workflow/scripts/guardrail-scope.js
  • .github/agent-workflow/scripts/guardrail-api-surface.js
  • .github/agent-workflow/scripts/guardrail-test-ratio.js
  • .github/agent-workflow/scripts/guardrail-dependencies.js
  • .github/workflows/guardrail-commits.yml
  • .github/agent-workflow/scripts/orchestrator-check.js
  • tests/lib/approval.test.js
  • tests/lib/override.test.js (new)
  • docs/design.md
  • README.md
  • CLAUDE.md

Implementation steps

  1. Add hasNonStaleLgtm pure function to approval.js — checks if any PR comment starting with "LGTM" (case-insensitive) was posted after the head commit's committer.date
  2. Create override.js async helper (hasHumanOverride) — fetches reviews, comments, and commit date in parallel, returns true if either PR approval or LGTM comment is valid and non-stale
  3. Update all 5 guardrail scripts + commit workflow to use hasHumanOverride instead of direct hasNonStaleApproval calls
  4. Update user-facing messages to mention both override mechanisms ("approve the PR or comment LGTM to override")
  5. Add tests for hasNonStaleLgtm and hasHumanOverride
  6. Update docs (design.md, README.md, CLAUDE.md) to reflect dual override mechanism

Acceptance criteria

  • LGTM comment on a PR overrides guardrail failures (same as approval does today)
  • LGTM comments are stale-checked against head commit date (new commits invalidate old comments)
  • PR approval continues to work as before
  • All guardrail scripts use the unified hasHumanOverride helper
  • User-facing messages mention both override options
  • Tests cover LGTM staleness, case-insensitivity, and the combined override logic
  • Documentation updated

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:highPriority 1taskImplementation work item

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions