# task-2553+26 — TRACK M RE-RUN: gate-0 SOURCE-SCOPE 정정 + PR #129 PROFILE-DRIVEN MERGE LIFECYCLE (회장 GO, 코드/파일 자동화)

> **Lv**: Lv.4 — irreversible merge + credential-redacted. **Executor**: 적합 dev 1회 한정 (ANU-Codex loop 선행, ANU→executor 1회 위임). **TTL**: 2h.
> **상태**: 회장 GO — blocker 정정 수용. **남은 blocker = BOT_GITHUB_TOKEN 공급 부재 아님**(토큰은 canonical secret 경로 `.env.keys` 에 이미 존재, `refresh-bot-token.timer` 정상 갱신 중 — ANU redacted 조사 `task-2553-bot-token-injection-path-investigation_260517.json` 회장 수용). **실제 blocker = +26 gate-0 auth preflight 가 `os.environ` 만 평가해 canonical `.env.keys` 경로를 보지 못함**. 토큰 발급/주입/권한확대·회장 토큰 직접 입력 0. 본 task = gate-0 source-scope 1줄 정정 → 6-check AND PASS 시 PR#129 profile-driven merge lifecycle 진행. md 박제만 금지.
> **선행**: +20(MERGE_READY)·+22(profile refresh→03ec91d1)·+24(redacted preflight, os.environ scope 한계 노출). **병렬**: +25(operational collector wiring) 비간섭 SAFE. **dispatch gate 없음**(토큰 현존 — GO_READY 시 즉시 dispatch).

---

## 1. 확정 전제 (변경 불가 — 마커 근거)

- ANU redacted 조사(회장 수용): canonical `/home/jay/workspace/.env.keys` 에 비어있지 않은 `ghs_` App installation token(OWNER PAT 아님) **현존**. `scripts/refresh_bot_token.py` + systemd `refresh-bot-token.timer` ACTIVE(~50min 주기, last status=refreshed). PEM `/home/jay/.secrets/jeon-jonghyuk-taskctl-bot.2026-05-05.private-key.pem` exists·readable.
- +24 `task-2553+24.auth-preflight.json`: `token_present:false`(2026-05-17 20:59) = **process `os.environ` 범위 관측 한계** — credential 공급 부재 아님.
- +22 `task-2553+22.profile-refresh-decision.json`: `old 2753e3cf → new 03ec91d14a094a1792d240107a592ed6ddf0c29b` / `schema_valid:true` / one-key diff / regression PASS.
- +20: PR#129 MERGE_READY (unresolved 0 · mss CLEAN · CI 11/11 SUCCESS · effective diff 2 test files · production byte-0).

## 2. 목표 (회장 verbatim)

gate-0 auth preflight 가 `os.environ` 단독이 아니라 **canonical `.env.keys` 또는 executor 가 `.env.keys` 를 source 한 env 를 평가**하도록 수정한다. 정정 후 gate-0 redacted preflight 가 **6-check AND PASS** 이면 task-2553+26 PR #129 merge lifecycle 을 **policy profile 기반** 진행한다.
- `goal_type`: merge_test_only_hardening_pr / `target`: PR #129 / `policy_profile`: test_only_hardening_pr_merge_v1.
- 토큰 원문·`.env.keys` 내용을 채팅·파일·로그·marker·report 에 **절대 출력 0**. redacted evidence 만. ANU·executor 토큰 값 요구·복사 0 — 존재·`ghs_` App token 여부·OWNER PAT 아님·raw exposure 0 만.

## 3. 현재 preconditions (gate 입력)

- profile `sanctioned_head_sha` = `03ec91d14a094a1792d240107a592ed6ddf0c29b`
- PR #129 MERGE_READY / CI 11/11 SUCCESS / unresolved threads 0 / production byte-0 / effective diff 2 test files

## 4. gate-0 source-scope 정정 (redacted auth preflight — 첫 단계 강제)

**정정 핵심(회장 목표)**: +24 산출 redacted auth verifier 의 토큰 조회 source 를 `os.environ` 단독 → **canonical `.env.keys` 경로(또는 executor 가 `.env.keys` 를 source 한 env) 우선 평가**로 확장(최소 변경 1-scope). `.env.keys` 파서는 라인 `(export )?BOT_GITHUB_TOKEN=…` 만 추출, 값은 **메모리 내 prefix 4자 슬라이스·boolean 비교만**(파일 내용·값 echo·cat·print·write·log 0). os.environ 에 있으면 그것도 허용(executor 가 .env.keys source 한 경우).

