# task-2777 — read-only anu_control_status.py (자동화 조종석, ACTIVE=false)

상태명: `TASK2777_ANU_CONTROL_STATUS_READONLY_IMPLEMENTATION_APPROVED_ACTIVE_FALSE`
담당: dev2-team (p0b/driver 상태 맥락 연속성)
회장 승인: 2026-06-28 — **read-only control panel/status command 구현 1건.**

## 레벨
코드+테스트 (Lv.2). merge_policy=manual.

## 목적
회장이 ANU 자동화 상태를 **한눈에 read-only로 확인**하고 다음에 무엇을 승인해도 되는지 판단할 수 있는 조종석.
**자동화 실행이 아니다.** 순수 관측 도구.
설계 단일소스: `memory/reports/control_panel_status_command_spec_260628.md` +
`memory/reports/capability_matrix_update_plan_260628.md` (먼저 읽고 그대로 따른다).

## expected_files (엄수 — 외 변경 0)
- `scripts/anu_control_status.py`
- `tests/regression/test_anu_control_status_2777.py`
- `memory/reports/task-2777.md` (보고서)

## 필수 기능
- 출력 2형식: **human-readable summary** + **`--json`**.
- 표시 항목(전부): current automation level · ACTIVE true/false · flags(p0b_driver_enabled · p0b_event_strategy_enabled ·
  p0b_callback_launch_enabled · p0b_activation_epoch + epoch age · p0b_kill) · last verdict · last evidence line ·
  REAL_FIRED total · LIVE_PROCESSED total · LIVE_PENDING_OWNER_PROOF total · live_inbox count · p0b_inbox count ·
  archive count · pending fixture quarantine count · systemd status · cron count(또는 safe UNKNOWN) ·
  git branch/HEAD/origin/main · tracked dirty count · pending approvals · next allowed action · forbidden next action · warnings.
- 데이터 소스 매핑은 spec §2 그대로(cat/test/ls/grep/git rev-parse). 부재 → absent/0/unknown(추정 금지·crash 0).

## ★ WIRED ≠ ACTIVE 보정 (필수)
- normal callback real launcher 등 gated 축은 **`WIRED(gated, ACTIVE=false)`** 또는 `WIRED_GATED / ACTIVE=false`로 표현.
- wired와 active를 **절대 혼동 금지**. 어떤 축도 active처럼 보이게 쓰지 말 것.

## ★ read-only 절대 원칙 (코드 차원 불변)
flag 생성/수정 0 · state 파일 수정 0 · evidence 파일 append 0 · driver 실행 0 · fixture 생성 0 · callback 발사 0 ·
real fire 0 · systemd 조작 0 · cron 등록 0 · archive 이동 0 · key 출력 0 · key rotation 0 ·
git checkout/switch/reset/clean 0. (함수 전체 open(...,'w')·os.remove/rename·subprocess write 0.)

## ★ cron count — raw key 금지
- cron count에 **raw key literal 절대 금지**. 허용 순서:
  1. sealed loader 기반 read-only helper가 이미 있으면 사용
  2. 없으면 `cron_count = "UNKNOWN_KEY_REQUIRED"` 또는 `"UNKNOWN_NO_KEY"`로 표시
- raw key를 code/test/log/output 어디에도 남기지 않음. status command 위해 **새 key path 만들지 않음**.

## level 판정 기준
- 전 flag OFF + LIVE_PENDING_OWNER_PROOF ≥1 + LIVE_PROCESSED 0 + ACTIVE=false → **`L2_DONE_L3_BLOCK_EVIDENCE_ACTIVE_FALSE`**.
- LIVE_PROCESSED 0이면 **L3 PASS로 올리지 않음**. callback flag absent면 L4 readiness 안 올림.
- systemd inactive/disabled면 L5/L6/L7 안 올림. production activation은 별도 승인 전 **항상 false**.
- 모호하면 **`INDETERMINATE_REVIEW_REQUIRED`**.

## JSON 필수 필드
`automation_level · active · flags · counts · last_verdict · last_evidence · git · systemd · cron · inbox ·
archive · pending_approvals · next_allowed_action · forbidden_actions · warnings`.

