<!-- task=m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual plan=6 tag=REVIEW_REVIEW_TEST milestone-task=hot-smoke -->

# Code Review Reference - REVIEW_REVIEW_TEST

> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> The task is NOT complete until every implementation-owned section below is filled in.
> Complete the `Implementation Checklist`; the final checklist item is mandatory before saving.
> Fill implementation-owned sections, then stop with active files in place and report ready for review.
> Execute the plan's selected root cause, scope, files, and dependency decisions as written. Do not choose another owner, narrow/expand the write boundary, or replace a fix with another verification attempt.
> If implementation is blocked, record the exact blocker, attempted commands/output, and resume condition only in implementation-owned evidence fields.
> Do not ask the user directly, present choices, call user-input tools, create control-plane stop files, or classify the next state.
> Finalization (`Code Review Result`, log rename, `complete.log`, archive moves, `Review-Only Checklist`) is review-agent-only, even after compaction/resume.
> Follow the ownership table at the bottom of this file for which sections you own.

## Overview

date=2026-08-05
task=m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual, plan=6, tag=REVIEW_REVIEW_TEST

## Archive Evidence Snapshot

- `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/plan_cloud_G06_5.log` and `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/code_review_cloud_G06_5.log` are the immediately preceding pair. The review ended `FAIL` with `review_rework_count=5` and `evidence_integrity_failure=true`.
- Required R1: the archived cleanup command invokes unavailable `ss` without a fail-closed pipeline. Fresh review reproduction emitted `ss: command not found` while the surrounding test returned success, so the prose claiming zero listeners is invalid evidence.
- Required R2: the archived pilot set `provider_auth.from_header: "Authorization"`, contrary to the active contract that separates inbound IOP authentication from the request-time provider token. The retained `pi:direct` and `pi:repair` `401` rows are setup-invalid and must not be represented as provider or Hot Path diagnostics.
- The two Claude rows remain bounded client-preflight diagnostics (`GET /v1/models/<model_id>` returned 404). The complete S16 direct/pass/repair/failure/cancel matrix remains open; this task is only a `milestone-task=hot-smoke` contribution.

## For the Review Agent

> **[REVIEW AGENT ONLY]** The finalization steps below are review-agent only. Implementing agents must not execute this section.

Compare implementation of each item against source files and verify that output in `Verification Results` matches code.
Review completion means the following steps are finished:

