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

# Bounded Claude/Pi Practical Hot Path Pilot

## For the Implementing Agent

Filling the implementation-owned sections in `CODE_REVIEW-cloud-G06.md` is mandatory. Execute this plan without changing its ownership or scope, run every verification command, paste actual output and decisions into the review artifact, keep both active files in place, and report ready for review. If blocked, record only the exact blocker, attempted command/output, and resume condition in implementation-owned evidence fields. Do not ask the user, call user-input tools, create control-plane stop files, classify the next state, archive logs, write `complete.log`, or update roadmap state; finalization belongs to the code-review skill.

## Background

The user resolved the external-execution stop by authorizing a short, secret-safe run in `/config/workspace/iop-s2`, including use of the existing API credential. This replan deliberately runs only `Claude/Pi × {read-reason, small-repair}` through the actual Edge and Node; it is a bounded diagnostic pilot, not a replacement for the fixed S16 2×5 matrix and not an S16 completion claim.

## Archive Evidence Snapshot

- `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/code_review_cloud_G08_4.log` ended with `FAIL`, `review_rework_count=4`, and `evidence_integrity_failure=true` only because no matching-runtime actual Claude/Pi evidence existed; repository-fixable cancellation and Pi JSON-mode defects were already closed.
- `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/user_review_0.log` requested a matching isolated runtime or authorized executor. The user supplied that authorization, selected `/config/workspace/iop-s2`, allowed the existing API credential, and explicitly limited this run to short tasks.
- The prior fake-only shell self-test and four-package race suite passed, but neither can substitute for S16 actual-agent evidence.
- Roadmap scope remains `milestone-task=hot-smoke`; this pilot leaves the full direct/pass/repair/failure/cancel matrix open for a later user decision.

## Analysis

### Files Read

- `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/user_review_0.log` — resolved external-execution request and resume contract.
- `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/code_review_cloud_G08_4.log` — latest reviewed implementation/evidence state and remaining S16 finding.
- `scripts/e2e-hot-path-agents.sh` — actual-agent argv, identity, observation, workspace, redaction, and fixed-matrix behavior used as the evidence baseline.
- `scripts/fixtures/hot-path-agent-smoke-manifest.schema.json` and `Makefile` — fixed S16 manifest and existing preflight/run entry points.
- `packages/go/config/execution_preset_types.go`, `packages/go/config/execution_preset_config_test.go`, and `packages/go/config/model_execution_preset_config_test.go` — virtual model, direct/light route, and workspace-tool config contracts.
- `apps/edge/internal/openai/workspace_tool_binding.go`, `apps/edge/internal/openai/workspace_tool_codec.go`, `apps/edge/internal/openai/artifact_pair.go`, and `apps/edge/internal/openai/hot_path_cleanup.go` — actual tool-schema binding, receipt, pair, and cleanup boundaries.
- `apps/edge/internal/openai/hot_path_selector.go`, `apps/edge/internal/openai/hot_path_direct.go`, and `apps/edge/internal/openai/hot_path_light.go` — direct/light selection and stage lifecycle.
- `/config/.npm-global/lib/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js`, `write.js`, `bash.js`, and `index.js` — installed Pi 0.81.1 tool names and argument schemas.
- `agent-roadmap/phase/knowledge-tool-optimization-extension/milestones/iop-hot-path-one-shot-execution.md` and `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md` — active Milestone, S16, and evidence map.
- `agent-test/local/rules.md`, `agent-test/local/testing-smoke.md`, and `agent-test/local/edge-smoke.md` — local/external smoke isolation and secret-handling rules.

### SDD Criteria

- SDD: `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`, status `[승인됨]`, implementation lock released.
- Milestone metadata: `milestone-task=hot-smoke`.
- Target: S16 actual Claude/Pi streaming with writable workspaces. This pilot samples the S16 direct and repair behaviors only.
- Evidence Map inputs: actual Claude/Pi visible tool/stage output, workspace before/after, artifact cleanup, standard terminal, and raw-free observation evidence. The checklist records these for four bounded cases while explicitly withholding S16 completion because pass/failure/cancel coverage is absent.

### Verification Context

