<!-- task=m-iop-hot-path-one-shot-execution/20+17,19_smoke_harness plan=3 tag=REVIEW_TEST milestone-task=hot-smoke -->

# Implement the Claude/Pi Hot Path smoke harness contract

## For the Implementing Agent

Implement every checklist item, run the exact verification commands, and fill the implementation-owned sections of `CODE_REVIEW-cloud-G08.md` with actual notes and stdout/stderr. Keep the active PLAN/CODE_REVIEW files in place and report ready for review. If blocked, record only the exact blocker, attempted commands/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, or write `complete.log`; finalization is owned by the code-review skill.

## Background

The preceding review found that both planned source artifacts and all deterministic evidence were absent. This follow-up implements the repository-local, credential-free harness prerequisite for SDD scenario S16. Actual credentialed Claude/Pi execution and Make integration remain owned by the downstream smoke child.

## Archive Evidence Snapshot

- `agent-task/m-iop-hot-path-one-shot-execution/20+17,19_smoke_harness/plan_local_G08_2.log` and `agent-task/m-iop-hot-path-one-shot-execution/20+17,19_smoke_harness/code_review_cloud_G08_2.log` close plan 2 with `FAIL`: three Required findings, zero Suggested findings, and zero Nits.
- Required rework: create `scripts/e2e-hot-path-agents.sh`, create `scripts/fixtures/hot-path-agent-smoke-manifest.schema.json`, then fill fresh syntax/schema/self-test/common-regression/diff evidence in the active review.
- Fresh reviewer evidence before this plan: syntax exited 127, schema inspection exited 2, and self-test exited 127 because both planned source files were absent. No command result was falsely claimed, so `evidence_integrity_failure=false`.
- Split prerequisites are satisfied by `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/17+14,15,16_endpoint_error_matrix/complete.log` and `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/19+17,18_observation_lifecycle/complete.log`.

## Analysis

### Files Read

- `agent-task/m-iop-hot-path-one-shot-execution/20+17,19_smoke_harness/PLAN-local-G08.md`
- `agent-task/m-iop-hot-path-one-shot-execution/20+17,19_smoke_harness/CODE_REVIEW-cloud-G08.md`
- `agent-roadmap/current.md`
- `agent-roadmap/phase/knowledge-tool-optimization-extension/PHASE.md`
- `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`
- `agent-ops/rules/project/domain/testing/rules.md`
- `agent-test/local/rules.md`
- `agent-test/local/testing-smoke.md`
- `scripts/e2e-openai-cli-workspace.sh`
- `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/17+14,15,16_endpoint_error_matrix/complete.log`
- `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/19+17,18_observation_lifecycle/complete.log`

### SDD Criteria

- SDD: `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`, status `[Approved]`, lock released.
- First-line contribution: `milestone-task=hot-smoke`; target Acceptance Scenario: S16.
- Evidence Map S16 requires actual Claude/Pi streaming logs and workspace before/after evidence. This child implements the secret-safe fixed-matrix harness, schema, and fake-runtime oracle needed to collect that evidence; it does not claim S16 completion or substitute fake evidence for the downstream actual run.
- S16 shaped the two checklist items around the exact Claude/Pi 2x5 matrix, native terminal/observation/workspace/cleanup evidence, source/runtime identity, and zero secret matches. The final verification proves this prerequisite without credentials or network calls.

### Verification Context

- No verification handoff was supplied. Repository-native fallback came from `agent-test/local/rules.md`, `agent-test/local/testing-smoke.md`, the active plan, SDD S16, and the existing synthetic workspace smoke.
- Workdir is `/config/workspace/iop-s0`; current branch is `feature/iop-hot-path-one-shot-execution` at `f79fe3c76bb6a488141f8ec2806af4b8b8920369`. The shared worktree contains unrelated sibling changes, but the selected task directory and both planned source paths were clean/absent during review.
- Available deterministic tools: Go `go1.26.2 linux/arm64`, Bash 5.2.21, jq 1.7, and GNU timeout 9.4. Claude is present at `/config/.npm-global/bin/claude`, version 2.1.220, with the required print/stream flags. `pi` exists, but its current-host help/version probe timed out after 10 seconds; self-test must therefore use a fake Pi binary and must not invoke the installed Pi or a provider.
- Required current-child checks are local syntax, schema shape, credential-free self-test, the SDD common race-enabled package regression, and `git diff --check`. Fresh output is mandatory; Go cache output is disabled with `-count=1`.
- Constraints: no actual credentials, provider calls, shared process termination, Makefile change, deployment change, tracked smoke output, or repo-local generated tool. Confidence is high because the missing paths and deterministic failure exits were directly observed.

