# task-2553+23 — CALLBACK_CANCEL_ON_SUCCESS_OPERATIONAL_INTEGRATION (회장 GO, 코드/파일 자동화)

> **Lv**: Lv.4 — callback cancel-on-success 운영 통합 + 실 cron-remove 안전장치. **Executor**: 적합 dev 1회 한정 (ANU-Codex loop 선행). **TTL**: 2h.
> **상태**: 회장 GO — task-2553+9a cancel-on-success(dry-run/mock 검증 완료, 실 cron-remove 0, 운영 미적용)를 **운영 collector 실 적용 경로**로 통합. +16 fallback DUPLICATE_CALLBACK_IGNORED 는 기존 안전망상 정상이나, 개선목표(normal 성공→fallback 발화 0) 미완 확인. md 박제만 금지.
> **선행**: task-2553+9a(분리 모듈 `utils/completion_callback_fallback_cancel.py` + scripts CLI, dry-run 검증). callback (a) STANDARDIZED 정책.
> **병렬**: Track M(task-2553+21 PR#129 merge) / Track P(task-2553+22 profile hardening, M 후속) 와 expected_files 무충돌(callback infra 도메인) → 병렬 안전.

---

## 1. 목표 (회장 verbatim)

normal collector 성공 시 사전 등록된 fallback callback cron 을 **운영 collector 가 자동 취소**하도록 코드/파일 자동화로 통합. (normal 성공 → fallback cron remove → 불필요 fallback 발화 0)

## 2. 필수 조건 (회장 verbatim)

- task-2553+9a 분리 모듈(`utils/completion_callback_fallback_cancel.py`) **사용**하되 dry-run 이 아니라 **운영 collector 적용 경로** 신설.
- 실 cron-remove **직전 live cron-state ownership/role 교차검증** 추가.
- dispatch-fired marker 의 `fallback_cron_id` 만으로 제거 금지 → **live cron 조회로 task_id/chat_id/role/fallback 여부 재확인**.
- 검증 실패 시 cron-remove **하지 말고 fallback 보존**.
- normal collector 성공 자체는 cron-remove 실패로 **실패 처리하지 않음**(디커플).

## 3. 무변경 anchor (byte-0 강제 — ANU 핵심 제약)

`utils/anu_delegation_completion_callback.py` = **frozen anchor sha256 `83b3e307c8207c76a3e311c408aab4951373bd317896e51687d3007907b0c3d4` byte-0**(orchestrator 본체 — import/결합/수정 0). 운영 통합은 +9a 패턴 그대로 **분리 모듈 + 신규 collector seam additive** 만(frozen orchestrator 무접촉, +9a 안전성 규율 운영경로 상속). 기타 anu_v3 frozen anchor(pre_authorized_*·isolated_worktree_evidence·goal_activation_controller·pre_authorized_activation_runner·branch_ref_allocator·anu_v3 coordinator 6모듈[+17]·completion_callback_fallback_cancel 의 기존 dry-run API 시그니처) 무변(운영경로는 신규 호출점·옵션 추가, 기존 mock/dry-run 회귀 0).

## 4. 구현 방향 (코드/파일 자동화)

1. `utils/completion_callback_fallback_cancel.py` 운영 경로: 기존 dry-run remover 외 **운영 remover(실 `cokacdir --cron-remove`)** 를 dependency-injected 로 추가(기존 mock/dry-run 시그니처·동작 무회귀, 신규 옵션/주입점만).
2. **신규 live cron-state verifier**(예: `utils/live_cron_state_verifier.py`): 실 remove **직전** `cokacdir --cron-list`(또는 동등) 로 대상 cron 조회 → ① task_id 일치 ② chat_id==6937032012 일치 ③ role==fallback ④ 해당 task 의 dispatch-fired marker `fallback_cron_id` 와 일치 ⑤ 아직 미발화(pending)·미제거 — **5조건 AND 전부 충족 시에만** remove 허용. 하나라도 불충족/조회 실패 → **SKIP(보존)**, remove 0. idempotency: 이미 발화/제거된 fallback → no-op(이중제거 0).
3. **collector integration seam**: 운영 collector(normal callback collector)가 정상 종료·성공 판정(durable evidence: result.json 존재 AND status 성공/비-HOLD/비-failure + report + collector-result marker, +9a §9-R.2 success-gate 상속) 직후, 이 verifier→운영 remover 경로 1회 호출. **normal 성공/보고는 cron-remove 결과와 독립**(remove 실패·skip 이어도 normal 성공 유지, collector 실패 처리 0).
4. **audit trail**: 모든 remove 결정(대상 cron_id·5조건 각 결과·invoked/skip·사유) JSON 기록(`memory/events/task-2553+23.cancel-audit.json` 등).
5. fixture/regression/decision JSON.

## 5. 허용 (회장 verbatim)

callback cancel-on-success 운영 통합 코드 / live cron-state verifier / regression·fixture·decision JSON / callback collector integration seam / result marker 생성.

## 6. 금지 (회장 verbatim)

unrelated cron 제거 / dev 재가동 / dispatch / branch·commit·push·PR / merge / credential·OWNER PAT 조작 / closeout 변경 / task 결과 재분류 변경 / frozen anchor(특히 `utils/anu_delegation_completion_callback.py`) 수정·import 결합 / Track M·P·coordinator(+17/+19/+21/+22) artifact 수정·인용. live `/home/jay/workspace` git tracked HEAD/branch/ref(`task/task-2553p1-f1-clean-replacement` `20456b5f`) 전후 assertEqual(task-2553+23.* marker = git-untracked batch-internal, 위반 아님).

> **실 cron-remove 적용 범위 (9-R.4 단일 기계 규칙)**: 본 task 의 구현·테스트 단계는 실 운영 cron 을 **절대 실제 삭제하지 않는다**(mock/fixture/격리 검증만). 실 cron-remove 호출 경로는 코드로 구현·검증만 하며, 그 경로의 운영 런타임 발화(production collector 가 verifier-PASS 된 자기-task fallback 1건 제거)는 코드 완성·verifier PASS 이후 운영 단계 동작이지 본 task 실행 중 행위 아님. 회장 미지정 운영 cron·타 task cron·unrelated cron 실제 삭제 = 절대 0(어느 단계든).

## 7. 필수 regression (회장 verbatim 10 + 9-R.2/9-R.3 추가 2 = 총 12 — 전건 PASS)

1. normal success + fallback live ownership verified → cron-remove **called**
2. normal success + live cron **missing** → cancel **skipped**, success 유지
3. normal success + **task_id mismatch** → cancel skipped
4. normal success + **chat_id mismatch** → cancel skipped
5. normal success + **role not fallback** → cancel skipped
6. normal **failed/HOLD/partial** → cancel skipped, fallback **보존**
7. fallback **already fired** → no failure (idempotent no-op)
8. **duplicate callback 기존 경로 무회귀** (+9a/+16 DUPLICATE_CALLBACK_IGNORED 경로 불변)
9. 실 remove 호출은 **verifier PASS 일 때만** 가능
10. **wrong cron id 제거 시도 0**
11. **dispatch-fired marker `fallback_cron_id` 불일치 → cancel skipped, 실 remove 0**(9-R.2, §4.2 gate④ 직접검증)
12. **fallback already removed → idempotent no-op, 이중 remove 0, normal success 불변**(9-R.3, case7 already-fired 와 별도)

## 8. HOLD_FOR_CHAIR

frozen anchor(특히 anu_delegation_completion_callback) 변경 필요 / 실 운영 cron 제거가 자기 task fallback 범위 초과 / dispatch·branch·push·merge·credential 필요 / Track M·P·coordinator 도메인 touch 필요 / Codex unresolved HIGH·CRITICAL / ANU-Codex 반복충돌 / goal 달성불가 / Critical7.

## 9. 완료 후 (회장 verbatim)

**실 운영 적용 가능 여부** + **향후 normal success 시 fallback 발화 0 보장 여부** packet 보고. final packet(result.json): 분리모듈 운영경로 구현·verifier 5조건·seam 결선·audit trail·regression 12/12·frozen anchor byte-0 sha 증거·디커플 증명(normal 성공⊥remove 결과)·운영 활성 readiness(코드 PASS·verifier PASS 시 production collector 가 normal 성공 후 fallback 자동취소 → 발화 0)·HOLD 여부. batch consolidated summary 통합(단독 보고 0).

## 10. ANU-Codex loop + callback (자동, 중간보고 0)

batch plan(§4) → Codex lint → ANU refine(9-R) → re-lint → ANU→executor 1회 위임(loop 기계, §6 'task 수행 중 dispatch 금지' 와 무관; 적합 dev 1회 TTL2h, callback (a) normal+fallback, 4-tuple task_id=task-2553+23 분리·타 track artifact 인용·수정 0) → 구현 → regression 12 → frozen anchor byte-0 검증 → post-result audit → adjudication → result.json → batch 통합. §8 트리거만 회장 보고, 그외(LOW/MED·fixture·regression·false-positive) 자동 수렴.

## 12. 9-R — Codex lint 반영 (NEEDS_REFINEMENT → 자동 수렴, agent ad8653d42ec7f7ad8: CRITICAL0/HIGH1/MED3/LOW1)

### 9-R.1 (HIGH) "dispatch" 용어 충돌 해소 — 행위자 구분
§6 "dispatch 금지" = **본 task 의 executor(dev 봇)가 작업 수행 중 신규 dev/cron dispatch 를 발생시키는 것 금지**(실행 중 행위 제약). §10 "dispatch(적합 dev 1회)" = **ANU 가 본 task 를 executor 에 1회 위임하는 ANU-Codex loop 기계 단계**(ANU 의 행위, task 의 행위 아님 — 정상·허용). 두 절 모순 아님(행위자 상이). §10 표현 정정: "→ ANU→executor 1회 위임(loop 기계, §6 의 'task 수행 중 dispatch 금지' 와 무관) → 구현 →". executor 는 자기 작업 중 어떤 신규 dispatch·cron 등록도 0(callback (a) normal+fallback 자가등록은 §10 callback 절차로 한정 — 이는 정책상 collector cron 1회, 신규 dev dispatch 아님).

### 9-R.2 (MED) regression 11 추가 — marker mismatch gate
§7 에 추가: **11. normal success + dispatch-fired marker `fallback_cron_id` 불일치 → cancel skipped, 실 remove 0**(§4.2 5조건 중 ④ marker-cross-check gate 직접 검증, case 10 와 별도).

### 9-R.3 (MED) regression 12 추가 — already-removed idempotency
§7 에 추가: **12. fallback already removed(이미 제거됨) → idempotent no-op, 이중 remove 0, normal success 불변**(§4.2 "이미 발화/제거 → no-op" 중 already-removed 분기 직접 검증, case 7 already-fired 와 별도).

### 9-R.4 (MED+LOW) 실-removal 경계 단일 기계 규칙 + §10 naming 간소화
§6 "실 cron-remove 적용 범위" 마지막 문장 → **단일 규칙**: "본 task 의 구현·테스트 단계는 실 운영 cron 을 **절대 실제 삭제하지 않는다**(mock/fixture/격리 검증만). 실 cron-remove 호출 경로는 코드로 구현·검증만 하며, 그 경로의 운영 런타임 발화(production collector 가 verifier-PASS 된 자기-task fallback 1건 제거)는 코드 완성·verifier PASS 이후 운영 단계의 동작이지 본 task 실행 중 행위 아님. 회장 미지정 운영 cron·타 task cron·unrelated cron 실제 삭제 = 절대 0(어느 단계든)." §10 의 "Track M/P/coordinator artifact" 열거 → "타 track artifact 인용·수정 0"(§6 prohibition 단일 참조, 노이즈 제거).

→ 9-R.1~9-R.4 로 HIGH1+MED3+LOW1 해소. CRITICAL0. Codex re-lint GO_READY 시 dispatch.

## 11. task-2553 계열

+9a=callback cancel-on-success(dry-run/mock 검증, 운영 미적용) / **+23(본건)=cancel-on-success 운영 통합 + live cron-state verifier(실 remove 안전장치)** / +21=Track M PR#129 merge(병렬) / +22=Track P profile hardening(M 후속) / +19=coordinator V0 ACCEPT(완결).
