<!-- task=m-model-group-long-context-admission/06+01,02,03,04,05_capacity_smoke plan=2 tag=REVIEW_REVIEW_CAPACITY_SMOKE -->

# Plan - REVIEW_REVIEW_CAPACITY_SMOKE

## 이 파일을 읽는 구현 에이전트에게

이 task는 이전 `REVIEW_CAPACITY_SMOKE` 리뷰의 FAIL 후속이다. live dev provider pool S09 evidence가 아직 없으므로, runner 검증 blocker를 줄이고 실제 preflight + 세 scenario stdout/stderr, final status snapshot, Edge dispatch log evidence를 수집한다.

구현 후 `CODE_REVIEW-*-G??.md`의 구현 에이전트 소유 섹션에 실제 명령 출력과 evidence 경로를 채운 뒤 active 파일을 남긴 채 review ready로 멈춘다. finalization, log rename, `complete.log`, archive move는 code-review 전용이다.

Milestone lock 결정이 아니라 환경/secret/service 준비, smoke 실패, evidence 공백은 사용자 리뷰 요청이 아니다. 구현 중 직접 질문하거나 선택지를 제시하거나 `request_user_input`을 호출하지 말고, 필요한 blocker는 review stub의 `검증 결과`에 정확한 명령과 출력으로 기록한다.

## 배경

이전 루프는 smoke script의 local exit contract를 고쳤지만, SDD S09의 필수 live evidence는 수집하지 못했다. 기록된 blocker는 runner token 미설정, runner `go` 부재, local untracked script 미배포다. 이번 follow-up은 source bug 탐색이 아니라 evidence 신뢰 회복과 runner 실행 경로 보정에 집중한다.

## 사용자 리뷰 요청 흐름

사용자 리뷰 요청은 selected Milestone `구현 잠금 > 결정 필요` 항목만 active review stub에 기록한다. 이번 follow-up의 예상 blocker는 remote runner/secret/source sync/evidence 문제이며 사용자 리뷰 요청이 아니다.

## Roadmap Targets

- Milestone: `agent-roadmap/phase/operational-observability-provider-management/milestones/model-group-long-context-admission.md`
- Task ids:
  - `capacity-smoke`: dev 환경 normal 10-way, mixed long/normal, all-long-slot-full queue 시나리오와 최종 회복 근거
- Completion mode: check-on-pass

## Archive Evidence Snapshot

- Current archived plan: `agent-task/m-model-group-long-context-admission/06+01,02,03,04,05_capacity_smoke/plan_cloud_G08_1.log`
- Current archived review: `agent-task/m-model-group-long-context-admission/06+01,02,03,04,05_capacity_smoke/code_review_cloud_G08_1.log`
- Verdict: FAIL
- Required summary:
  - live dev provider pool preflight and `normal-10`, `mixed`, `all-long-slot-full` rerun evidence is missing.
  - archived review lines `70`, `77`, and `241` show `Trusted S09 evidence rerun` unchecked and scenario execution blocked before request dispatch.
  - blockers recorded: remote `IOP_LONG_SMOKE_TOKEN` unset, runner `go` absent, and local untracked smoke script not present in the clean runner checkout.
- Affected files:
  - `scripts/e2e-long-context-admission-smoke.sh`
  - `agent-test/dev/long-context-admission-smoke.md`
  - `agent-task/m-model-group-long-context-admission/06+01,02,03,04,05_capacity_smoke/CODE_REVIEW-cloud-G08.md`
- Verification evidence from review:
  - `bash -n scripts/e2e-long-context-admission-smoke.sh`: PASS.
  - `go run ./apps/edge/cmd/edge config check --config configs/edge.yaml`: PASS.
  - deterministic local mock regression: bad config preflight returned non-zero and HTTP 500 + zero peak returned non-zero.
  - live partial status snapshot: provider identities healthy and total normal capacity `9`, but live request scenarios were not run.
- Allowed narrow reread:
  - `agent-task/m-model-group-long-context-admission/06+01,02,03,04,05_capacity_smoke/code_review_cloud_G08_1.log`
  - `agent-task/m-model-group-long-context-admission/06+01,02,03,04,05_capacity_smoke/plan_cloud_G08_1.log`

## 분석 결과

### 읽은 파일