- No separate `verification_context` handoff was supplied. Repository-native evidence and safe host probes establish the run.
- Source checkout: `/config/workspace/iop-s0`, branch `feature/iop-hot-path-one-shot-execution`, HEAD `703f3b723202959185c04bb32c2c68383b8d04a0`, dirty with the in-scope feature work. Build Edge and Node directly from these exact worktree bytes; do not use the older iop-s2 checkout as source.
- Execution workspace: `/config/workspace/iop-s2`, branch `dev`, HEAD `61016d5bd0940033d68e1862bc20e1b7108b8875`, clean before setup. All runtime/config/raw-output files are transient under one validated `mktemp -d /config/workspace/iop-s2/.hot-path-short.XXXXXX` directory and must be removed after evidence extraction.
- Host: Linux `6.10.14-linuxkit`, arm64; Go 1.26.2; jq 1.7; sops 3.13.1. Installed agents: Claude Code 2.1.221 and Pi 0.81.1 at `/config/.npm-global/bin/claude` and `/config/.npm-global/bin/pi`.
- Ports `127.0.0.1:28081`, `:29090`, `:29091`, and `:29092` were free at planning time. Recheck before start and fail closed on collision.
- Existing Pi provider `iop` exposes `glm-5.2`; its current endpoint/model/key combination already passed one direct short probe. Use the same caller credential and endpoint without printing either. The existing endpoint does not expose Hot Path aliases, so the pilot must run a newly built local Edge/Node with local virtual model aliases.
- Credential boundary: copy the existing Pi provider definition into the transient Pi profile, change only its local base URL/model aliases, and read its API-key value into a process-local variable for Claude. Configure temporary Edge legacy provider auth to forward the inbound `Authorization` header; never serialize the key into Edge config, tracked files, evidence, argv, or logs. Use `ANTHROPIC_AUTH_TOKEN`, not a tracked credential file, for Claude.
- Runtime shape: one upstream provider-only canonical model plus one direct-only virtual alias and one light-only repair alias. The light preset uses the exact installed Claude (`Read`, `Write`, `Bash`) and Pi (`read`, `write`, `bash`) alternatives, maps read/write fields explicitly, uses command-mode delete for the reserved job directory, and matches only explicit success status. Any actual-result incompatibility is a pilot finding, not permission to patch production in this plan.
- Start one Edge and one Node with fixed loopback ports, matching node token, JSON log file, and no Control Plane/managed credential path. Require config checks, listening ports, node registration, `/v1/models` exposure of both aliases, and fresh `hot_path_observation` lines.
- External provider host and credential values are intentionally omitted from evidence. Raw CLI streams remain only in the transient directory and are reduced to status/hash/boolean/count evidence before cleanup.
- Confidence: high that the runtime can be built and direct requests can reach the existing provider; medium for light repair because this is the first actual Claude/Pi workspace-result compatibility probe.

#### External Verification Preflight

- Recheck iop-s0 branch/HEAD and hash the exact Edge/Node binaries after build.
- Recheck iop-s2 cleanliness and port availability before creating the transient root.
- Verify executable versions, the existing Pi provider/model/key presence without printing values, and upstream `/models` reachability with status/count-only output.
- Run both generated configs through `config check`, start Edge then Node, wait with a bounded loop, and prove the two local aliases through `/v1/models` before invoking either agent.
- If identity, port, config, node registration, provider reachability, or alias exposure fails, record the first exact non-secret failure, clean up, and stop; do not fall back to direct provider calls and do not claim Hot Path evidence.

### Test Coverage Gaps

- Existing unit/integration tests cover direct/light state machines and fake-agent matrix parsing, but no test proves the installed Claude/Pi tool-result formats against this runtime.
- The pilot covers two agents and two useful tasks only. It omits light-pass, write-unavailable, timeout/cancel, the four-alias identity manifest, and therefore cannot close S16.
- No repository code or test is changed. A runtime mismatch discovered here must be reviewed and replanned before any fix.

### Symbol References

None. This is verification-only and renames/removes no symbol.

### Split Judgment

Keep one compact verification plan. The isolated runtime identity, two protocol surfaces, and 2×2 result table must be evaluated together to distinguish provider/setup failure from agent-specific direct or light-flow incompatibility. The strict four-case/time limit makes further split artifacts unnecessary.

### Scope Rationale

