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

# Bind actual Hot Path smoke to current runtime evidence

## For the Implementing Agent

Implement Required R1-R3 exactly within the write boundary below. Run every listed verification command, fill the implementation-owned sections of `CODE_REVIEW-cloud-G07.md` with actual notes and stdout/stderr, keep the active pair in place, and report ready for review. If external verification remains blocked, record the exact attempted command, non-secret presence facts, output, and resume condition only in the review evidence. Do not ask the user, call user-input tools, create control-plane stop files, classify the next state, archive logs, or write `complete.log`; finalization belongs to the code-review skill.

## Background

The previous loop added isolated Make targets around the child-20 harness, but fresh review proved that the harness can accept unrelated CLI backends and stale prebuilt observations while still producing a structurally valid manifest. SDD S16 requires current IOP Hot Path runtime/source identity, actual Claude/Pi execution, and observations produced by that same run. This follow-up closes those evidence-integrity gaps before another external attempt.

## Archive Evidence Snapshot

- `plan_local_G07_1.log` and `code_review_cloud_G07_1.log` closed the prior pair with `FAIL`: Required R1 covers missing IOP runtime/profile binding, R2 covers stale prebuilt observation reuse, and R3 covers absent actual execution plus contradicted inventory/exit evidence.
- Fresh reviewer checks passed `make test-hot-path-agent-smoke-self-test`, the four-package `go test -race -count=1` regression, and `git diff --check`; an empty direct harness preflight exits 69, while GNU Make reports its failed recipe with process status 2 and `Error 69` in stderr.
- `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/20+17,19_smoke_harness/complete.log` proves the fake-agent harness baseline only; fresh source inspection supersedes its assumption that the same inputs prove an actual IOP runtime.
- Roadmap carryover remains `milestone-task=hot-smoke`, approved SDD scenario S16 and its actual Claude/Pi final-evidence row. No Milestone completion is claimed.

## Finding Resolution Map

| Finding | Mode | Exact fix/evidence | Changed precondition |
|---|---|---|---|
| Required R1 | direct-fix | Update `Makefile` and `scripts/e2e-hot-path-agents.sh` to bind both CLIs to an explicit IOP base/profile and scenario preset aliases, and validate current source plus Edge binary/config/fixture/runner identity before invocation. | A successful preflight proves the selected CLIs and preset aliases target the supplied matching IOP runtime rather than arbitrary host defaults. |
| Required R2 | direct-fix | Update `scripts/e2e-hot-path-agents.sh` so each case captures only observation records appended by the selected runtime after that case starts; add stale-observation and mixed-request rejection controls to the self-test. | A manifest can no longer reuse the deterministic ten-file fixture from an earlier or fake run. |
| Required R3 | direct-fix | Update `Makefile` status documentation and fill `CODE_REVIEW-cloud-G07.md` with fresh direct-harness/Make status, current presence-only inventory facts, and the actual run or exact remaining blocker after R1/R2. | Verification evidence matches the commands that actually ran and is collected only after the evidence-producing path is trustworthy. |

## Analysis

### Files Read

- `agent-roadmap/phase/knowledge-tool-optimization-extension/milestones/iop-hot-path-one-shot-execution.md`
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `agent-spec/runtime/stream-evidence-gate.md`
- `Makefile`
- `scripts/e2e-hot-path-agents.sh`
- `scripts/fixtures/hot-path-agent-smoke-manifest.schema.json`
- `apps/edge/internal/openai/hot_path_observation.go`
- `agent-test/local/rules.md`
- `agent-test/local/testing-smoke.md`
- `agent-test/inventory-agent.yaml`
- `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/plan_local_G07_0.log`
- `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/code_review_cloud_G07_0.log`
- `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/plan_local_G07_1.log`
- `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/code_review_cloud_G07_1.log`
- `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/20+17,19_smoke_harness/complete.log`

### SDD Criteria

- SDD: `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`, status `[승인됨]`, lock released.
- First-line scope: `milestone-task=hot-smoke`.
- Target scenario: S16 — actual Claude and Pi agents must exercise direct, pass, repair, write failure, and cancellation against writable test workspaces and reproduce visible protocol output, artifact lifecycle, and standard terminals.
- Evidence Map: S16 requires actual Claude/Pi streaming logs plus workspace before/after evidence. The common row also requires the four-package race regression and `git diff --check`.
- The checklist therefore first makes runtime and observation evidence trustworthy, then repeats the actual matrix; fake self-test output alone cannot close the task.