### Test Coverage Gaps

- No `scripts/e2e-hot-path-agents.sh` exists, so exact Claude/Pi argv, validation-before-invocation, cancellation isolation, redaction, and cleanup have no harness coverage.
- No manifest schema exists, so the fixed 10-row evidence contract and closed enum/field boundary are not reviewable.
- No fake-agent/runtime self-test exists for success, expected failure, cancellation, schema rejection, identity mismatch, redaction, or cleanup.

### Symbol References

- None. This follow-up adds new test-only paths and renames or removes no symbol.

### Split Judgment

- Keep the harness, schema, and self-test atomic: the script cannot independently PASS without its evidence contract, and the schema is not useful without a producer/validator.
- Predecessor 17 is satisfied by `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/17+14,15,16_endpoint_error_matrix/complete.log`.
- Predecessor 19 is satisfied by `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/19+17,18_observation_lifecycle/complete.log`.

### Scope Rationale

- Exclude `Makefile`, actual provider/agent execution, credential provisioning, shared runtime/config mutation, deployment, and tracked smoke output. The next child owns Make integration and the credentialed S16 run.
- Do not modify production Edge/Node code. This child creates only a test harness, its schema, and task-local review evidence.

### Final Routing

- `evaluation_mode=isolated-reassessment`; finalizer=`finalize-task-policy.sh pair`.
- Build closures are all true (`scope_closed`, `context_closed`, `verification_closed`, `evidence_trusted`, `ownership_closed`, `decision_closed`). Scores are 2/1/1/2/2, grade G08, base/final route `local-fit`, lane `local`, filename `PLAN-local-G08.md`.
- Review closures are all true. Scores are 2/1/1/2/2, grade G08, route `official-review`, lane `cloud`, filename `CODE_REVIEW-cloud-G08.md`.
- `large_indivisible_context=false`; matched loop risks are `boundary_contract`, `structured_interpretation`, and `variant_product` (3); `review_rework_count=1`; `evidence_integrity_failure=false`; neither risk nor recovery boundary matched; no capability gap exists.

## Implementation Checklist

- [x] [REVIEW_TEST-1] Add the secret-safe Claude/Pi harness and closed JSON manifest schema for the fixed 10-case matrix, source/runtime identity, observation, workspace, terminal, cleanup, and redaction evidence.
- [x] [REVIEW_TEST-2] Add credential-free fake-agent/runtime self-tests for exact argv, success, expected failure, cancellation, schema rejection, identity mismatch, redaction, and cleanup, then run every final verification command.
- [x] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [REVIEW_TEST-1] Harness and manifest schema

**Problem:** `scripts/e2e-openai-cli-workspace.sh:132` exercises only a synthetic `/v1/responses` CLI path. The required Claude/Pi harness and schema named by `code_review_cloud_G08_2.log:29-30` do not exist, so S16 prerequisite evidence cannot be produced or reviewed.

**Solution:** Add `scripts/e2e-hot-path-agents.sh` with strict mode and explicit `--self-test`, `--preflight-only`, and `--run` modes. Validate every required non-secret input and presence-only secret before any agent invocation; return exit 69 for missing or mismatched source/runtime/config/binary/fixture/observation/workspace facts without printing values. Pin exact Claude argv (`--print --output-format stream-json --include-partial-messages --no-session-persistence --bare`) and Pi argv (`--provider`, `--model`, `--mode json`, `--print`, `--no-session`). Run `{claude,pi} x {direct,light-pass,repair,write-unavailable,timeout-cancel}` in disposable workspaces, signal only the spawned child, and atomically emit a redacted caller-supplied manifest.

Add a Draft 2020-12 JSON schema with closed top-level and nested objects. Require schema version, non-secret source/runtime identity, runner facts, exactly ten unique cases, fixed agent/scenario/outcome/terminal/cleanup enums, ordered visible-event and observation evidence, before/after workspace evidence, and zero-match redaction evidence. Prohibit raw prompt/output, token, key, auth, credential, and endpoint-value fields.

Before (`code_review_cloud_G08_2.log:29-30`):

```text
TEST-1 harness/schema: unchecked; both planned source paths absent
TEST-2 deterministic evidence: unchecked; no fake-agent/runtime oracle
```