**조건 (회장 verbatim)**: 토큰 원문 출력 금지 / `.env.keys` 내용 출력 금지 / redacted evidence 만 허용 / `ghs_` App token 여부만 확인 / OWNER PAT 사용 금지 / raw exposure 0 유지 / credential 발급·갱신·권한확대 0 / `refresh_bot_token.py`·systemd timer **수정 금지**(read-only 소비만).

**gate**: **6 check 전부 PASS(AND) 일 때만** pre-merge gate 진입(부분 PASS·SKIP 진입 0): ① `token_present==true`(canonical .env.keys 또는 sourced env) ② `prefix_is_ghs==true` ③ `is_app_token_not_owner_pat==true`(gho_/ghp_ 아님) ④ `gh_auth_capable==true` ⑤ `merge_permission_preflight=="PASS"`(gh 저장 cred tokenless probe, `-H "Authorization:"`·`gh auth token` 0) ⑥ `raw_exposure==0`. 1개라도 fail/미충족 → **즉시 HOLD_FOR_CHAIR**, hold packet 에 fail 조건 **전부 enumerate**(§8 매핑). HOLD 시 merge 0·토큰 발급/주입/복사 0·redacted hold packet.

## 5. merge lifecycle (gate-0 6-check AND PASS 후 — 회장 verbatim 진행)

redacted auth preflight → profile gate → BOT merge → post-merge smoke → reconcile evidence → closeout packet.

1. **pre-merge gate**(profile test_only_hardening_pr_merge_v1 driven): mergeable·mss CLEAN·reviewDecision allowlist·CI all SUCCESS·unresolved 0·effective diff test-only(2 files)·production byte-0·**head_sha == profile.sanctioned_head_sha(==03ec91d1) == live `gh pr view 129 --repo Jeon-Jonghyuk/dev_workspace --json headRefOid`**. 1개라도 fail → PRE_MERGE_HOLD(merge 0).
2. **BOT merge**(irreversibility doctrine): head-SHA-pinned `gh api -X PUT /repos/Jeon-Jonghyuk/dev_workspace/pulls/129/merge -f sha=<live head> -f merge_method=<profile 명시>` — **taskctl-bot GitHub App installation token(ghs_) 자체 저장 인증으로만**(OWNER PAT 0, `-H "Authorization:"` 수동 구성 0). head-drift 두 경로 명확 분리: **(a) pre-PUT head mismatch**(merge 직전 live `gh pr view 129 headRefOid` ≠ profile.sanctioned_head ≠ pin) → `{state:"pre_merge_hold", reason:"pre_put_head_mismatch", put_fired:false}` (PUT 미발사). **(b) PUT 응답 409**(전송 후 head moved) → `{state:"merge_409_head_moved", reason:"put_returned_409", put_fired:true}` — rollback/재PUT 0, stop·HOLD. PUT **최대 1회**(중복 0). **이미 MERGED**(pre-merge `gh pr view 129 --json state,mergedAt`==MERGED) → PUT 미발사, `{state:"already_merged_noop", mergedAt, mergedBy, mergeCommit(기존), put_fired:false, evidence_basis:"pre-merge state probe"}` — HOLD 아님, closeout 정상.
3. **post-merge smoke**: profile 명시 smoke. harness artifact false-negative 는 +13 기준(본질 PASS 시 ACCEPT).
4. **reconcile evidence**: mergedAt/mergedBy/mergeCommit·post-merge state 대조 evidence JSON.
5. **closeout packet**: evidence 기반 result.json(evidence 없는 closeout 0).

## 6. 필수 산출 (회장 verbatim 5 — 코드/파일 자동화, 문서화 아님)