Only transient runtime files under the one iop-s2 temp root and implementation evidence in `CODE_REVIEW-cloud-G06.md` may be written. Do not modify production Go/shell/config/schema/Make files, iop-s2 tracked files, installed Claude/Pi packages, global Pi configuration, roadmap/spec/contract documents, provider state, or unrelated dirty-worktree files. Do not run the S16 10-case harness in this plan.

### Final Routing

- `evaluation_mode=isolated-reassessment`; `finalizer=finalize-task-policy.sh`; `finalizer_mode=pair`; `status=routed`.
- Build closures: `scope_closed=true`, `context_closed=true`, `verification_closed=true`, `evidence_trusted=true`, `ownership_closed=true`, `decision_closed=true`; capability gap none. Scores 1/1/0/2/2 = G06. Base `local-fit`; `large_indivisible_context=false`; matched loop risks `temporal_state`, `boundary_contract`, `variant_product` (3); `review_rework_count=4`; `evidence_integrity_failure=true`; recovery boundary matched. Final route `recovery-boundary`, cloud, `PLAN-cloud-G06.md`.
- Review closures: all six true; capability gap none. Scores 1/1/0/2/2 = G06. Route `official-review`, cloud, Codex `gpt-5.6-sol` xhigh, `CODE_REVIEW-cloud-G06.md`.

## Implementation Checklist

- [ ] [REVIEW_TEST-1] Build and start the exact iop-s0 Edge/Node as an isolated, secret-safe iop-s2 runtime; prove config, identity, registration, provider reachability, and direct/repair aliases before agent invocation.
- [ ] [REVIEW_TEST-2] Run exactly four bounded cases — Claude direct/repair and Pi direct/repair — with a 90-second hard limit per case and record reduced protocol/observation/workspace evidence without raw content.
- [ ] [REVIEW_TEST-3] Stop only the pilot-owned processes, remove the complete transient root, prove iop-s2 returned clean, and state explicitly that the 10-case S16 decision remains open.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [REVIEW_TEST-1] Isolated Matching Runtime

#### Problem

The prior run had no selected Edge base URL, binaries, config, aliases, observation file, or runtime identity. Calling the provider directly proved only credential reachability and did not exercise Hot Path.

#### Solution

Build `./apps/edge/cmd/edge` and `./apps/node/cmd/node` from `/config/workspace/iop-s0` into the transient iop-s2 root. Generate secret-free Edge/Node configs at mode 0600 using the existing non-printed upstream base URL and request-time provider auth. Define one canonical provider model, one direct-only virtual alias, and one light-only repair alias. The light preset must list exact Claude and Pi workspace alternatives and command-mode cleanup. Validate configs, start isolated processes, and wait for both aliases before cases.

Do not copy current `configs/edge.yaml`, attach to an existing shared process, or put the API key in generated YAML. Do not silently call the upstream endpoint when the local Edge path fails.

#### Modified Files and Checklist

- [ ] `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/CODE_REVIEW-cloud-G06.md`: record source/runtime hashes, non-secret versions, config-check output, port/process readiness, node registration, provider status/count, and alias exposure.
- [ ] Transient iop-s2 root: build binaries and generate mode-0600 Edge/Node/Pi configs and raw logs; remove the entire root in REVIEW_TEST-3.

#### Test Strategy

No repository test is added because behavior is not changed. Use config check, bounded readiness probes, `/v1/models`, and fresh JSON observation logs as the setup oracle.

#### Verification

```bash
test "$(git -C /config/workspace/iop-s0 branch --show-current)" = feature/iop-hot-path-one-shot-execution
test "$(git -C /config/workspace/iop-s0 rev-parse HEAD)" = 703f3b723202959185c04bb32c2c68383b8d04a0
test -z "$(git -C /config/workspace/iop-s2 status --porcelain)"
command -v claude && command -v pi && command -v go && command -v jq
```

Expected: all exit 0. Continue with the generated-config checks and bounded local readiness probes recorded in the review; both virtual aliases must be visible before REVIEW_TEST-2.

### [REVIEW_TEST-2] Four-Case Practical Pilot

#### Problem

S16's fixed 10-case harness is intentionally broader than the user's current short-task test. A direct provider probe also cannot reveal Edge direct/light routing, real agent tool continuation, artifact cleanup, or protocol-specific failure.

#### Solution

