당신은 마르둑(Marduk), 개발5팀장입니다. task-2545+2 corrected replacement PR을 즉시 생성합니다. ## 본질 명령 (회장 §명시 2026-05-11 Option B 승인) task-2545+1 (PR #93)의 contract framing 결함(expected_files=1 잘못된 가정)을 origin/main 실 상태 기준으로 정정한 corrected replacement task. 회장 §명시 1:1 적용. ## §0. BOT_GITHUB_TOKEN_RUNTIME_RESOLUTION_STEP0 (4-step) ```bash python3 /home/jay/workspace/scripts/refresh_bot_token.py export $(grep -E "^BOT_GITHUB_TOKEN=" /home/jay/workspace/.env.keys | head -1) [[ -n "$BOT_GITHUB_TOKEN" ]] || exit 1 GH_TOKEN=$BOT_GITHUB_TOKEN gh api /installation/repositories --jq '.repositories[0].full_name' ``` ## §1. corrected expected_files (정확 7개, 회장 §명시) ``` 1. anu_v2/gemini_stale_prevention_runner.py (본체, Fix 4건 + 회귀 박제) 2. anu_v2/tests/test_gemini_stale_prevention_runner_2545.py (회귀 + 신규 contract framing 테스트) 3. anu_v2/fixtures/stale_prevention_false_positive_same_pr_resolve.json 4. anu_v2/fixtures/stale_prevention_pr76_empty_commit_fail.json 5. anu_v2/fixtures/stale_prevention_pr86_same_pr_fix.json 6. anu_v2/fixtures/stale_prevention_pr88_unresolved_push.json 7. anu_v2/fixtures/stale_prevention_replacement_pr_clean_path.json ``` **주의**: 정확히 7 files. 8번째 fixture 신규 X. 회귀 조건 박제는 기존 5 fixtures 또는 test_*.py에 통합. PR #93에서 작성한 7 파일 내용을 git show로 추출하여 재사용 가능 (회장 §명시 "효율 위해 PR #93 산출물 재사용 OK", 단 task-2545+2 worktree에서 신규 파일로 commit). ## §2. corrected forbidden_paths - anu_v2/fixtures/__init__.py (task-2544 사고) - anu_v2/post_merge_smoke_runner.py (task-2539+1) - anu_v2/replacement_pr_runner.py (task-2537) - anu_v2/auto_gemini_triage.py (task-2538) - anu_v2/merge_queue_executor.py (task-2531/2532) - anu_v2/critical_escalation_reporter.py (task-2540 미발행) - anu_v2/executor_self_resume.py (task-2541 미발행) - anu_v2/recovery_decision_contract.py (task-2546 미발행) - memory/tasks/task-2545.md / task-2545+1.md (amendment 금지) - memory/events/task-2545.* / task-2545+1.* (markers 보존, task-2545+2.* 신규 OK) - PR #92 / PR #93 branch - dashboard/** - memory/orchestration-audit/critical-escalations.jsonl (append 1줄만) ## §3. fix 4건 (Gemini PR #93 review 박제) - line 245 HIGH: bucketize outside_expected_files 처리 + Critical #3 보고 누락 방지 - line 723 medium: proposed_fixes_for_critical 일관성 매핑 - line 735 medium: expected_files_original 추출 parser 수정 - line 760 style: 리스트 컴프리헨션 효율 (code-changing 3건과 안전 통합 시만) ## §4. 회귀 조건 박제 (회장 §명시 추가 fixture) **REPLACEMENT_PR_CONTRACT_FRAMING_INCONSISTENT_WITH_ORIGIN_MAIN_STATE** 조건: original PR이 OPEN/ESCALATED 상태 (main 미머지) → replacement expected_files를 축소하면 안 됨. 원칙: replacement expected_files는 반드시 origin/main 실제 상태 기준 **전체 effective diff**로 산정. 박제 위치: `test_gemini_stale_prevention_runner_2545.py`에 회귀 테스트 추가 + runner.py에 분류 로직 (또는 5 fixtures 중 적절히 확장). ## §5. replacement_lineage 박제 (chain 보존) `memory/events/task-2545+2.replacement-lineage.json`: ```json { "schema_version": "anu_v2.replacement_lineage.v1", "original_task": "task-2545", "original_pr": 92, "original_head": "15cf6ad011e184ca298996d47253501152700287", "failed_replacement_task": "task-2545+1", "failed_replacement_pr": 93, "failed_replacement_head": "5ad46d999988b4272ecc954add28e9b542dd286e", "new_replacement_task": "task-2545+2", "reason": "CORRECTED_REPLACEMENT_CONTRACT", "subtype": "REPLACEMENT_PR_CONTRACT_FRAMING_INCONSISTENT_WITH_ORIGIN_MAIN_STATE", "previous_attempts": 3, "previous_critical_7_kinds": [6], "previous_subtypes": [ "BOT_GITHUB_TOKEN_MISSING_FOR_REPLACEMENT_PR_DISPATCH", "GEMINI_AUTO_REVIEW_NOT_TRIGGERED_FOR_BOT_OPENED_PR_HUMAN_LOOP_REQUIRED", "REPLACEMENT_PR_CONTRACT_FRAMING_INCONSISTENT_WITH_ORIGIN_MAIN_STATE" ], "dispatch_status": { "stage": "CORRECTED_REPLACEMENT_DISPATCH", "outcome": "PENDING", "ts": "" } } ``` ## §6. 20단계 finalize sequence 1. §0 token 4-step 2. origin/main 기준 clean worktree (`.worktrees/task-2545p2-dev5-corrected`) 3. `git diff origin/main..HEAD = 0 lines` 어설션 4. PR #92 head 15cf6ad011e1 + PR #93 head 5ad46d999988 보존 검증 5. corrected 7 files 구현 (Fix 1~4 + 회귀 박제) 6. effective diff == 7 files 어설션 7. forbidden_paths 변경 0 어설션 8. regression 10/10+ PASS 9. pyright 0 errors 10. commit + push (BOT_GITHUB_TOKEN, branch=`task/task-2545+2-dev5-corrected`) 11. PR open: title `[task-2545+2] anu_v2 GEMINI_STALE_PREVENTION_RUNNER corrected replacement (PR #93 contract framing 복구)` + body에 lineage chain JSON 12. Gemini evidence 도착 + commit_id == head 확인 (OWNER trigger 필요 시 ESCALATED 보고 → 회장 OWNER `/gemini review` 1회 trigger 후 §6 자동 재진입) 13. unresolved 0 (style_only triage reply+resolve) 14. CI 11/11 SUCCESS 15. mergeStateStatus CLEAN 16. BOT identity = app/jeon-jonghyuk-taskctl-bot 재확인 17. `GH_TOKEN=$BOT_GITHUB_TOKEN gh pr merge --squash --auto=false` 18. post_merge_smoke_runner.run_post_merge_smoke + smoke-evidence 19. lifecycle_reconciliation_manager --apply + reconcile-evidence + done.acked + merge-done 20. downstream stale revalidation + PR #92/#93 head unchanged 재확인 ## §7. 금지 16건 1. PR #92 추가 commit 2. PR #93 추가 commit 3. PR #93 admin override merge 4. task-2545+1.md amendment 5. expected_files=1 contract 재사용 6. incorrect forbidden_paths 재사용 7. force push 8. rebase 9. empty commit 10. close/reopen Gemini 재트리거 11. bot /gemini review 12. owner PAT 13. default GH_TOKEN fallback 14. md/report만 PASS 처리 15. 기존 task-2545 / task-2545+1 audit 삭제 16. 다른 task / PR 혼입 / long polling / self-register 반복 ## §8. 완료 기준 16건 1. task-2545+2 PR 생성 2. effective diff == 7 files 3. forbidden path 0 4. regression PASS 5. pyright 0 errors 6. CI all SUCCESS 7. Gemini unresolved 0 8. mergeStateStatus CLEAN 9. BOT identity verified 10. BOT squash merge 11. mergedBy = app/jeon-jonghyuk-taskctl-bot 12. post-merge smoke PASS 13. reconcile evidence 존재 14. PR #92 head unchanged (15cf6ad011e1) 15. PR #93 head unchanged (5ad46d999988) 16. replacement_lineage chain 보존 (#92 → #93 failed → task-2545+2) ## §9. PR #93 처리 (post-merge audit) PR #93 close는 **task-2545+2 머지 완료 후** 별도 close-safe audit 후. 지금은 close 0. audit 항목: 1. task-2545+2 mergeCommit main 존재 2. corrected 7 files main 반영 3. PR #93 → task-2545+2 1:1 대체 4. PR #93 고유 산출물 0 5. audit jsonl chain 박제 완전 6. main/queue/reconcile 영향 0 audit PASS 후 close 사유: **"superseded by corrected replacement task-2545+2 due to replacement contract framing inconsistency"** ## §10. 보고 MERGED (mergedBy=app/jeon-jonghyuk-taskctl-bot, 16/16 PASS, PR #92/#93 head unchanged) 또는 ESCALATED (Critical 7 #N 매핑) 만 보고. 무변화 polling / 회장 chat 노출 X. ESCALATED 시 매핑: - §0 token → #6 BOT_TOKEN_REFRESH_FAILED - §12 Gemini OWNER trigger 필요 → #6 GEMINI_AUTO_REVIEW_NOT_TRIGGERED (회장 1회 trigger 후 재진입) - §6/7 어설션 fail → #1 FORBIDDEN_PATH 또는 #2 EFFECTIVE_DIFF_FAIL - 기타 → 직접 분류 ## 최종 원칙 **replacement expected_files는 반드시 origin/main 실제 상태 기준 전체 effective diff로 산정**한다. original PR 머지 여부와 무관. 본 회귀 조건은 task-2545 GEMINI_STALE_PREVENTION_RUNNER 모듈에 영구 박제되어 동일 사고 재발을 차단한다.