1. **auth preflight source-scope correction**(코드 — +24 verifier 의 토큰 source 확장: canonical `.env.keys`/sourced env, redacted 파서, 최소 변경).
2. **redacted auth evidence JSON**(`memory/events/task-2553+26.auth-preflight.json` — +24 화이트리스트 schema 정합: token_present·prefix_is_ghs·is_app_token_not_owner_pat·gh_auth_capable·merge_permission_preflight·raw_exposure:0·checked_via·`cond6_results`(§4 6-check 각 bool/enum, +24 schema field 명칭 정합 — 7번째 조건 없음)·token_source(enum: env_keys|sourced_env, 경로명만·값 0)·ts. raw·.env.keys 내용 필드 부재 강제).
3. **regression 또는 preflight test**(①.env.keys 존재 ghs_→PASS ②.env.keys 부재/빈값→FAIL HOLD ③OWNER PAT prefix→FAIL ④raw 토큰·.env.keys 내용이 stdout/stderr/traceback/marker/evidence 어디에도 미출현 정적+런타임 spy ⑤merge endpoint PUT 미호출 정적 ⑥os.environ 만 있고 .env.keys 없을 때/그 반대 모두 정상 평가).
4. **decision/result JSON**(`memory/events/task-2553+26.decision.json`: source-scope 정정 전후·gate-0 6-check 결과·pre-merge gate 8조건·merge result(canonical 4종: `merged`·`pre_merge_hold`·`merge_409_head_moved`·`already_merged_noop`)·smoke·reconcile·production byte-0·contamination).
5. **final packet**(`memory/events/task-2553+26.result.json` — §9 9항목 consolidated summary 입력 포함, redacted).

## 7. 금지 (회장 verbatim — D-SPEC-EXACTNESS, 원문 박제)

- 토큰 원문 출력·저장·로그
- OWNER PAT로 merge
- credential 발급/권한확대
- .env.keys 내용 노출
- PR #129 코드 변경
- production code 변경
- PR #128 / PR #102 변경
- F2 / phase3 / mqe 변경
- force / rebase / admin override
- evidence 없는 closeout

