# task-2562 — G4 Pre-PR Gemini CLI Gate plan

회장 §명시 2026-05-12 Track C / dev1 헤르메스 / Lv.3 control-plane.

## 목표

PR open 전에 Gemini CLI(OAuth-personal) 단발 호출로 code-changing issue를 사전 감지하는 **Pre-PR Gemini CLI gate**를 `scripts/finish-task.sh` line 830 부근에 통합한다. 공식 merge gate(GitHub Gemini App)는 그대로 유지하며, 본 gate는 사전 차단 단계로만 작동한다.

## 결정 박제 (OD_2~OD_6 DECIDED)

| 항목 | 결정 |
|---|---|
| task ID | task-2562 (task-2559는 dashboard 신호등 task로 사용 중) |
| fix_loop_count max | 2 |
| integration point | scripts/finish-task.sh line 830 부근 (G3 PASS 직후, .done 이전, Lv.4 보안 감사 이전) |
| gate 정책 | Lv 기반 mixed (Lv.1~2 soft / Lv.2 risk-trigger hard / Lv.3+ hard) |
| 팀 | dev1 헤르메스 |
| 본질 | Pre-PR Gemini CLI 단발 gate, 공식 merge gate 아님 |

## 구현 단계

1. `scripts/gemini_cli_gate_check.py` 신규 — codex_gate_check 헬퍼 재사용, OAuth-personal 강제, scope_violation 분기, Lv 기반 mixed gate 분기, fix_loop counter atomic write.
2. `prompts/gate_instructions.py` — `should_run_gemini_cli_gate`, `get_gemini_cli_gate_command` 추가.
3. `scripts/finish-task.sh` line 830 부근 [G4-GATE] block 신규 (G3 PASS 직후, Lv.4 audit 이전).
4. `tests/regression/test_gemini_cli_gate_check_2562.py` 8 시나리오.
5. `anu_v2/tests/test_g4_integration_2562.py` 5 통합 시나리오.
6. 3문서 + report + dispatch-decision.json.

## 게이트 자가 적용 회피

본 task는 G4 자체 구현이므로 **G4 self-apply 0** (회장 §명시 일관). G1 Codex + G2 마아트+로키 + G3 verifier만 적용.

## 회귀 어셀션

- `pytest tests/regression/test_gemini_cli_gate_check_2562.py` PASS
- `pytest anu_v2/tests/test_g4_integration_2562.py` PASS
- 기존 codex_gate_check / G3 verifier 회귀 0

## 완료 조건

dispatch-decision.json `completion_conditions_10` 1:1.