- `agent-ops/rules/project/rules.md`
- `agent-ops/rules/common/rules-roadmap.md`
- `agent-ops/rules/project/domain/testing/rules.md`
- `agent-ops/skills/common/router.md`
- `agent-ops/skills/common/code-review/SKILL.md`
- `agent-ops/skills/common/plan/SKILL.md`
- `agent-ops/skills/common/_templates/implementation-user-review-request-section.md`
- `agent-roadmap/current.md`
- `agent-roadmap/phase/operational-observability-provider-management/milestones/model-group-long-context-admission.md`
- `agent-roadmap/sdd/operational-observability-provider-management/model-group-long-context-admission/SDD.md`
- `agent-test/local/rules.md`
- `agent-test/dev/rules.md`
- `agent-test/dev/edge-smoke.md`
- `agent-test/dev/node-smoke.md`
- `agent-test/dev/inventory.yaml`
- `agent-test/dev/long-context-admission-smoke.md`
- `scripts/e2e-long-context-admission-smoke.sh`
- `agent-task/m-model-group-long-context-admission/06+01,02,03,04,05_capacity_smoke/plan_cloud_G08_1.log`
- `agent-task/m-model-group-long-context-admission/06+01,02,03,04,05_capacity_smoke/code_review_cloud_G08_1.log`

### SDD 기준

- SDD: `agent-roadmap/sdd/operational-observability-provider-management/model-group-long-context-admission/SDD.md`
- 상태: `[승인됨]`, SDD 잠금 `해제`
- 대상 Acceptance: S09 / Milestone Task `capacity-smoke`
- Evidence Map: dev smoke script/output and final recovery snapshot
- 적용: PASS는 live dev provider pool에서 preflight, normal 10-way, mixed long/normal, all-long-slot-full smoke의 actual stdout/stderr 또는 저장 파일 경로, final recovery snapshot, long queue dispatch log evidence가 있어야 한다.

### 테스트 환경 규칙

- test_env: local quick check + dev runtime evidence.
- 읽은 규칙: `agent-test/local/rules.md`, `agent-test/dev/rules.md`.
- 읽은 dev profiles: `agent-test/dev/edge-smoke.md`, `agent-test/dev/node-smoke.md`, `agent-test/dev/inventory.yaml`, `agent-test/dev/long-context-admission-smoke.md`.
- local quick check:
  - `bash -n scripts/e2e-long-context-admission-smoke.sh`
  - `go run ./apps/edge/cmd/edge config check --config configs/edge.yaml`
  - deterministic local mock regression.
- 테스트 환경 프리플라이트:
  - runner: `ssh toki@toki-labs.com`
  - repo root: `/Users/toki/agent-work/iop-dev`
  - source sync: clean runner checkout may not contain local untracked script; use `scp`/temporary copy for evidence or sync source before live smoke.
  - Edge binary candidate: `/Users/toki/agent-work/iop-dev/build/dev-runtime/bin/edge`
  - Edge config: `/Users/toki/agent-work/iop-dev/build/dev-runtime/edge.yaml`
  - Edge base URL: runner-local `http://127.0.0.1:18083/v1`
  - Control Plane status: `http://127.0.0.1:18001/edges/edge-toki-labs-dev/status`
  - providers: `gx10-vllm`, `onexplayer-lemonade`, `mac-mlx-vllm`
  - expected normal capacity total: `9`
  - expected long slot total: `4`
  - required setup/blocker checks: token presence without printing value, executable Edge binary or `go`, current script on runner, endpoint reachability, provider health.

### 테스트 커버리지 공백

- shell script exit contract is covered only by deterministic local mock commands, not a checked-in unit test.
- live provider pool behavior cannot be replaced by unit tests; SDD S09 requires live smoke output and recovery snapshots.
- runner `go` absence is not a product decision; make config check runnable through a prebuilt Edge binary path.

### 심볼 참조

- renamed/removed symbol: none.

### 분할 판단

- 기존 split task `06+01,02,03,04,05_capacity_smoke`의 review follow-up이다.
- 새 subtask로 분리하지 않는다. 남은 Required issue가 하나의 evidence recovery path이며, script config-check runner 보정과 live smoke rerun은 같은 S09 completion evidence를 닫는 단일 단위다.

### 범위 결정 근거

- Edge admission algorithm, scheduler, Control Plane status view 확장은 범위 제외다.
- dev runtime config 정책 영속화와 SDD 갱신은 범위 제외다.
- token 원문을 tracked 파일이나 review output에 남기지 않는다.
- live evidence를 만들기 위한 runner temp copy는 허용하지만 repo-local 임시 verification tool은 만들지 않는다.

### 빌드 등급

- `cloud-G08`: shell/CLI workflow, remote runner preflight, secret-safe live provider pool smoke, long-running external runtime evidence가 중심이다.

## 구현 체크리스트