## 필수 테스트 (tests/regression/test_anu_control_status_2777.py)
- **read-only 보장**: tmp root 실행 전후 state/evidence 파일 **hash 또는 mtime 불변** · 파일 생성 0 · append 0.
- **absent graceful**: state/audit/jsonl/ledger 부재 시 crash 0.
- **level 판정 정확**: LIVE_PENDING 1·LIVE_PROCESSED 0·ACTIVE=false → `L2_DONE_L3_BLOCK_EVIDENCE_ACTIVE_FALSE`.
- **JSON schema 안정성**: 필수 key 존재 · 값 타입 안정.
- **raw key 미출력**: stdout/stderr/json/report에 key-like literal 0.
- **no driver execution**: driver_runs 신규 append 0.
- **no flag write**: p0b_driver_enabled/event_strategy/callback/epoch/kill 생성·수정 0.
- **dirty count 수집**: git read-only 명령만.
- **human summary smoke** · **--json smoke** · **cron key unavailable 시 UNKNOWN 처리**.

## 필수 회귀 (전부 PASS)
신규 2777 · 기존 `test_live_inbox_evidence_wiring_2776.py` · 가능하면 2775/2760/2721 인접 회귀 · `py_compile` PASS.

## PR 게이트 (merge candidate 판정 — merge는 ANU/회장)
expected_files 외 0 · 2777 PASS · 2776 PASS · read-only invariant PASS · raw key/secret 0 · CI green ·
fresh Gemini HIGH 0/Critical 0/blocking Medium 0 · ACTIVE=false 유지 · real fire 0 · flags OFF · systemd inactive·disabled ·
cron 신규 등록 0 · archive 28 보존 · pending fixture quarantine 보존.

## 금지
flag ON / event_strategy ON / callback_launch_enabled 생성 / driver 실행 / fixture 생성 / real fire / LIVE_PROCESSED 실행 /
Phase 2 real fire / systemd start·enable / recurring 등록 / archive 28 이동 / pending fixture quarantine 이동 /
key rotation 자동 / production activation / **merge**.

## bounded fix doctrine
HIGH/Critical 0 · medium 2(초과 OWNER_DECISION) · style-only MEDIUM non-blocking 분리(미세패치 loop 금지).

## 완료 처리 + ANU callback (필수)
- 완료 시 `memory/events/task-2777.done` + `memory/reports/task-2777.md`.
- 봇 idle 전 **ANU callback 필수**. collector=ANU, owner_key=sealed loader 봉인, self-key 금지. callback prompt
  UTF-8 **≤3900 bytes**, envelope 만(task_id·PR#·head sha·result_path·report_path·one-line). **merge 금지.**
- PASS 나와도 머지 금지 — ANU 독립검증 → fresh Gemini → CI → MERGE_CANDIDATE 보고로만.

## 진행
dev2는 read-only collector+formatter(human+--json) 구현 + read-only invariant 테스트(write 0 입증) + 회귀 후
branch push → **PR 생성**(merge 금지) → 보고서 + .done + ANU callback. ANU가 이후 독립검증/Gemini/CI/merge candidate.

## allowed_resources
```yaml
allowed_resources:
  paths:
    - "scripts/anu_control_status.py"
    - "tests/regression/test_anu_control_status_2777.py"
    - "memory/reports/task-2777.md"
    - "memory/events/task-2777.done"
  forbidden_paths:
    - ".github/**"
    - "scripts/finish-task.sh"
    - "dispatch/anu_pickup_driver.py"
    - "memory/state/**"
    - "memory/events/p0b_inbox/**"
    - "memory/events/p0b_live_inbox/**"
    - "memory/p0b_state/**"
    - "memory/reports/p0b_inbox_backlog_archive_260627/**"
    - "memory/reports/limited_pilot_phase1_retry_phase1retry260627/**"
    - "memory/reports/phase1_retry_observed_phase1obs260628/**"
  commands: ["pytest", "python3 -m py_compile", "git", "gh"]
  merge_policy: "manual"
  ttl_hours: 24
```
