<!-- task=m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification plan=1 tag=TEST milestone-task=error-cancel,claude-smoke -->

# Actual Claude and Mac single-request qualification

## For the Implementing Agent

Filling the implementation-owned sections of `CODE_REVIEW-cloud-G08.md` is the mandatory last implementation step. Run every verification command, paste actual output, keep both active files in place, and report ready for review; only the official code-review skill may append a verdict, archive files, write `complete.log`, or classify the next state. If blocked, record the exact blocker, attempted commands/output, declared execution target, authorization state, and resume condition only in the review evidence fields; do not ask the user, call a user-input tool, create a control-plane stop file, or change the owner or scope. Required external execution that remains unavailable is classified only by the official review skill.

## Background

The repository-owned harness can prove its collection and rejection logic without credentials, but SDD S12 is complete only after one actual Claude invocation reaches the activated Edge and writable Mac Node. This packet owns that full-cycle qualification, a deterministic redacted evidence artifact at a path stable across task archival, and post-PASS contract/spec synchronization; it contains no fallback to fake evidence.

## Archive Evidence Snapshot

- Prior plan: `agent-task/m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification/plan_cloud_G08_0.log`; prior pristine review stub: `agent-task/m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification/code_review_cloud_G08_0.log`.
- No implementation evidence or official verdict existed. Self-review found that the prior evidence path lived inside the active task directory and would break every contract/spec citation when a PASS archived that directory; it also omitted the matching input-surface spec.
- This replan writes the manifest to `agent-test/evidence/iop-owned-single-request-agent-execution/claude-smoke-evidence.json`, adds `agent-spec/input/openai-compatible-surface.md`, and declares `error-cancel,claude-smoke` evidence contribution so task 23's production change is not treated as full-cycle qualified before this external run. Task 23 remains the sole deterministic S11 error matrix owner.

## Analysis

### Files Read