After:

```text
validated inputs -> fixed Claude/Pi adapters -> isolated 2x5 execution
-> schema-validated redacted manifest -> atomic caller-supplied output
```

**Modified Files and Checklist:**

- [x] Add executable `scripts/e2e-hot-path-agents.sh` with strict validation, adapter argv builders, isolated process/workspace cleanup, fixed matrix execution, redaction, manifest assembly, and atomic output.
- [x] Add `scripts/fixtures/hot-path-agent-smoke-manifest.schema.json` with the closed evidence contract and fixed cardinality/enums.

**Test Strategy:** REVIEW_TEST-2 supplies fake binaries, runtime identity, observations, and workspaces. No network or credentialed path is used in this child.

**Verification:** `bash -n scripts/e2e-hot-path-agents.sh` and the schema jq command both exit 0; the script is executable and no secret/raw-value field is permitted.

### [REVIEW_TEST-2] Credential-free behavioral oracle and evidence

**Problem:** `code_review_cloud_G08_2.log:53-83` contains no implementation output, and fresh review commands fail with exits 127/2/127. Without a deterministic oracle, malformed input could reach providers, cancellation could affect shared processes, and manifest/redaction assertions could be vacuous.

**Solution:** Implement `--self-test` inside the harness. Create all fixtures below one `mktemp -d`: fake Claude/Pi binaries that record safe argv and emit deterministic native-shaped events, matching and mismatching runtime evidence, request-correlated observation logs, disposable workspaces, and sentinel secrets. Assert the exact ten case ids and argv, success and expected-failure terminals, validation exit 69 before an invocation marker, schema rejection, source/runtime identity mismatch, secret absence, child-only timeout signaling, cleanup/orphan classification, and removal of all temporary state. The fake runtime path must exercise the same manifest builder and validator used by `--run`.

Before (`code_review_cloud_G08_2.log:57-83`):

```text
syntax: exit 127; schema: exit 2; self-test: exit 127
common regression and diff evidence: not supplied
```

After:

```text
all deterministic commands exit 0 with fresh stdout/stderr recorded
no installed Claude/Pi process, credential, network, or shared runtime is used
```

**Modified Files and Checklist:**

- [x] Implement fake-agent/runtime fixtures and assertions inside `scripts/e2e-hot-path-agents.sh`.
- [x] Fill `agent-task/m-iop-hot-path-one-shot-execution/20+17,19_smoke_harness/CODE_REVIEW-cloud-G08.md` with actual decisions, deviations, checklist status, and exact verification output.

**Test Strategy:** The self-test is the required regression test. It must fail independently for wrong argv, fewer/more/duplicate rows, provider invocation on invalid input, schema drift, identity mismatch acceptance, sentinel leakage, parent/shared-process signaling, or incomplete cleanup.

**Verification:** Run all commands in Final Verification with fresh outputs; every command exits 0.

## Dependencies and Execution Order

1. Predecessor `17+14,15,16_endpoint_error_matrix` is complete at `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/17+14,15,16_endpoint_error_matrix/complete.log`.
2. Predecessor `19+17,18_observation_lifecycle` is complete at `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/19+17,18_observation_lifecycle/complete.log`.
3. Implement REVIEW_TEST-1, then REVIEW_TEST-2.

## Modified Files Summary

| File | Item |
|---|---|
| `scripts/e2e-hot-path-agents.sh` | REVIEW_TEST-1, REVIEW_TEST-2 |
| `scripts/fixtures/hot-path-agent-smoke-manifest.schema.json` | REVIEW_TEST-1 |
| `agent-task/m-iop-hot-path-one-shot-execution/20+17,19_smoke_harness/CODE_REVIEW-cloud-G08.md` | REVIEW_TEST-2 |

## Final Verification

```bash
bash -n scripts/e2e-hot-path-agents.sh
jq -e '.type == "object" and (.required | index("cases")) and (.properties.cases.minItems == 10) and (.properties.cases.maxItems == 10)' scripts/fixtures/hot-path-agent-smoke-manifest.schema.json
./scripts/e2e-hot-path-agents.sh --self-test
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
git diff --check
```

Expected: every command exits 0 with fresh evidence; the self-test proves exact safe argv, the fixed matrix/schema, pre-invocation exit 69 paths, deterministic terminal/observation/workspace/cleanup joins, child-only cancellation, and zero secret matches without credentials or network access.

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