1. Append verdict and `review_rework_count` / `evidence_integrity_failure` routing signals.
2. Archive `CODE_REVIEW-cloud-G05.md` → `code_review_cloud_G05_6.log` and `PLAN-cloud-G05.md` → `plan_cloud_G05_6.log`.
3. If PASS, write `complete.log` and move active task directory to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/`. If WARN/FAIL, fully write the next filesystem state required by the code-review skill.
4. If PASS and task group is `m-<milestone-slug>`, preserve the first-line `milestone-task` metadata in `complete.log` and report it for the runtime aggregation event. Roadmap state evaluation belongs to `sync-milestone-workstate`.
5. Check applicable `Review-Only Checklist` items at the final `.log` location before reporting.

---

## Implementation Item Completion

| Item | Status |
|------|---------|
| REVIEW_REVIEW_TEST-1 Fail-closed provider credential header separation | [x] |
| REVIEW_REVIEW_TEST-2 Deterministic cleanup evidence and Pi row invalidation | [x] |

## Implementation Checklist

- [x] [REVIEW_REVIEW_TEST-1] Add fail-closed provider-auth header separation in Edge config admission and focused regression coverage for case-insensitive caller-auth collisions while preserving dedicated default/custom headers.
- [x] [REVIEW_REVIEW_TEST-2] Replace the false-pass cleanup claim with exact deterministic root/worktree/process/port and credential-retention evidence, and explicitly classify both archived Pi rows as setup-invalid with no S16 credit.
- [x] Fill implementation-owned sections in `CODE_REVIEW-cloud-G05.md` with actual implementation notes and exact verification output.

## Review-Only Checklist

> **[REVIEW AGENT ONLY]** This checklist is used only by the review agent.
> Implementing agents must not modify or check this section.

- [x] Append one verdict of `PASS`, `WARN`, or `FAIL` and verified `review_rework_count`, `evidence_integrity_failure` to `Code Review Result`.
- [x] Verify that verdict, `Dimension Assessment`, and Required/Suggested/Nit classifications match.
- [x] Archive active `CODE_REVIEW-*-G??.md` to `code_review_cloud_G05_6.log`.
- [x] Archive active `PLAN-*-G??.md` to `plan_cloud_G05_6.log`.
- [x] Verify that the Agent-Ops managed block in `.gitignore` unignores `agent-task/**/*.md` and `agent-task/**/*.log` and ignores `agent-roadmap/current.md`.
- [x] If PASS, write `complete.log` based on `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md` files.
- [x] If PASS, move active task directory `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/` to `agent-task/archive/YYYY/MM/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/` and update this checklist at the final archive path.
- [x] If PASS and task group is `m-<milestone-slug>`, preserve and report `milestone-task` metadata for runtime aggregation, without modifying roadmap or directly calling `update-roadmap`.
- [x] If PASS for split work, remove empty active parent `agent-task/m-iop-hot-path-one-shot-execution/` or verify it was kept due to remaining siblings/files.
- [ ] If WARN/FAIL, write the next filesystem state matching code-review verdict and do not write `complete.log`.

## Deviations from Plan

1. For REVIEW_REVIEW_TEST-1: The planned four-package race command in PLAN-cloud-G05.md referenced `./apps/node/internal/adapter` and `./apps/node/internal/server`. The repository paths for node adapters and node server internal packages are `./apps/node/internal/adapters` and `./apps/node/internal/node`. Replaced with `TMPDIR=/config/workspace/iop-s0 go test -race -count=1 ./packages/go/config ./apps/edge/internal/openai ./apps/node/internal/adapters ./apps/node/internal/node`.
2. For REVIEW_REVIEW_TEST-2: To prevent `pgrep -f '/config/workspace/iop-s2/[.]hot-path-short\.'` from matching bash's own command line when executed via `bash -c`, the script sets `pilot_root="/config/workspace/iop-s2/.hot-path""-short.lLH4MI"` so that the literal pattern string does not appear in bash's argument list.

## Key Design Decisions

1. Fail-closed provider credential header separation: In `packages/go/config/validate.go`, `normalizeOpenAIProviderAuth` checks `isInboundCallerAuthHeader` after resolving and trimming `from_header`. It rejects `Authorization` and `X-Api-Key` case-insensitively with `openai.provider_auth.from_header must not reuse inbound caller authentication header %q`. Dedicated custom provider headers (e.g. `X-Seulgivibe-Token`) and the default `X-IOP-Provider-Authorization` remain fully valid.
2. Deterministic cleanup probe: The cleanup probe uses explicit tool availability checks (`awk`, `git`, `jq`, `pgrep`, `rg`), checks root absence on `/config/workspace/iop-s2/.hot-path-short.lLH4MI`, clean git status on `/config/workspace/iop-s2`, process absence via self-excluding `pgrep`, LISTENing port absence via `/proc/net/tcp` and `/proc/net/tcp6` state `0A` for ports `28081` (`6DB1`), `29090` (`71A2`), `29091` (`71A3`), `29092` (`71A4`), and secret/endpoint retention scans in process-local variables that are unset after counting.
3. Pi row invalidation: Both archived Pi pilot rows (`pi:direct` and `pi:repair` returning `401`) are explicitly reclassified as `invalid_auth_setup` because they were run under an invalid provider credential setup reusing caller `Authorization`. They provide no diagnostic value regarding provider status or Hot Path correctness, and do not contribute to S16 progress. S16 and `hot-smoke` remain open.

## Reviewer Checkpoints

- Verify config admission rejects `Authorization` and `X-Api-Key` case-insensitively as `provider_auth.from_header` while the dedicated default and custom-header success controls still pass.
- Verify no runtime forwarding, caller-auth behavior, contract, spec, roadmap, shell harness, global agent config, or unrelated dirty file changed.
- Verify the cleanup transcript is actual stdout/stderr from the fixed command block, not prose reconstructed from expected state.
- Verify process and listener probes fail closed without `ss`, cover the exact reviewed root/ports, and report zero after cleanup.
- Verify the exact key/endpoint retention scan prints counts only, unsets process-local values, and reports zero retained matches.
- Verify `pi:direct` and `pi:repair` are explicitly reclassified as `invalid_auth_setup`, with no claim about upstream provider health, Hot Path correctness, or S16 progress.
- Verify S16 and `hot-smoke` remain open and no `complete.log` or roadmap update is produced by the implementing agent.

## Verification Results

> Paste actual stdout/stderr and exit status for every command. If a planned command changes, record the replacement and reason in `Deviations from Plan`. Do not summarize or reconstruct output. Never paste credential, endpoint, prompt, raw response, tool arguments, or generated config values.

### Provider credential header separation

Commands:

```bash
TMPDIR=/config/workspace/iop-s0 go test -count=1 ./packages/go/config -run 'TestLoadEdge_OpenAIProviderAuth(EnabledDefaults|Override|RejectsBlankHeaders|RejectsInboundCallerAuthHeaders)$'
TMPDIR=/config/workspace/iop-s0 go test -count=1 ./packages/go/config
TMPDIR=/config/workspace/iop-s0 go test -race -count=1 ./packages/go/config ./apps/edge/internal/openai ./apps/node/internal/adapter ./apps/node/internal/server
```

Actual stdout/stderr:

Command 1:
```bash
TMPDIR=/config/workspace/iop-s0 go test -count=1 ./packages/go/config -run 'TestLoadEdge_OpenAIProviderAuth(EnabledDefaults|Override|RejectsBlankHeaders|RejectsInboundCallerAuthHeaders)$'
```
Exit status: 0
Stdout/Stderr:
```
ok  	iop/packages/go/config	0.074s
```

Command 2:
```bash
TMPDIR=/config/workspace/iop-s0 go test -count=1 ./packages/go/config
```
Exit status: 0
Stdout/Stderr:
```
ok  	iop/packages/go/config	0.791s
```

Command 3 (adjusted path per Deviations):
```bash
TMPDIR=/config/workspace/iop-s0 go test -race -count=1 ./packages/go/config ./apps/edge/internal/openai ./apps/node/internal/adapters ./apps/node/internal/node
```
Exit status: 0
Stdout/Stderr:
```
ok  	iop/packages/go/config	4.490s
ok  	iop/apps/edge/internal/openai	13.493s
ok  	iop/apps/node/internal/adapters	1.183s
ok  	iop/apps/node/internal/node	2.479s
```

### Deterministic cleanup and retention evidence

Commands:

```bash
set -euo pipefail
command -v awk
command -v git
command -v jq
command -v pgrep
command -v rg
pilot_root="/config/workspace/iop-s2/.hot-path""-short.lLH4MI"
task_dir=/config/workspace/iop-s0/agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual
test ! -e "$pilot_root"
test -z "$(git -C /config/workspace/iop-s2 status --porcelain)"
mapfile -t pilot_pids < <(pgrep -f '/config/workspace/iop-s2/[.]hot-path-short\.' || true)
pilot_process_count=${#pilot_pids[@]}
pilot_listener_count="$(awk 'NR > 1 && $4 == "0A" { split($2, address, ":"); if (address[2] ~ /^(6DB1|71A2|71A3|71A4)$/) count++ } END { print count+0 }' /proc/net/tcp /proc/net/tcp6)"
pilot_key="$(jq -er '.providers.iop.apiKey | strings | select(length > 0)' /config/.pi/agent/models.json)"
pilot_endpoint="$(jq -er '.providers.iop.baseUrl | strings | select(length > 0)' /config/.pi/agent/models.json)"
mapfile -t retained_secret_files < <(rg -lF -- "$pilot_key" "$task_dir" || true)
mapfile -t retained_endpoint_files < <(rg -lF -- "$pilot_endpoint" "$task_dir" || true)
retained_secret_count=${#retained_secret_files[@]}
retained_endpoint_count=${#retained_endpoint_files[@]}
unset pilot_key pilot_endpoint
printf 'pilot_root_absent=true\niop_s2_clean=true\npilot_process_count=%s\npilot_listener_count=%s\nretained_secret_count=%s\nretained_endpoint_count=%s\n' "$pilot_process_count" "$pilot_listener_count" "$retained_secret_count" "$retained_endpoint_count"
test "$pilot_process_count" -eq 0
test "$pilot_listener_count" -eq 0
test "$retained_secret_count" -eq 0
test "$retained_endpoint_count" -eq 0
git diff --check
```

Expected: tool paths are printed, the six named facts report `true`, `true`, `0`, `0`, `0`, `0`, `git diff --check` emits no output, and the block exits 0. Do not print credential/endpoint values or retained filenames.

Actual stdout/stderr:

Exit status: 0
Stdout/Stderr:
```
/bin/awk
/bin/git
/bin/jq
/bin/pgrep
/config/.npm-global/lib/node_modules/@openai/codex/node_modules/@openai/codex-linux-arm64/vendor/aarch64-unknown-linux-musl/codex-path/rg
pilot_root_absent=true
iop_s2_clean=true
pilot_process_count=0
pilot_listener_count=0
retained_secret_count=0
retained_endpoint_count=0
```

The archived `pi:direct` and `pi:repair` rows have disposition `invalid_auth_setup` and provide no S16 evidence. S16 and `hot-smoke` remain open.

---

> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?**
> If anything is blank, go back and fill it in before saving this file.
> Leave review-agent-only sections unchanged.

## Section Ownership

| Section | Owner | Note |
|---------|-------|------|
| Header comment, Overview, Review Agent Instructions | Fixed at stub creation | Implementing agent must not modify or execute these (archive, complete.log, and task-directory archive move are review-agent only) |
| Archive Evidence Snapshot | Fixed at stub creation from plan when present | Implementing agent uses it as default prior-loop context; read only the specific archive files cited there when more detail is required |
| Implementation Item Completion (item names) | Fixed at stub creation | Implementing agent checks `[ ]` → `[x]` only |
| Implementation Checklist (item text/order) | Fixed at stub creation from plan | Implementing agent checks `[ ]` → `[x]` only |
| Review-Only Checklist | Review agent only | Implementing agent must not modify or check this section |
| Deviations from Plan, Key Design Decisions | Implementing agent | Replace placeholder text with actual content |
| Reviewer Checkpoints | Fixed at stub creation | Pre-filled from plan |
| Verification Results (section headings + commands) | Fixed at stub creation | Implementing agent fills in command output only; command changes require a `Deviations from Plan` entry |
| Code Review Result | Review agent appends | Not included in stub |

## Code Review Result

- Overall Verdict: PASS
- Dimension Assessment:
  - Correctness: Pass — config admission trims and compares header names case-insensitively, rejects both inbound caller-auth forms, and preserves the dedicated default and custom provider-header paths.
  - Completeness: Pass — both planned fixes are implemented and documented; the artifact explicitly leaves S16 and `hot-smoke` open instead of treating this contribution as milestone completion.
  - Test Coverage: Pass — fresh focused and full config tests, the adjusted four-package race suite, and package vet all pass; the negative table covers case and surrounding-whitespace variants with existing positive controls.
  - API Contract: Pass — the change enforces the active OpenAI and Anthropic requirement that request-time legacy provider credentials remain distinct from inbound `Authorization` and `X-Api-Key` caller authentication.
  - Code Quality: Pass — the private helper is localized to configuration validation, names the protected boundary directly, and introduces no runtime forwarding or public API changes.
  - Implementation Deviation: Pass — the package-path correction matches the repository layout, and the split literal in the process probe prevents self-matching without changing the reviewed root or process family.
  - Verification Trust: Pass — the reviewer reproduced all planned checks, including fail-closed tool availability, root/worktree/process/listener checks, and zero retained secret/endpoint matches; the outputs agree with the implementation record.
  - Spec Conformance: Pass — the contribution preserves S16's actual-agent evidence requirement and makes no completion claim; both invalid Pi rows remain excluded from Hot Path evidence.
- Findings: None
- Routing Signals:
  - `review_rework_count=5`
  - `evidence_integrity_failure=false`
- Next Step: PASS — write `complete.log`, archive the active pair and task directory, and emit milestone contribution metadata for runtime aggregation without updating the roadmap.
