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

# Claude/Pi Hot Path smoke harness and manifest contract

## For the Implementing Agent

구현 후 `CODE_REVIEW-cloud-G08.md`의 구현 담당 섹션에 실제 syntax/self-test 출력을 채우고 active 파일을 유지한다. 차단 시 정확한 blocker와 재개 조건만 기록하며 archive/`complete.log` 작성이나 상태 판정은 하지 않는다.

## Background

실제 Claude/Pi 검증 전에 secret-safe invocation, fixed 10-row scenario matrix, runtime/source identity, observation/workspace evidence, child-only cancellation, manifest schema를 credential-free self-test로 닫는다. 외부 credential/runtime 사용과 Make integration은 child 21이다.

## Archive Evidence Snapshot

- 이전 active plan/review pair는 구현 전에 source reanalysis로 대체됐다. 구현 evidence와 verdict는 없다.

## Analysis

### Files Read

- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `scripts/e2e-openai-cli-workspace.sh`
- `agent-test/local/rules.md`
- `agent-test/local/edge-smoke.md`
- `agent-test/dev/edge-smoke.md`
- `agent-test/inventory-agent.yaml`

### SDD Criteria

- 승인 SDD S16: Claude/Pi 각각 direct, light-pass, light-repair, write-unavailable, timeout-cancel의 5개 row; native visible stream/terminal, workspace before/after, observation, cleanup/orphan, zero secret match.

### Verification Context

- 현재 binary help 기준 Claude는 `--print --output-format stream-json --include-partial-messages --no-session-persistence --bare`를, Pi는 `--provider --model --mode json --print --no-session`을 지원한다.
- 이 child의 oracle은 fake agent/runtime/observation을 쓰는 credential-free self-test다. 실제 외부 호출은 금지한다.

### Test Coverage Gaps

- CLI별 exact flags, malformed runtime evidence, source mismatch, schema validation, disposable workspace, write failure, timeout child cancellation, redaction을 한 harness에서 검증하지 않는다.

### Symbol References

- none.

### Split Judgment

- stable contract: validated inputs/agent adapters → schema-validated secret-free evidence manifest. Actual external execution/Make targets은 child 21이다.

### Scope Rationale

- Makefile, credential provisioning, actual provider calls, shared process/config mutation, deployment, tracked output은 제외한다.

### Final Routing

- evaluation_mode=isolated-reassessment, finalizer=`finalize-task-policy.sh pair`.
- build scores=2/1/1/2/2, risks=`boundary_contract,structured_interpretation,variant_product`(3), local-fit → `PLAN-local-G08.md`.
- review → `CODE_REVIEW-cloud-G08.md`; `large_indivisible_context=false`, recovery=0/false.

## Implementation Checklist

- [ ] [TEST-1] Add a secret-safe Claude/Pi harness and explicit JSON manifest schema for the fixed 10-row matrix, source/runtime identity, observation, workspace, terminal, cleanup, and redaction evidence.
- [ ] [TEST-2] Add credential-free fake-agent/runtime self-tests for success, expected failure, cancellation, schema rejection, identity mismatch, redaction, and cleanup.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [TEST-1] Harness and schema

**Problem:** the existing synthetic CLI workspace smoke does not invoke Claude/Pi adapters or produce reviewable Hot Path lifecycle evidence.

**Solution:** Add `scripts/e2e-hot-path-agents.sh` with `--self-test`, `--preflight-only`, and actual modes. Validate non-secret inputs without printing their values, require a runtime evidence fingerprint matching source/config/binary/fixture identity, and define four deterministic aliases (direct/pass/repair/slow). Execute the fixed Claude/Pi × five-scenario matrix in `mktemp` disposable workspaces; model write-unavailable by permissions/workspace fixture, signal timeout only to the spawned child, parse visible protocol/terminal/observation/cleanup evidence, and write atomically to a caller-supplied output. Add a tracked JSON schema that fixes required fields/enums while prohibiting secret/raw content fields.

**Modified Files and Checklist:**

- [ ] Add executable `scripts/e2e-hot-path-agents.sh` with strict input handling, CLI-specific adapters, isolated traps, fixed scenario matrix, evidence parsing, and atomic manifest output.
- [ ] Add `scripts/fixtures/hot-path-agent-smoke-manifest.schema.json` with the reviewable manifest contract and closed scenario/agent/verdict enums.

**Test Strategy:** TEST-2 supplies fake binaries/runtime evidence/logs; no network or credentials.

**Verification:** syntax, schema, and self-test commands exit 0.

### [TEST-2] Credential-free harness evidence

**Problem:** harness safety and parsing must be proven before any external identity is available.

**Solution:** Self-test exact Claude/Pi argv without logging secret env, 10-row success/expected-failure manifests, malformed/missing input exit 69 before agent invocation, source/runtime mismatch, schema rejection, seeded secret/raw redaction, child-only timeout signaling, workspace cleanup, and observation/cleanup/orphan joins. Validate output structurally with `jq` against schema-required fields.

**Modified Files and Checklist:**

- [ ] Implement fake fixtures and assertions inside `scripts/e2e-hot-path-agents.sh` self-test mode.
- [ ] Record actual output in `agent-task/m-iop-hot-path-one-shot-execution/20+17,19_smoke_harness/CODE_REVIEW-cloud-G08.md`.

**Test Strategy:** self-test creates/removes all fixtures below a temporary directory and asserts no parent/shared process mutation.

**Verification:** run Final Verification; all commands exit 0.

## Dependencies and Execution Order

1. Directory dependency `17` must produce `agent-task/m-iop-hot-path-one-shot-execution/17+14,15,16_endpoint_error_matrix/complete.log`.
2. Directory dependency `19` must produce `agent-task/m-iop-hot-path-one-shot-execution/19+17,18_observation_lifecycle/complete.log`.
3. Implement TEST-1, then TEST-2.

## Modified Files Summary

| File | Item |
|---|---|
| `scripts/e2e-hot-path-agents.sh` | TEST-1, TEST-2 |
| `scripts/fixtures/hot-path-agent-smoke-manifest.schema.json` | TEST-1 |
| `agent-task/m-iop-hot-path-one-shot-execution/20+17,19_smoke_harness/CODE_REVIEW-cloud-G08.md` | 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: exit 0, exact safe argv/matrix/schema behavior, deterministic failure/cancel/redaction/cleanup fixtures, no credential or network dependency.

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