### Verification Context

- Supplied handoff: the archived plan/review pair and its raw FAIL findings/output.
- Repository-native fallback: current Make recipes, the full harness and manifest fixture, production `hot_path_observation` zap fields, testing rules, and current agent inventory.
- Current checkout preflight: repo root `/config/workspace/iop-s0`; branch `feature/iop-hot-path-one-shot-execution`; HEAD `703f3b723202959185c04bb32c2c68383b8d04a0`; shared worktree is dirty and the smoke evidence must fingerprint the exact worktree inputs rather than assume HEAD-only identity.
- Toolchain: `/config/.local/bin/go`, Go 1.26.2 on Linux/aarch64; Claude 2.1.221 and Pi 0.81.1 binaries are executable. The current Pi config files exist with mode 0600.
- Fresh local evidence: self-test, four-package race regression, and diff check passed. Empty direct harness preflight returned 69; the same path through GNU Make returned 2 and printed the child `Error 69`.
- Current external gap: the session has no supplied Hot Path base URL, scenario aliases, runtime evidence, observation log path, disposable workspace/output path, or named secret env inputs. Current inventory records Claude and Pi as configured/authenticated, so the prior `not_configured` claim is stale; profile status alone does not prove binding to this checkout's IOP runtime.
- Confidence: high for R1-R3 because each is directly visible in the recipe/harness control flow and fresh command output.

#### External Verification Preflight

- Runner/workdir: current Linux/aarch64 host, `/config/workspace/iop-s0`; do not route through dispatcher or another task runner.
- Source sync: use a deterministic fingerprint over tracked and untracked worktree inputs under `apps/edge`, `packages/go/streamgate`, `packages/go/config`, `scripts/e2e-hot-path-agents.sh`, the manifest schema, `go.mod`, and `go.sum`. Compare it to the runtime evidence before agent invocation.
- Runtime identity: require caller-supplied Edge binary and config paths, their SHA-256 values, fixture revision, Claude/Pi binary hashes, Pi config digest, base/profile identity, and the four scenario aliases. Compare values without printing endpoints, config content, or credentials.
- Observation transport: use the caller-supplied current Edge log file containing JSON `hot_path_observation` records. Record the byte offset before each case, consume only newly appended closed projections after invocation, and reject rotation/truncation, no record, multiple request lifecycles, or unrelated request mixing.
- Authorization: accept only secret env-var names and presence-check the named values; never serialize or echo the values. Current session has no such names supplied.
- Ports/process/external host: not checked because no base URL or runtime identity was supplied. Preflight must presence-check and bind them before any CLI invocation; do not print the private endpoint.
- Setup/resume: after implementation, supply the complete non-secret paths/aliases and named secret envs, start or select the matching isolated Edge runtime, then run Make preflight followed by the matrix. If any item is unavailable, capture exit 69 from the direct harness and Make's status separately.

### Test Coverage Gaps

- Existing self-test covers fake argv, fixed 2x5 schema, terminal/cancellation, workspace cleanup, redaction, and CLI-binary/source-script hash mismatch.
- It does not cover explicit IOP base/profile binding, scenario alias selection, Edge binary/config/worktree identity, stale observation reuse, log rotation/truncation, concurrent unrelated observation records, or GNU Make's status mapping.
- Add deterministic fake-runtime/self-test controls for every repository-fixable gap. Actual external S16 remains a separate credentialed verification and cannot be replaced by those controls.

### Symbol References

- `validate_observation_set`: current call sites are `do_run` and `do_preflight`; replace pre-run ten-file validation with observation-log readability/identity preflight and per-case appended-record validation.
- `load_observation_evidence`: current call site is `run_case`; replace it with a post-invocation reader bounded by the case's captured log offset.
- `OBSERVATION_DIR`: current references are usage/parse/presence validation, manifest digest, persisted-artifact scan, and self-test fixtures; migrate them coherently to the observation-file contract.
- `CLAUDE_PROVIDER` is parsed and assigned in `run_case` but never affects Claude argv/environment. Replace it with explicit base/profile/model binding.
- `PI_MODEL` currently has one global value; replace its selection with the scenario alias map while keeping provider selection explicit.

