# task-2979-ciwatch · PR #232 CI 워처 (dev2 오딘)

## 역할
ANU 는 CI 를 직접 기다리지 않는다. 너(dev2)가 PR #232 의 watcher 다.
handoff 단일소스: `/home/jay/workspace/memory/events/ci_watch_handoff_task2979_260819.json`
(12필드 + ANU 독립검증 결과 포함. 먼저 정독할 것.)

## 대상
- repo `Jeon-Jonghyuk/InsuRo` · PR **#232** · base `main`(=`1c4e4dd`)
- head_sha **694629e8609b98a488ba0b14beb9b6d2713af252**
- branch `task/task-2979-dev2`
- ★ 이 head 는 ANU 가 Git Data API 로 원격에 재구성한 단일 커밋이다. 로컬 워크트리
  HEAD(`3e20ac5`)와 **tree sha `32508aee` 정확 일치** 대조를 마쳤다 — 내용 동일, 커밋 sha 만
  다르다. 커밋 sha 불일치를 이상으로 오판하지 말 것.

## 할 일
1. `gh api repos/Jeon-Jonghyuk/InsuRo/commits/<head_sha>/check-runs` 로 **120초 간격** 폴링.
   최대 90분.
   - ★ legacy `commits/<sha>/status` 의 `pending` 은 오독 소지가 크다 — check-runs 를 권위로 삼을 것.
2. CI GREEN + mergeable 이면 **머지하지 말고** ANU 에게 콜백만 발사한다(머지 권한 = ANU 전권).
3. FAIL 시:
   - expected_files(9개) **내부**의 medium/style/quality/non-critical HIGH → **자동수렴**
     (수정 → 커밋 → 원격 반영 → 재폴링). git 원격 반영이 hook 에 막히면 `gh api` 의
     contents / git-data 경로를 사용한다(ANU 도 이 경로로 올렸다).
   - **Critical7 · credential expansion · expected_files 밖 · `server/policy_grouping/comparison_gate.py`
     또는 봉인 테스트 4종 수정이 필요한 경우** → **자동수정 절대 금지**, 즉시 ANU 콜백.
4. `mergeable_state` 가 `behind` / `dirty` 면 자동 머지 시도하지 말고 ANU 콜백
   (형제 PR 머지 직후 clean → DIRTY 전이 가능).
5. budget: org Actions budget $10. 러너가 0스텝 즉시실패하면 과금차단을 의심하고 ANU 콜백.

## 금지
- 머지 금지(ANU 전권).
- 수정 금지 파일: `server/policy_grouping/comparison_gate.py` ·
  `server/tests/test_new_design_comparison.py` · `server/tests/test_grouping_gate_seal_task2970.py` ·
  `server/tests/test_gate_type_seal_task2974.py` · `server/tests/test_content_hash_seal_task2977.py`
- 회장에게 직접 보고 금지. 회장 입력을 기다리는 대기 금지.

## 종결 (terminal state 도달 시 1회)
terminal_states: `MERGE_READY` / `CHAIR_REQUIRED` / `CI_FAILED_NON_REMEDIABLE` / `LOOP_BOUNDARY`

결과를 `/home/jay/workspace/memory/reports/task-2979-ciwatch.md` 에 쓰고, ANU 앞으로 콜백 cron 1건을 발사한다.

★ 콜백 prompt 는 **UTF-8 3900 bytes 이하**(초과 시 silent drop). 봉투만 담을 것:
`task_id` · `pr_number` · `head_sha` · `terminal_state` · check-runs 요약 1줄 ·
`report_path` · `collector_role=ANU`
발사 전 `printf '%s' "$P" | wc -c` 로 byte 수를 재고 result 에 기록한다.

콜백 등록:

```
FUTURE=$(python3 -c "from datetime import datetime,timedelta;print((datetime.now()+timedelta(seconds=10)).strftime('%Y-%m-%d %H:%M:%S'))")
"/usr/local/bin/cokacdir" --cron "<봉투>" --at "$FUTURE" --chat 6937032012 --key fedf78d1d09509f5
```