Create four isolated case directories. Direct cases contain a README value unknown to the prompt and request one-line extraction through the file tool. Repair cases contain `TASK.md` plus a seeded incorrect `answer.txt` and request the exact small correction. Invoke installed Claude and Pi against the local Edge aliases, sequentially, with `timeout --signal=TERM --kill-after=5s 90s`. Do not run any fifth case, retry a failed case more than once, or expand the task.

For each case record only agent/scenario, process status, timeout boolean, expected-result boolean, before/after tree digest, public tool-event kinds/count, correlated Hot Path mode/stage/terminal/cleanup projection, and secret/raw-content scan result. Keep raw streams transient and never paste them into the review.

#### Modified Files and Checklist

- [ ] `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/CODE_REVIEW-cloud-G06.md`: record the exact 2×2 result table and first non-secret failure classification for each failed row.
- [ ] Transient iop-s2 case directories: seed minimal inputs, capture private raw streams, compute reduced evidence, and retain only until REVIEW_TEST-3.

#### Test Strategy

Run exactly these cases: `claude:direct`, `claude:repair`, `pi:direct`, `pi:repair`. Direct passes only if the unknown README value is returned, no file changes occur, and Edge observes direct completion. Repair passes only if `answer.txt` becomes the requested exact line, a real tool continuation and light stages are observed, and `.iop/job/*` is absent after successful cleanup. A runtime or row failure is diagnostic evidence and must not be patched in this plan.

#### Verification

```bash
test "$pilot_case_count" -eq 4
test "$pilot_timeout_limit_seconds" -eq 90
jq -e 'length == 4 and ([.[].id] == ["claude:direct","claude:repair","pi:direct","pi:repair"])' "$pilot_reduced_result"
```

Expected: command shape exits 0 and exactly four rows exist. Each row's pass/failure facts and observation correlation are reviewed individually; no S16 verdict follows from this pilot.

### [REVIEW_TEST-3] Cleanup and Bounded Handoff

#### Problem

The run uses credentials, raw agent streams, temporary configs, and processes. Leaving any of them under iop-s2 would violate isolation and make later evidence ambiguous.

#### Solution

Terminate only PIDs written by this pilot, wait for exit, scan transient files for the exact credential without printing matches, reduce final evidence into the active review, and remove the validated transient root. Verify the four selected ports are closed, no pilot process remains, and iop-s2 is clean. Preserve no raw response, endpoint, credential, generated config, or model value.

#### Modified Files and Checklist

- [ ] `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/CODE_REVIEW-cloud-G06.md`: record cleanup, secret-scan count, post-run process/port state, iop-s2 cleanliness, and the explicit S16 non-completion statement.

#### Test Strategy

No new test file. The cleanup oracle is exact PID ownership, closed selected ports, absent validated temp root, zero credential matches in retained evidence, and a clean iop-s2 worktree.

#### Verification

```bash
test ! -e "$pilot_root"
test -z "$(git -C /config/workspace/iop-s2 status --porcelain)"
test "$(ss -ltnH | awk '$4 ~ /:(28081|29090|29091|29092)$/ {count++} END {print count+0}')" -eq 0
git -C /config/workspace/iop-s0 diff --check
```

Expected: all exit 0 with no pilot artifacts/processes/ports left and no whitespace errors.

## Modified Files Summary

| File | Items | Purpose |
|---|---|---|
| `agent-task/m-iop-hot-path-one-shot-execution/21+20_hot_smoke_actual/CODE_REVIEW-cloud-G06.md` | REVIEW_TEST-1, REVIEW_TEST-2, REVIEW_TEST-3 | Record exact setup, four-case reduced evidence, cleanup, and S16 non-completion. |

## Final Verification

```bash
bash -n scripts/e2e-hot-path-agents.sh
TMPDIR=/config/workspace/iop-s0 make test-hot-path-agent-smoke-self-test
test -z "$(git -C /config/workspace/iop-s2 status --porcelain)"
test "$(ss -ltnH | awk '$4 ~ /:(28081|29090|29091|29092)$/ {count++} END {print count+0}')" -eq 0
git diff --check
```

Expected: all commands exit 0. The review must also contain exactly four pilot rows, no credential/endpoint/raw response, proof that every transient artifact and owned process was removed, and an explicit statement that S16's fixed 10-case actual manifest remains incomplete. Fresh external rows are required; fake-only results do not satisfy the pilot.

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