- [ ] `scripts/e2e-long-context-admission-smoke.sh`가 `go run`이 없는 runner에서도 prebuilt Edge binary로 `config check`를 실행할 수 있게 보강한다.
- [ ] `agent-test/dev/long-context-admission-smoke.md`에 prebuilt Edge binary override와 runner temp-copy evidence 흐름을 문서화한다.
- [ ] local quick check와 deterministic local mock regression을 다시 실행해 script exit contract가 유지되는지 검증한다.
- [ ] runner preflight를 수행하고 token presence, source/script availability, Edge binary/config check, endpoint reachability, provider health/capacity를 실제 stdout/stderr로 기록한다.
- [ ] live dev provider pool에서 preflight와 `normal-10`, `mixed`, `all-long-slot-full`을 실행하고 actual stdout/stderr 또는 exact output file/status snapshot/Edge log evidence를 review stub에 기록한다.
- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.

## [REVIEW_REVIEW_CAPACITY_SMOKE-1] Runner config-check path

### 문제

- `scripts/e2e-long-context-admission-smoke.sh:335` always runs `go run ./apps/edge/cmd/edge config check`, but `code_review_cloud_G08_1.log:101` through `:104` records that the dev runner has no `go`.
- Without an alternate config-check path, live preflight cannot pass on the documented runner even when the built Edge binary exists.

### 해결 방법

- Add an environment override such as `IOP_LONG_SMOKE_EDGE_BIN`.
- If it is set, run `"$IOP_LONG_SMOKE_EDGE_BIN" config check --config "$CONFIG"` from `REPO_ROOT`.
- Otherwise keep the current `go run ./apps/edge/cmd/edge config check --config "$CONFIG"` behavior.
- Record the exact command in preflight output without printing any token.

### 수정 파일 및 체크리스트

- [ ] `scripts/e2e-long-context-admission-smoke.sh`

### 테스트 작성

- 새 repo test file은 만들지 않는다. This is a shell smoke path; regression is verified with syntax check, local config check, and mock smoke commands.

### 중간 검증

```bash
bash -n scripts/e2e-long-context-admission-smoke.sh
go run ./apps/edge/cmd/edge config check --config configs/edge.yaml
```

## [REVIEW_REVIEW_CAPACITY_SMOKE-2] Dev smoke doc update

### 문제

- `agent-test/dev/long-context-admission-smoke.md` documents the smoke commands but not the runner path needed when the script is copied to `/tmp` and config check uses a prebuilt Edge binary.

### 해결 방법

- Document `IOP_LONG_SMOKE_REPO` and the new Edge binary override.
- Document that local uncommitted/untracked script changes must be copied to the runner temp path or otherwise synced before using the output as current-change evidence.

### 수정 파일 및 체크리스트

- [ ] `agent-test/dev/long-context-admission-smoke.md`

### 테스트 작성

- 문서 변경이므로 별도 테스트 파일은 만들지 않는다.

### 중간 검증

```bash
rg --sort path -n "IOP_LONG_SMOKE_(REPO|EDGE_BIN)|long-context-admission" agent-test/dev/long-context-admission-smoke.md
```

## [REVIEW_REVIEW_CAPACITY_SMOKE-3] Trusted S09 live evidence rerun

### 문제

- `code_review_cloud_G08_1.log:70` and `:77` leave the S09 live evidence items unchecked.
- `code_review_cloud_G08_1.log:241` through `:279` records blocker output instead of live scenario execution output.

### 해결 방법

- Copy the current smoke script to the runner temp path or otherwise sync it to `/Users/toki/agent-work/iop-dev`.
- Verify token presence without printing the value.
- Run preflight with runner-local base URL and status URL, using `IOP_LONG_SMOKE_REPO` and the Edge binary override when `go` is absent.
- Run `normal-10`, `mixed`, and `all-long-slot-full`.
- Record actual stdout/stderr or exact saved output paths. Include final status snapshot paths and Edge dispatch log path/snippets showing `context_class` and `queue_reason="long_context_capacity_full"` when long fields are absent from Control Plane status.

### 수정 파일 및 체크리스트

- [ ] `agent-task/m-model-group-long-context-admission/06+01,02,03,04,05_capacity_smoke/CODE_REVIEW-cloud-G08.md`

### 테스트 작성

- No additional test file. The live smoke output is the required S09 evidence.

### 중간 검증

```bash
ssh toki@toki-labs.com 'cd /Users/toki/agent-work/iop-dev && git rev-parse HEAD && git status --short && test -x build/dev-runtime/bin/edge && build/dev-runtime/bin/edge config check --config build/dev-runtime/edge.yaml && test -n "${IOP_LONG_SMOKE_TOKEN:-}" && curl -fsS --connect-timeout 8 -o /dev/null -w "models_http=%{http_code}\n" -H "Authorization: Bearer ${IOP_LONG_SMOKE_TOKEN}" http://127.0.0.1:18083/v1/models'
```

## 수정 파일 요약