**carve-out(회장 목표 명시)**: 본 task 의 **유일 허용 코드 수정 = +24 산출 redacted auth verifier 의 토큰 source-scope 확장**(§4·§6.1, redacted 규율·기존 화이트리스트 schema 무회귀 한정). 그 외 `refresh_bot_token.py`·systemd timer·+22·+25·Track A·B·P·coordinator artifact·anu_v3 frozen·`anu_delegation_completion_callback.py` = **수정·인용 0(frozen)**. 추가 scope: credential 발급·갱신·권한확대 0 / dev 재가동·신규 dispatch(executor 자기작업중)·branch·commit·push·PR 생성·merge revert/rollback 0. live `/home/jay/workspace`(repo root) git tracked HEAD/branch/ref(`task/task-2553p1-f1-clean-replacement` `20456b5f`) 전후 assertEqual(task-2553+26.* marker=git-untracked, 위반 아님 — PR#129 merge 는 origin 측 의도된 상태변경, live worktree tracked HEAD 무변).

## 8. HOLD_FOR_CHAIR (회장 verbatim)

- .env.keys 접근 불가
- ghs_ App token 확인 실패
- OWNER PAT 필요
- raw token exposure 위험
- refresh token mechanism 손상 가능성
- PR #129 head drift
- CI/Gemini/CLEAN 재악화
- production diff 발생
- Codex HIGH/CRITICAL
- merge 실패
- smoke/reconcile 실패

적중 시: 작업중단 + redacted hold-for-chair packet + 토큰 발급/주입/복사/scope 확대 0 + §9 consolidated summary 보고. post-merge 단계 실패 시 rollback/revert/force/admin 0 — stop·HOLD packet 만(merge irreversibility doctrine).

## 9. 완료 후 보고 (회장 verbatim — consolidated final summary 만, 단독·중간 0)

1. auth preflight 결과(redacted) 2. PR #129 pre-merge gate 결과 3. mergedAt/mergedBy/mergeCommit 4. post-merge smoke 결과 5. reconcile evidence 결과 6. production byte-0 유지 여부 7. Track A/B/P contamination 여부 8. callback collector 결과 9. HOLD_FOR_CHAIR 여부.

## 10. 무변경 anchor (byte-0)

frozen: `utils/anu_delegation_completion_callback.py` sha256 `83b3e307c8207c76a3e311c408aab4951373bd317896e51687d3007907b0c3d4` byte-0 · anu_v3 pre_authorized_*·isolated_worktree_evidence_source·goal_activation_controller·pre_authorized_activation_runner·branch_ref_allocator·anu_v3 coordinator(+17)·completion_callback_fallback_cancel·+22 profile/runner·+25 seam·`refresh_bot_token.py`·systemd timer 무변. +24 verifier 는 본 task 의 **source-scope 확장 대상**(redacted 규율 유지·기존 화이트리스트 schema 무회귀, 그 외 무변). PR#129 머지 외 production/frozen 1byte 변경 0.

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

batch plan(§4§5§6) → Codex lint → ANU refine(9-R) → re-lint → **ANU(orchestrator)가 본 task 를 executor 에 1회 위임**(loop 기계 — 이 단일 허용 dispatch 는 ANU 행위; executor 는 자기 작업 중 신규 dispatch·cron·delegation·executor handoff 0, 필요 시 HOLD_FOR_CHAIR) → gate-0 source-scope 정정→redacted preflight→pre-merge gate→merge→smoke→reconcile→closeout → post-result audit → adjudication → result.json → consolidated summary. callback (a) normal+fallback 자가등록(4-tuple task_id=task-2553+26 분리, 타 track artifact 인용 0). §8 트리거만 회장 보고, 그외 LOW/MED·fixture·regression·false-positive·harness artifact 자동 수렴. **dispatch gate 없음**(토큰 현존, 회장 GO 완료) — Codex re-lint GO_READY 시 **ANU 가** 즉시 1회 위임(행위자=ANU, executor 아님).

## 12. task-2553 계열

+20=PR#129 MERGE_READY / +21=PRE_MERGE_HOLD / +22=profile refresh→03ec91d1(ACCEPT) / +24=redacted preflight(os.environ scope 한계 노출, ACCEPT) / **+26(본건)=gate-0 source-scope 정정 + PR#129 profile-driven merge lifecycle** / +25=operational collector wiring(병렬 비간섭).

## 13. 9-R — Codex lint 반영

직전 라운드 9-R.1 already_merged_noop·9-R.2 6-check AND 반영 완료(§5.2/§6/§4 통합). gate-0 source-scope 개정 Codex lint(agent af5db4f556b4e27a3: C0/H2/M2/L0) → 자동 수렴:

### 9-R.3 (HIGH §5.2) head-drift 두 경로 분리
pre-PUT head mismatch → `{state:"pre_merge_hold", reason:"pre_put_head_mismatch", put_fired:false}` / PUT 응답 409 → `{state:"merge_409_head_moved", reason:"put_returned_409", put_fired:true}` (rollback/재PUT 0). canonical terminal state **정확히 4종 = `merged` · `pre_merge_hold` · `merge_409_head_moved` · `already_merged_noop`**, 그 외 closeout 0.

### 9-R.4 (HIGH §7/§10) +24 verifier carve-out 명시
§7 frozen/금지 와 §10 byte-0 에 대해 **유일 허용 코드 수정 = +24 verifier source-scope 확장**(§4·§6.1, redacted 규율·기존 화이트리스트 schema 무회귀 한정) 명시 carve-out. 그 외 +22/+25/Track A·B·P/coordinator/anu_v3 frozen/`anu_delegation_completion_callback.py`/`refresh_bot_token.py`/systemd timer = 수정·인용 0. 모순 해소(수정 대상 ≠ frozen 대상, 행위 경계 명확).

### 9-R.5 (MED §11) dispatch 행위자 명시
ungated 단일 dispatch 행위자 = **ANU(orchestrator)**. executor 는 자기 작업 중 신규 dispatch 0. §11 표현 확정("ANU 가 1회 위임, executor 아님") — 행위자 상이로 모순 아님.

### 9-R.6 (MED §6.2) schema field = cond6_results
+24 화이트리스트 schema 의 조건결과 필드를 §4 6-check 와 정합되도록 `cond6_results`(6각 bool/enum) 로 명시(7번째 조건 없음). §4↔§6 schema-gate 정합.

→ 9-R.3~9-R.6 으로 HIGH2+MED2 해소. CRITICAL0. 9-R 이 본문에 우선. Codex re-lint GO_READY 시 ANU 즉시 1회 위임.