### Split Judgment

Keep one plan. Runtime/profile binding and fresh observation capture form one evidence-trust invariant: external execution is meaningless until both are enforced, while neither sub-change can independently satisfy S16.

### Scope Rationale

- Modify only the Make integration, harness/self-test, and active review evidence.
- Reuse the existing production `hot_path_observation` JSON log fields; do not change Edge handlers, observation schema, API contracts, or the manifest's secret-safe closed output unless implementation proves an unavoidable compatibility issue and records a deviation.
- Do not create/read credential values, patch Claude/Pi installation or host profiles, deploy/restart shared runtime processes, or track smoke outputs.
- Do not treat configured inventory status as actual-run evidence.

### Final Routing

- `evaluation_mode=isolated-reassessment`; finalizer=`finalize-task-policy.sh pair`.
- Build closures: scope/context/verification/evidence/ownership/decision all true; capability gap none. Scores `2/1/0/2/2` => G07, base `local-fit`; `large_indivisible_context=false`; positive risks `temporal_state,boundary_contract,variant_product` (3); `review_rework_count=1`, `evidence_integrity_failure=true`; recovery boundary => `PLAN-cloud-G07.md`.
- Review closures: all true; scores `2/1/0/2/2` => G07, `official-review` => `CODE_REVIEW-cloud-G07.md`.

## Implementation Checklist

- [ ] [REVIEW_TEST-1] Bind the Make/harness contract to the exact IOP base/profile, four scenario preset aliases, current worktree fingerprint, and Edge/config/fixture/CLI identity; reject every mismatch before invoking an agent and cover the contract in the self-test.
- [ ] [REVIEW_TEST-2] Replace prebuilt observation-directory acceptance with per-case fresh appended runtime-log capture, reject stale/rotated/mixed lifecycle evidence, and retain the closed redacted manifest/workspace/terminal assertions.
- [ ] [REVIEW_TEST-3] Run fresh local checks and the explicit external preflight/matrix; record direct harness versus GNU Make exit semantics and current presence-only environment facts accurately, or the exact remaining external blocker without claiming S16 completion.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [REVIEW_TEST-1] Bind the selected IOP runtime and preset aliases

**Problem:** `Makefile:118-166` forwards only CLI/script evidence inputs, and `scripts/e2e-hot-path-agents.sh:266-275` validates only Claude/Pi binary hashes. At `scripts/e2e-hot-path-agents.sh:540-553`, the Claude provider value is unused and Pi receives one default model, so a structurally valid run need not reach the intended IOP runtime or scenario preset.

**Solution:** Replace the approximate interface with required base/profile, direct/pass/repair/slow alias, Edge binary/config, Pi config, source fingerprint, fixture revision, and runner inputs. Map scenarios deterministically (`direct`, `light-pass`, `repair`, `write-unavailable`, `timeout-cancel`) to the declared aliases for both CLIs; bind Claude through its supported base/model environment/argv and Pi through the supplied config directory/provider/model. Validate hashes and non-secret identity fields before invocation and never print endpoint/config/secret values.

Before (`Makefile:118-132`):

```make
#   IOP_HOT_SMOKE_RUNTIME_EVIDENCE   runtime identity evidence JSON (claude/pi binary digests)
#   IOP_HOT_SMOKE_OBSERVATION_DIR    dir holding the ten redacted observation files
# Optional variables:
#   IOP_HOT_SMOKE_PI_MODEL           pi model label
```

After:

```make
# Required caller inputs include base/profile, direct/pass/repair/slow aliases,
# Edge binary/config, Pi config dir, current source/runtime evidence, one live
# observation log, disposable workspace/output, and secret env-var names.
```

Before (`scripts/e2e-hot-path-agents.sh:266-275`):

```bash
assert_digest_matches "$actual_claude" "$RUNTIME_EVIDENCE" "claude_binary_sha256"
assert_digest_matches "$actual_pi" "$RUNTIME_EVIDENCE" "pi_binary_sha256"
```

After:

```bash
validate_worktree_fingerprint
validate_edge_binary_config_fixture_identity
validate_runner_and_profile_identity
model=$(scenario_model_alias "$scenario")
```

**Modified Files and Checklist:**

