Skip to content

feat(factory): medium and high risk PRs merge only after one human approval on the head (AGT-4881) - #912

Open
unohee wants to merge 1 commit into
heewonoh/agt-4879-steward-guardsfrom
heewonoh/agt-4881-human-approval
Open

unohee wants to merge 1 commit into
heewonoh/agt-4879-steward-guardsfrom
heewonoh/agt-4881-human-approval

Conversation

@unohee

@unohee unohee commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

스택 PR: #911(AGT-4879, guard engine) 위에 쌓았다. base 가 heewonoh/agt-4879-steward-guards 이므로 #911 머지 후 main 으로 retarget 해야 한다.

무엇

risk 가드를 확장한다: low 는 그대로 통과, medium/high 는 head SHA 에 사람 승인이 1건 이상 있을 때만 통과. 나머지 세 가드는 그대로 적용된다.

사람 승인 판정(humanApprovalOnHead):

  • 리뷰어별로 마지막 결정적 리뷰(APPROVED/CHANGES_REQUESTED/DISMISSED)를 본다. COMMENTED 는 상태를 바꾸지 않는다(GitHub 의미와 동일). 승인 뒤 change request·dismiss 가 오면 그 승인은 무효.
  • 그 리뷰가 APPROVED 이고 commitId == head SHA.
  • GitHub user type 이 User. 타입이 없으면 사람 아님.
  • PR author 가 아님.
  • steward/worker/publisher 계정 목록(automationAccounts, 대소문자 무시)에 없음. 여기 agent 들은 user type 이 User 인 계정으로도 움직이므로 타입만으로는 증명이 안 된다. 목록이 비어 있으면 어떤 승인도 믿지 않는다(fail-closed).
  • snapshot 에 author, prReviews, automationAccounts 필드 추가.

왜

AGT-4803: low 가 아닌 변경은 자동 머지하면 안 되지만, 사람이 승인하면 steward 가 머지를 이어받아야 한다. 하위 이슈 스펙대로 "1건 이상"(상위 이슈의 "exactly one" 아님).

검증

  • npx vitest run src/automation/mergeStewardGuards.test.ts — 33 tests 통과 (신규 10).
    • 완료 기준 4경우: 승인 없음 / 봇 승인 / 이전 SHA 승인 / 유효한 사람 승인 — 마지막만 통과. 앞의 셋은 "risk 가드를 빼면 통과" 까지 확인(load-bearing).
    • high 동일 규칙, factory 계정·author 승인 무효, user type 누락, change request/dismiss 로 철회·comment 는 유지, 빈 계정 목록, 승인된 medium 에도 required-checks·review 가드 유지.
    • 변이 검사: SHA 비교와 user type 검사를 지우면 3건 실패.
  • npm run typecheck, oxlint 0 errors.

남은 것

  • GitHub 에서 reviews·user type 을 모으는 collector 와 steward 계정 목록 설정 위치(config)는 후속.

…proval on the head (AGT-4881)

The risk guard now lets a medium or high change through when at least
one reviewer's latest decisive review is APPROVED on the head SHA, is a
GitHub User, is not the PR author and is not a factory account. An
empty factory account list trusts no approval. The other guards still
apply.
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