# task-2775+5 보고서 — production limited 전용 신호 `limited_runtime` 신설 + epoch fail-closed 결선 (옵션1, ACTIVE=false)

- 작업 ID: task-2775+5
- 팀: dev2-team (오딘 팀장 / 토르 백엔드 / 헤임달 테스터)
- 상태명: `TASK2775_PLUS5_LIMITED_RUNTIME_SIGNAL_MICROFIX_APPROVED_FOR_DEV2_ACTIVE_FALSE`
- 일시: 2026-06-27
- 결론: **MERGE_CANDIDATE (머지 0 / activation 0 / real fire 0 / canary 0, PR #255 open 유지)**

## S (Situation)
PR #255 (branch `task/task-2775-dev2`)는 limited activation 3경계(kill/N/T) bound gate를 선행 결선한 상태(ACTIVE=false). +1~+4 micro-fix는 연속 STOP — 근본 원인은 "canary가 아닌 production limited 무인 가동"을 표현하는 **단일 신호 부재**였다. +3은 test-2760 `drv.main()` 직접호출 충돌, +4는 canary preflight `CANARY_PATHS_REQUIRED` 충돌.

## C (Complication)
- `activation_intended`는 canary 전용(paths-scope 안전모델). 이를 재사용하면 canary preflight를 타서 정상 pickup이 막힌다.
- `p0b_driver_enabled`(is_activated)는 legacy scan_once와 공유 → 단독으로 limited 구분 불가.
- 따라서 limited production 무인 가동을 표현하는 **새 신호**가 필요하나, entrypoint shell/systemd/test-2760/preflight 무손상이어야 한다.

## Q (Question)
test-2760(인자0)·legacy·canary 전부 무손상 + preflight 무수정으로, production limited 무인 가동 신호를 어떻게 driver 내부에서 닫을 것인가?

## A (Answer)
설계 packet(`memory/plans/spawn_safety_governor/limited_runtime_signal_design_packet_260626.md`) 권장 **옵션1(함수 파라미터 `limited_runtime`, preflight 무수정, 2파일)** 을 구현.

### 구현 (expected_files 2개만)
1. **`dispatch/anu_pickup_driver.py`**
   - `main(argv=None, *, activation_intended: bool = False, limited_runtime: bool = False) -> int` — 파라미터 신설.
   - `__main__`: `raise SystemExit(main(limited_runtime=True))` — **운영 경로만 True**.
   - bound gate `is_activated_fn` 3-way 분기:
     - `limited_runtime=True` → `lambda: is_activated(CANONICAL_ROOT) and read_callback_launch_enabled(CANONICAL_ROOT)` (두 flag 모두 ON일 때만 active). lazy import 로 preflight 모듈 의존 회피.
     - `activation_intended=True` (canary) → `lambda: is_activated(CANONICAL_ROOT)` (기존 무변경).
     - 둘 다 False (legacy·test-2760 인자0) → `None` (현행 pass-through 보존).
   - **의미충돌 fail-closed**: `if limited_runtime and activation_intended:` → 즉시 `return 0` (fire 0, scan/governor/launcher/preflight 미호출). 임의 우선 0.
   - canary preflight(`if activation_intended:`)는 **무변경** — limited_runtime은 의미충돌 가드로 activation_intended=False가 강제되어 그 블록에 절대 진입하지 않음 ⇒ "limited는 canary preflight 미호출" 구조적 보장.
2. **`tests/regression/test_limited_activation_bounds_2775.py`** — 회귀 테스트 9건 추가(테스트 25~33).

### 모델 사용 기록
- 토르(백엔드): **sonnet** — driver 결선 구현.
- 헤임달(테스터): **sonnet** — 회귀 테스트 9건.
- 오딘(팀장): 설계/검증/통합 (Opus, 직접 코딩 0).
- haiku 미사용.

## 생성/수정 파일 (PR base 20875ef → head a58b81aa diff)
- `dispatch/anu_pickup_driver.py` (수정: main 시그니처 + 의미충돌 가드 + bound fn 분기 + `__main__`)
- `tests/regression/test_limited_activation_bounds_2775.py` (수정: 테스트 9건 append, 816→1283줄)
- ⇒ **expected_files 2개 정확 일치. 밖 수정 0** (`git diff --name-only 20875ef HEAD` 확인).

## 테스트 결과
- **test-2760: 36 passed** (무회귀 — `test_p0b_event_strategy_2760.py` + `test_p0b_event_strategy_wiring_2760.py`).
- **2775 bounds: 33 passed** (기존 24 + 신규 9, 0 fail).
- `py_compile` 2파일 PASS.
- 신규 9건: `__main__` True 전달 정적검증 / 두 flag ON + epoch 부재 auto-disabled / 두 flag ON + epoch 손상 auto-disabled / callback flag OFF legacy 무손상 / driver flag OFF default-OFF 무손상 / 정상 epoch canary preflight 미호출 scan 진행 / 동시 True fail-closed STOP / 인자0 legacy 보존 / kill 우선.

## L1 스모크테스트 결과 (필수)
- **서버 재시작**: 해당없음 (driver는 systemd-path entrypoint, 서버 아님).
- **API 응답 확인**: 해당없음 (HTTP API 아님). 대신 실제 entrypoint + 격리 harness 실행:
  - **L1-A (실제 entrypoint)**: `python3 -m dispatch.anu_pickup_driver` (CANONICAL_ROOT=/home/jay/workspace, 실제 flags OFF) → **exit rc=0, NOOP**. 실행 후 flag 변동 0 (driver=disabled 유지, callback/epoch 부재 유지) ⇒ **real fire 0**.
  - **L1-B (격리 tmp-root)**: 두 flag ON(p0b_driver_enabled=enabled, p0b_callback_launch_enabled=enabled) + epoch 부재 → stderr `limited-activation bound gate NOOP ... NOOP_ACTIVE_EPOCH_MISSING_AUTO_DISABLED` / driver flag **auto-disabled('disabled')** / rc=0 / scan_once·scan_live·launcher·governor·**preflight 전부 0회** ⇒ fire 0 + **canary preflight 미호출 실증**.
  - **L1-C (격리 tmp-root)**: `main([], limited_runtime=True, activation_intended=True)` → stderr `동시 True 의미 충돌 → fail-closed STOP` / rc=0 / scan·preflight 0회 ⇒ 의미충돌 fail-closed 실증.
- **스크린샷**: 해당없음 (프론트 작업 아님).
- 실제 flag 상태(작업 전후 불변): `p0b_driver_enabled=disabled` / `p0b_callback_launch_enabled` 부재 / `p0b_activation_epoch` 부재 / `p0b_kill` 부재.

## 게이트 (Lv.2)
- **G1 설계**: affected_files 2개(driver + 2775 test), 다른 팀/파일 겹침 0. preflight·test-2760·entrypoint·governor·runner·launcher·owner-proof·`.github/**`·finish-task.sh 무접촉 확인.
- **G2 구현**: 팀 테스터(헤임달) 기능 테스트 9건 + 통합 회귀 PASS, L1 실동작 확인.
- **G3 머지**: ★ 본 task는 **머지 금지** 명시 — `worktree finish --action pr` 미사용. 브랜치 push로 PR #255 갱신만. ANU 독립검증 → fresh-head Gemini → CI 확인 → 회장 머지 판단 대기.

## STOP 조건 점검 (전부 미해당)
- limited 분기가 canary/legacy/test-2760 경로 변경: **없음** (test-2760 36 PASS, legacy scan_once 도달 테스트 PASS).
- limited가 canary preflight를 타서 정상 pickup 차단: **없음** (L1-B preflight 0회, 정상 epoch scan 진행 테스트 PASS).
- preflight 수정 필요: **없음** (옵션1, 무접촉).
- entrypoint shell/systemd 수정 필요: **없음**.
- expected_files 밖 수정 필요: **없음**.
- activation/real fire/canary/systemd enable·start 필요: **없음**.

## 발견 이슈 및 해결
- pyright `Import "dispatch" could not be resolved` 경고: 테스트 파일의 sys.path 부트스트랩(기존 line 42~64) 방식에 기인한 정적분석 한계로, **기존부터 존재**하며 pytest 런타임은 정상(36+33 PASS). 코드 결함 아님 — 조치 불요.
- pyright `argv is not accessed`(driver:2131): `argv` 미사용은 **기존 시그니처에도 동일**(우리 변경 무관). 인터페이스 호환 위해 유지.

## 결과 보고 (필수 항목)
- **PR #255 유지 여부**: ✅ open 유지, 같은 브랜치 commit 추가(새 PR 0).
- **base SHA**: `20875ef693fbde3c9690b7bb3220153b3fd71b8a`
- **new head SHA**: `a58b81aa4bd870aa7abe1669179b2350c34658c4`
- **expected_files 2개 내 diff 증거**: 위 "생성/수정 파일" 참조 (diff 2파일 한정 확인).
- **`__main__` limited_runtime 경로 검증**: 정적(`main(limited_runtime=True)` in source) + 실제 entrypoint L1-A rc=0.
- **active+epoch 부재/손상 L1**: L1-B(부재) auto-disabled + 테스트27(손상) PASS.
- **정상 epoch 경로**: 테스트30 PASS (preflight 0, scan 진행).
- **canary preflight 미호출 증거**: L1-B preflight 0회 + 테스트30.
- **test-2760 결과**: 36 passed.
- **2775 bounds 결과**: 33 passed.
- **ACTIVE=false / systemd disabled / flags OFF / real fire 0 / canary 0**: 실제 flag OFF 확인 + L1-A flag 변동 0.
- **MERGE_CANDIDATE 가능 여부**: ✅ **MERGE_CANDIDATE** — 단, **머지 절대 금지**. ANU 독립검증 → fresh-head Gemini → CI PASS 확인 후 **회장 명시 승인 시에만** 머지.

## 머지 판단
- **머지 필요**: No (회장 승인 전 PR #255 open 유지)
- **브랜치**: `task/task-2775-dev2` (PR #255)
- **워크트리 경로**: `/home/jay/workspace/.worktrees/task-2775-dev2`
- **머지 의견**: 2파일 micro-PR, test-2760/legacy/canary 전부 무손상, L1 실증 완료. real fire 0·activation 0. ANU 독립검증 + fresh-head Gemini High 0건 + CI green 확인 후 회장 판단으로 머지 권고.