- [ ] Modify `Makefile` with the exact required variables and identical preflight/run forwarding.
- [ ] Modify `scripts/e2e-hot-path-agents.sh` with fail-closed binding/identity validation and scenario alias selection.
- [ ] Extend the embedded self-test with wrong base/profile, alias, source, Edge binary/config, fixture, and Pi config identity rejection before invocation.

**Test Strategy:** Reuse the embedded fake binaries/runtime. Assert exact argv/environment through hashes/presence only, and assert each identity mismatch returns direct harness exit 69 with an empty invocation marker. No external credential is used by the self-test.

**Verification:** `bash -n scripts/e2e-hot-path-agents.sh && make test-hot-path-agent-smoke-self-test` exits 0.

### [REVIEW_TEST-2] Require observations appended by the current matrix

**Problem:** `scripts/e2e-hot-path-agents.sh:328-379` validates deterministic prebuilt files, and `do_run` calls that validator at line 923 before any agent. `run_case` later reads the same files at line 604, so old records can be paired with new CLI stdout/workspace evidence.

**Solution:** Accept one current runtime observation log. For every sequential case, snapshot file identity and byte offset immediately before invocation, wait boundedly for appended `hot_path_observation` JSON records after the child finishes, and derive the single new request id from that appended region. Project only the closed request/stage/outcome fields, require the expected stage/terminal/cleanup lifecycle for the case, and reject truncation/rotation, zero or multiple request ids, duplicate stages, unrelated records, or preexisting-only evidence. Keep raw appended log fragments only in the disposable capture directory and delete them before manifest persistence.

Before (`scripts/e2e-hot-path-agents.sh:917-927`):

```bash
validate_observation_set
: > "$INVOCATION_MARKER" 2>/dev/null || true
RAW_CAPTURE_DIR=$(mktemp -d "$WORKSPACE_ROOT/.e2e-hot-path-capture.XXXXXX")
if ! run_matrix; then
```

After:

```bash
validate_observation_log_preflight
if ! run_matrix_with_fresh_observation_offsets; then
```

**Modified Files and Checklist:**

- [ ] Modify `scripts/e2e-hot-path-agents.sh` to capture and validate per-case appended observation records.
- [ ] Update fake runtime emission so the positive self-test writes observations after case start.
- [ ] Add negative controls for stale-only, rotated/truncated, duplicate/mixed request, wrong stage, and missing appended observation evidence.

**Test Strategy:** The self-test must seed valid-looking stale observations before the run and prove they are rejected unless the fake runtime appends the current case lifecycle. Preserve all existing matrix, redaction, workspace, cancellation, schema, and cleanup assertions.

**Verification:** `make test-hot-path-agent-smoke-self-test` exits 0 and reports the new freshness negative controls.

### [REVIEW_TEST-3] Rebuild trustworthy external evidence

**Problem:** `code_review_cloud_G07_1.log:143-196` contains no actual manifest, reports stale inventory state, and conflates direct harness exit 69 with GNU Make's process status 2.

**Solution:** After REVIEW_TEST-1/2, run the local checks and presence-only external preflight. Record the direct harness and Make statuses separately. If all external inputs are authorized and current, execute the actual 2x5 matrix and validate the manifest; otherwise record the first exact unavailable input/route and resume command without claiming PASS or writing completion artifacts.

Before (`code_review_cloud_G07_1.log:143-169`):

```text
Outcome: BLOCKED — exit 69 before agent invocation.
agent-test/inventory-agent.yaml ... records claude/pi not_configured.
```

After (`CODE_REVIEW-cloud-G07.md` implementation evidence):

```text
Direct harness exit: 69; GNU Make exit: 2 with child Error 69.
Current profile presence and actual runtime-binding inputs are reported separately.
Actual manifest path/summary is present only if the credentialed matrix ran.
```

**Modified Files and Checklist:**

- [ ] Correct Make comments/status expectations in `Makefile`.
- [ ] Fill `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/CODE_REVIEW-cloud-G07.md` with fresh raw output and non-secret paths/status.

**Test Strategy:** Local commands are mandatory and fresh. Actual external execution is mandatory for PASS; a new exact blocker is valid implementation evidence but remains non-PASS for S16.

**Verification:** Run the complete Final Verification block below.

## Modified Files Summary