- `AGENTS.md`
- `agent-ops/rules/project/rules.md`
- `agent-ops/rules/common/rules-roadmap.md`
- `agent-ops/rules/common/rules-agent-spec.md`
- `agent-ops/rules/project/domain/edge/rules.md`
- `agent-ops/rules/project/domain/node/rules.md`
- `agent-ops/rules/project/domain/platform-common/rules.md`
- `agent-ops/rules/project/domain/testing/rules.md`
- `agent-ops/skills/common/router.md`
- `agent-ops/skills/common/plan/SKILL.md`
- `agent-ops/skills/common/code-review/SKILL.md`
- `agent-ops/skills/common/finalize-task-routing/SKILL.md`
- `agent-ops/skills/common/sync-milestone-workstate/SKILL.md`
- `agent-test/local/rules.md`
- `agent-test/local/edge-smoke.md`
- `agent-test/local/node-smoke.md`
- `agent-test/local/platform-common-smoke.md`
- `agent-test/local/testing-smoke.md`
- `agent-test/dev-corp/rules.md` (environment-selection gate only; not selected)
- `agent-test/dev-corp/edge-smoke.md` (external preflight shape only; not selected)
- `agent-test/dev-corp/node-smoke.md` (Mac Node assumptions only; not selected)
- `agent-roadmap/current.md`
- `agent-roadmap/phase/knowledge-tool-optimization-extension/milestones/iop-owned-single-request-agent-execution.md`
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-owned-single-request-agent-execution/SDD.md`
- `agent-spec/index.md`
- `agent-spec/runtime/edge-node-execution.md`
- `agent-spec/input/openai-compatible-surface.md`
- `agent-contract/index.md`
- `agent-contract/outer/anthropic-compatible-api.md`
- `apps/edge/internal/service/single_request_observation.go`
- `apps/edge/internal/service/single_request_metrics.go`
- `apps/edge/internal/service/single_request_observation_test.go`
- `apps/edge/internal/service/single_request_metrics_test.go`
- `apps/edge/internal/openai/anthropic_handler.go`
- `apps/edge/internal/openai/single_request_anthropic_stream.go`
- `apps/edge/internal/openai/single_request_handler_test.go`
- `apps/edge/internal/openai/single_request_anthropic_stream_test.go`
- `Makefile`
- `scripts/e2e-openai-cli-workspace.sh`
- `scripts/e2e-hot-path-agents.sh`
- `scripts/fixtures/hot-path-agent-smoke-manifest.schema.json`
- `agent-task/m-iop-owned-single-request-agent-execution/23+22_error_cancel/plan_cloud_G10_0.log`
- `agent-task/m-iop-owned-single-request-agent-execution/23+22_error_cancel/PLAN-cloud-G10.md`
- `agent-task/m-iop-owned-single-request-agent-execution/24+22_claude_smoke_harness/PLAN-cloud-G07.md`

### SDD Criteria

- Approved, unlocked SDD: `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-owned-single-request-agent-execution/SDD.md`; first-line `milestone-task=error-cancel,claude-smoke` contributes to S11 and S12.
- S11 is implemented/evidenced by task 23's deterministic budget/error/cancel/length/repetition matrix. This packet does not replace that matrix; its actual one-request run supplies the required full-cycle integration evidence for those production changes.
- S12 requires actual Claude in a writable Mac workspace, observed Gemini → ornith-fast → Gemini order, stage-pure/total timing, final file verification, ingress delta one, and terminal one.
- Evidence Map S11/S12 rows drive the dependency gate, one-run identity, exact manifest fields, post-PASS documentation, and common regression commands. Fake/manual/stale evidence cannot satisfy either contribution.

### Verification Context

- No external handoff was supplied. Repository-native inputs are the approved SDD, local test profiles, current ingress/lifecycle observations, and task-24 harness contract.
- Preparation checkout is branch `feature/iop-owned-single-request-agent-execution`, HEAD `06e43f2aba7f42acb407cecb9761f30cbcc1df3c` plus active task packets. Current host is Linux `aarch64` with Go `1.26.2`; Claude exists at `/config/.npm-global/bin/claude`, reports `2.1.223`, and exposes the planned non-interactive flags. The required authorized runner/Mac Node, synchronized binary/config, live logs/metrics, workspace binding, ports/processes, and credential environment were not supplied.
- `dev-corp` is not selected and is not a fallback. No private host, endpoint, alias, config, workspace, or secret is assumed. Task-24 preflight accepts caller-owned values and stores hashes/closed facts only.
- Confidence is high for the deterministic oracle and low for current external executability. If inputs remain unavailable, record exact preflight output/resume condition and stop; official review owns the `external-execution` gate.

#### External Verification Preflight

- Runner/workdir: explicitly authorized synchronized checkout controlling the declared Mac IOP Node; capture `pwd`, OS/arch, branch, HEAD, status, tree/worktree fingerprint, and source sync. Runner OS and Darwin workspace ownership are independent facts.
- Binaries/artifacts: reviewed task-23 runtime, task-24 harness/schema/Make targets, selected Edge/Node binary/config, and Claude binary must match runtime-evidence digests; record only hashes and closed version facts.
- Commands: `claude --version`, Edge help/config check, harness `--preflight-only`, and manifest validator must succeed. Prove listening Messages/metrics ports, append-only observation-log identity, immutable Plan/Work/Review/workspace binding, provider health, and writable disposable workspace.
- Setup/resume: synchronize to reviewed task-23/task-24 source, rebuild/restart selected runtimes, provide live config/log/metrics/workspace and named secret env, create the stable evidence parent, then rerun preflight. Divergence, stale runtime/config, non-Darwin workspace owner, closed port, missing account/provider, or mismatched identity is a hard pre-invocation blocker.

### Test Coverage Gaps

- Repository tests/task-24 self-test cannot prove the installed Claude CLI made one actual request or that real Gemini/ornith-fast/Mac execution produced the timings/file.
- Tasks 23 and 24 are incomplete; this task must not start with only their plans.
- Current outer contract and both living specs defer actual Claude/Mac evidence and change only after a schema-valid real manifest exists.

### Symbol References

No production symbol is renamed. Task 25 consumes completed Make targets, harness modes, schema, ingress metric, lifecycle log, and terminal policy without modifying their owners.

### Split Judgment

- Task 25 is one evidence/document closure packet: its oracle is a schema-valid actual manifest plus common regressions and bounded current-document claims.
- Directory dependencies are siblings 23 and 24. Both currently lack `complete.log`; no archive candidate was read. Implementation/review resolves exactly one completion path for each and reads only those logs.
- Source/runtime preflight, one invocation, fresh offsets, workspace mutation, and atomic manifest are one indivisible run identity.

### Scope Rationale

Include only external preflight, one actual harness run, one stable tracked redacted manifest, validation, and post-PASS outer-contract/two-spec wording. Exclude runtime code, deployment policy, credential storage, default endpoints/models/workspaces, environment selection, multiple prompts/retries, benchmarks, roadmap mutation, raw CLI/provider/log/tool/workspace content, and evidence reconstructed from prose or stale logs.

### Final Routing

- `evaluation_mode=isolated-reassessment`; build/review closures (`scope`, `context`, `verification`, `evidence`, `ownership`, `decision`) are all true because the harness defines a deterministic oracle and explicit external blocker path; capability gap is absent.
- Finalizer `finalize-task-policy.sh`, mode `pair`. Build scores `2/1/1/2/2` => G08, base `local-fit`, final `risk-boundary`, `worker/cloud/G08`, `PLAN-cloud-G08.md`. Review scores `2/1/1/2/2` => G08, `official-review`, `review/cloud/G08`, `CODE_REVIEW-cloud-G08.md`.
- `large_indivisible_context=false`; positive risks are `temporal_state`, `concurrent_consistency`, `boundary_contract`, and `structured_interpretation` (4); `review_rework_count=0`; `evidence_integrity_failure=false`; recovery boundary is false.

## Dependencies and Execution Order

1. Final Verification command 1 must resolve exactly one task-23 and task-24 `complete.log`. Read only them, then reread completed harness/schema/Make targets and terminal/observation runtime.
2. Run credential-free self-test, synchronize/rebuild the selected runtime, create the stable evidence parent, and pass preflight before Claude invocation.
3. Run exactly one credentialed smoke and validate the atomic manifest. No automatic retry; a failed attempt requires an explicit new run identity after repair.
4. Update current contract/specs only after validation; runtime aggregation owns roadmap completion.

## Implementation Checklist

- [ ] Resolve completed task-23/task-24 dependencies, run the harness self-test, and record a full authorized runner/Mac Node/source/binary/config/runtime/port/workspace/credential-name preflight before invocation.
- [ ] Invoke actual Claude exactly once through the harness and atomically produce `agent-test/evidence/iop-owned-single-request-agent-execution/claude-smoke-evidence.json` proving ingress one, Plan/Work/Review order and timing, terminal one, and final workspace verification.
- [ ] Validate the manifest and redaction contract, preserve all raw/secret material outside tracked artifacts, and do not auto-retry or substitute fake/stale evidence.
- [ ] After evidence PASS only, update the Anthropic outer contract and both matching current implementation specs from deferred to qualified with the stable exact evidence path and bounded limits.
- [ ] Run common SDD, proto, document/evidence, and diff verification freshly; if external execution is unavailable, record blocker evidence and stop for official review classification.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [TEST-1] Preflight one authorized runtime identity

**Problem**

`agent-spec/runtime/edge-node-execution.md:170` defers actual Claude/Mac evidence. Running against an arbitrary endpoint or stale binary could create plausible but invalid S12 evidence and mutate the wrong workspace.

**Solution**

Consume task-24 preflight on an authorized runner controlling the declared Mac Node. Require synchronized source/worktree identity, reviewed binary/config/schema hashes, Darwin workspace ownership, fixed-light binding, healthy ports/providers, fresh append-only log/metrics, writable disposable workspace, Claude version, and named-secret presence.

Before (`agent-spec/runtime/edge-node-execution.md:170`):

```text
Actual Claude/Mac timing evidence is explicitly deferred to `claude-smoke` (SDD S12).
```

After preflight, before documentation changes:

```text
The runtime is eligible for one S12 run only when source, binary, config, Mac
workspace, log, metric, provider, CLI, and credential-name facts match.
```

**Modified Files and Checklist**

- [ ] Record actual preflight command/output in `agent-task/m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification/CODE_REVIEW-cloud-G08.md`.
- [ ] Create only the parent of the stable evidence path; do not create a manifest or change docs when preflight fails.

**Test Strategy**

No new code test. Run completed task-24 self-test and real preflight; both exit zero before invocation.

**Verification**

Run Final Verification commands 2 and 3 on the authorized runner.

### [TEST-2] Capture one actual Claude/Mac run at a stable path

**Problem**

S12 cannot be satisfied by fakes, one logical ID, or manual log assembly. The former task-local evidence path would be moved by official PASS archival, immediately invalidating living contract/spec citations.

**Solution**

Use `agent-test/evidence/iop-owned-single-request-agent-execution/claude-smoke-evidence.json`, which is outside the task archive lifecycle. One run identity joins the actual CLI child, ingress counter, fresh stage/terminal observations, and workspace result. Require ingress delta one; roles `plan,work,review`; configured Gemini/ornith-fast/Gemini binding digests; non-negative stage-pure/total time; one `end_turn`; expected file digest; verification exit zero; zero forbidden matches. Store no raw prompts, CLI/provider payloads, endpoints, models, paths, tool data, or secrets.

Before (absence expected until actual PASS):

```sh
test ! -e agent-test/evidence/iop-owned-single-request-agent-execution/claude-smoke-evidence.json
```

After:

```json
{
  "ingress": {"delta": 1},
  "stages": [{"role": "plan"}, {"role": "work"}, {"role": "review"}],
  "terminal": {"count": 1, "kind": "end_turn"},
  "redaction": {"matches": 0}
}
```

**Modified Files and Checklist**

- [ ] Generate `agent-test/evidence/iop-owned-single-request-agent-execution/claude-smoke-evidence.json` atomically through the completed harness.
- [ ] Record actual one-run and validation output in `agent-task/m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification/CODE_REVIEW-cloud-G08.md`.

**Test Strategy**

The actual harness run is the integration test. Validate the exact manifest with `--validate-manifest`; reject missing, duplicate, stale, mismatched, or secret-bearing evidence. Never auto-retry.

**Verification**

Run Final Verification commands 4 and 5 exactly once/once respectively.

### [TEST-3] Record bounded qualification in every current owner

**Problem**

The current outer contract and both matching specs defer S12. Leaving them stale hides valid evidence; citing a task-local path or claiming more than one recorded run overstates it.

**Solution**

After validation only, cite the stable exact manifest in the outer Anthropic contract, runtime spec, and `/v1/messages` input-surface spec. State one ingress, Plan/Work/Review, one terminal, verified workspace result, redacted timing, tested runtime/run identity, and non-benchmark/non-availability limits.

Before (`agent-contract/outer/anthropic-compatible-api.md:131-143`):

```text
Actual Claude/Mac qualification remains outside the current evidence.
```

After:

```text
SDD S12 is qualified only for the runtime/run recorded at the stable manifest:
one ingress, Plan/Work/Review, one terminal, verified workspace result, and
redacted timing; this is not a blanket availability or benchmark claim.
```

**Modified Files and Checklist**

- [ ] Update `agent-contract/outer/anthropic-compatible-api.md` after validation.
- [ ] Update `agent-spec/runtime/edge-node-execution.md` after validation.
- [ ] Update `agent-spec/input/openai-compatible-surface.md` after validation.

**Test Strategy**

No document-only test. The validated manifest backs the bounded claims; deterministic search requires the stable path in all three documents.

**Verification**

Run Final Verification command 8 after manifest validation.

## Modified Files Summary

| File | Items |
|------|-------|
| `agent-test/evidence/iop-owned-single-request-agent-execution/claude-smoke-evidence.json` | TEST-2 |
| `agent-contract/outer/anthropic-compatible-api.md` | TEST-3 |
| `agent-spec/runtime/edge-node-execution.md` | TEST-3 |
| `agent-spec/input/openai-compatible-surface.md` | TEST-3 |
| `agent-task/m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification/CODE_REVIEW-cloud-G08.md` | TEST-1, TEST-2, TEST-3 |

## Final Verification

Fresh output is required; cached tests and reconstructed external evidence are unacceptable.

1. `bash -c 'set -euo pipefail; shopt -s nullglob; for index in 23 24; do candidates=(agent-task/m-iop-owned-single-request-agent-execution/${index}_*/complete.log agent-task/m-iop-owned-single-request-agent-execution/${index}+*/complete.log agent-task/archive/*/*/m-iop-owned-single-request-agent-execution/${index}_*/complete.log agent-task/archive/*/*/m-iop-owned-single-request-agent-execution/${index}+*/complete.log); printf "%s\n" "${candidates[@]}"; ((${#candidates[@]} == 1)); done'` — exactly one completion path for tasks 23 and 24 exists before implementation/review.
2. `make test-single-request-claude-smoke-self-test` — completed credential-free harness suite passes.
3. `mkdir -p agent-test/evidence/iop-owned-single-request-agent-execution && IOP_SINGLE_REQUEST_SMOKE_OUTPUT='agent-test/evidence/iop-owned-single-request-agent-execution/claude-smoke-evidence.json' make test-single-request-claude-smoke-preflight` — authorized runner/Mac Node/source/binary/config/runtime/provider/log/metrics/workspace/CLI/secret-name checks pass before invocation.
4. `IOP_SINGLE_REQUEST_SMOKE_OUTPUT='agent-test/evidence/iop-owned-single-request-agent-execution/claude-smoke-evidence.json' make test-single-request-claude-smoke` — invokes actual Claude exactly once and atomically writes one redacted manifest; never auto-rerun on failure.
5. `./scripts/e2e-single-request-claude.sh --validate-manifest agent-test/evidence/iop-owned-single-request-agent-execution/claude-smoke-evidence.json` — schema, runtime identity, ingress=1, ordered stages/timing, terminal=1, workspace verification, and zero forbidden matches validate.
6. `go test -race -count=1 ./packages/go/config ./packages/go/streamgate ./apps/edge/internal/openai ./apps/edge/internal/service ./apps/node/internal/node ./apps/node/internal/transport ./apps/node/internal/workspace` — approved common SDD regressions pass.
7. `make proto && git diff --exit-code -- proto/gen/iop` — protobuf generation is reproducible and qualification adds no wire delta.
8. `rg --sort path -n 'agent-test/evidence/iop-owned-single-request-agent-execution/claude-smoke-evidence.json|S11|S12|claude-smoke|ingress|Plan|Work|Review|stage|total|terminal|workspace|single run|single-run|qualified' agent-contract/outer/anthropic-compatible-api.md agent-spec/runtime/edge-node-execution.md agent-spec/input/openai-compatible-surface.md agent-test/evidence/iop-owned-single-request-agent-execution/claude-smoke-evidence.json` — documents and evidence state the same stable bounded qualification.
9. `git diff --check` — no whitespace errors.

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