| 파일 | 항목 |
|------|------|
| `scripts/e2e-long-context-admission-smoke.sh` | REVIEW_REVIEW_CAPACITY_SMOKE-1 |
| `agent-test/dev/long-context-admission-smoke.md` | REVIEW_REVIEW_CAPACITY_SMOKE-2 |
| `agent-task/m-model-group-long-context-admission/06+01,02,03,04,05_capacity_smoke/CODE_REVIEW-cloud-G08.md` | REVIEW_REVIEW_CAPACITY_SMOKE-3 |

## 최종 검증

```bash
git rev-parse HEAD
git status --short
go run ./apps/edge/cmd/edge config check --config configs/edge.yaml
bash -n scripts/e2e-long-context-admission-smoke.sh
```

Run the deterministic local mock regression from `plan_cloud_G08_1.log` again and record the actual output. Expected: bad config preflight exits non-zero, and all-long-slot-full with HTTP 500 plus zero peaks exits non-zero.

Then run the live dev evidence commands without printing token values:

```bash
ssh toki@toki-labs.com 'mkdir -p /tmp/iop-long-admission-smoke-runner'
scp scripts/e2e-long-context-admission-smoke.sh toki@toki-labs.com:/tmp/iop-long-admission-smoke-runner/e2e-long-context-admission-smoke.sh
ssh toki@toki-labs.com 'chmod +x /tmp/iop-long-admission-smoke-runner/e2e-long-context-admission-smoke.sh'
ssh toki@toki-labs.com 'cd /Users/toki/agent-work/iop-dev && test -n "${IOP_LONG_SMOKE_TOKEN:-}" && IOP_LONG_SMOKE_REPO=/Users/toki/agent-work/iop-dev IOP_LONG_SMOKE_EDGE_BIN=/Users/toki/agent-work/iop-dev/build/dev-runtime/bin/edge IOP_LONG_SMOKE_BASE_URL=http://127.0.0.1:18083/v1 IOP_LONG_SMOKE_LONG_CHARS=384000 bash /tmp/iop-long-admission-smoke-runner/e2e-long-context-admission-smoke.sh --preflight --config build/dev-runtime/edge.yaml --out-dir /tmp/iop-long-admission-smoke'
ssh toki@toki-labs.com 'cd /Users/toki/agent-work/iop-dev && test -n "${IOP_LONG_SMOKE_TOKEN:-}" && IOP_LONG_SMOKE_REPO=/Users/toki/agent-work/iop-dev IOP_LONG_SMOKE_EDGE_BIN=/Users/toki/agent-work/iop-dev/build/dev-runtime/bin/edge IOP_LONG_SMOKE_BASE_URL=http://127.0.0.1:18083/v1 IOP_LONG_SMOKE_LONG_CHARS=384000 bash /tmp/iop-long-admission-smoke-runner/e2e-long-context-admission-smoke.sh --scenario normal-10 --config build/dev-runtime/edge.yaml --out-dir /tmp/iop-long-admission-smoke'
ssh toki@toki-labs.com 'cd /Users/toki/agent-work/iop-dev && test -n "${IOP_LONG_SMOKE_TOKEN:-}" && IOP_LONG_SMOKE_REPO=/Users/toki/agent-work/iop-dev IOP_LONG_SMOKE_EDGE_BIN=/Users/toki/agent-work/iop-dev/build/dev-runtime/bin/edge IOP_LONG_SMOKE_BASE_URL=http://127.0.0.1:18083/v1 IOP_LONG_SMOKE_LONG_CHARS=384000 bash /tmp/iop-long-admission-smoke-runner/e2e-long-context-admission-smoke.sh --scenario mixed --config build/dev-runtime/edge.yaml --out-dir /tmp/iop-long-admission-smoke'
ssh toki@toki-labs.com 'cd /Users/toki/agent-work/iop-dev && test -n "${IOP_LONG_SMOKE_TOKEN:-}" && IOP_LONG_SMOKE_REPO=/Users/toki/agent-work/iop-dev IOP_LONG_SMOKE_EDGE_BIN=/Users/toki/agent-work/iop-dev/build/dev-runtime/bin/edge IOP_LONG_SMOKE_BASE_URL=http://127.0.0.1:18083/v1 IOP_LONG_SMOKE_LONG_CHARS=384000 bash /tmp/iop-long-admission-smoke-runner/e2e-long-context-admission-smoke.sh --scenario all-long-slot-full --config build/dev-runtime/edge.yaml --out-dir /tmp/iop-long-admission-smoke'
```

Expected: all local checks pass; local mock failure cases return non-zero; live preflight and three scenarios return `0`; review stub includes actual stdout/stderr or exact saved output paths, final status snapshots, and Edge log evidence for long classification/queue reason.

모든 코드 변경 완료 후 반드시 `CODE_REVIEW-*-G??.md`의 구현 에이전트 소유 섹션을 채운다. 이 파일 작성이 구현의 마지막 단계다.