| File | Item |
|---|---|
| `Makefile` | REVIEW_TEST-1, REVIEW_TEST-3 |
| `scripts/e2e-hot-path-agents.sh` | REVIEW_TEST-1, REVIEW_TEST-2 |
| `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/CODE_REVIEW-cloud-G07.md` | REVIEW_TEST-3 |

## Final Verification

Local deterministic checks (fresh output required):

```bash
bash -n scripts/e2e-hot-path-agents.sh
make test-hot-path-agent-smoke-self-test
review_tmp="$(mktemp -d)"
trap 'rm -rf "$review_tmp"' EXIT
set +e
./scripts/e2e-hot-path-agents.sh --preflight-only >"$review_tmp/direct-preflight.log" 2>&1
direct_rc=$?
make test-hot-path-agent-smoke-preflight >"$review_tmp/make-preflight.log" 2>&1
make_rc=$?
set -e
test "$direct_rc" -eq 69
test "$make_rc" -eq 2
rg --sort path -q 'validation failed: missing --claude binary' "$review_tmp/direct-preflight.log"
rg --sort path -q 'Error 69' "$review_tmp/make-preflight.log"
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
git diff --check
```

External checks after every required input is supplied out-of-band:

```bash
test -n "${IOP_HOT_SMOKE_BASE_URL:-}"
test -n "${IOP_HOT_SMOKE_DIRECT_MODEL:-}" && test -n "${IOP_HOT_SMOKE_PASS_MODEL:-}"
test -n "${IOP_HOT_SMOKE_REPAIR_MODEL:-}" && test -n "${IOP_HOT_SMOKE_SLOW_MODEL:-}"
test -n "${IOP_HOT_SMOKE_CLAUDE_BIN:-}" && test -x "$IOP_HOT_SMOKE_CLAUDE_BIN"
test -n "${IOP_HOT_SMOKE_PI_BIN:-}" && test -x "$IOP_HOT_SMOKE_PI_BIN"
test -n "${PI_CODING_AGENT_DIR:-}" && test -d "$PI_CODING_AGENT_DIR"
test -n "${IOP_HOT_SMOKE_PI_PROVIDER:-}"
test -n "${IOP_HOT_SMOKE_EDGE_BIN:-}" && test -x "$IOP_HOT_SMOKE_EDGE_BIN"
test -n "${IOP_HOT_SMOKE_EDGE_CONFIG:-}" && test -f "$IOP_HOT_SMOKE_EDGE_CONFIG"
test -n "${IOP_HOT_SMOKE_RUNTIME_EVIDENCE:-}" && test -f "$IOP_HOT_SMOKE_RUNTIME_EVIDENCE"
test -n "${IOP_HOT_SMOKE_OBSERVATION_FILE:-}" && test -f "$IOP_HOT_SMOKE_OBSERVATION_FILE"
test -n "${IOP_HOT_SMOKE_WORKSPACE_PARENT:-}" && test -d "$IOP_HOT_SMOKE_WORKSPACE_PARENT"
test -n "${IOP_HOT_SMOKE_OUTPUT:-}"
test -n "${IOP_HOT_SMOKE_CLAUDE_SECRET_ENV:-}" && test -n "${!IOP_HOT_SMOKE_CLAUDE_SECRET_ENV:-}"
test -n "${IOP_HOT_SMOKE_PI_SECRET_ENV:-}" && test -n "${!IOP_HOT_SMOKE_PI_SECRET_ENV:-}"
make test-hot-path-agent-smoke-preflight
make test-hot-path-agent-smoke
jq -e '
  .schema_version == "1"
  and ([.cases[].id] == ["claude:direct","claude:light-pass","claude:repair","claude:write-unavailable","claude:timeout-cancel","pi:direct","pi:light-pass","pi:repair","pi:write-unavailable","pi:timeout-cancel"])
  and ([.cases[].outcome] == ["completed","completed","completed","error","cancelled","completed","completed","completed","error","cancelled"])
  and (.redaction.matches == 0)
' "$IOP_HOT_SMOKE_OUTPUT"
```

Expected: all local checks pass; direct missing-input preflight is 69 and GNU Make is 2 with `Error 69`; external preflight proves exact source/runtime/profile binding; the actual manifest contains the closed 10-case outcomes, fresh observation/workspace/terminal evidence, and zero redaction matches. If external input is absent, record the exact blocker and do not claim PASS.

After completing all code changes, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.
