<!-- task=m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification plan=0 tag=TEST milestone-task=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 own 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 external qualification, its deterministic redacted evidence artifact, and the post-PASS contract/spec synchronization; it contains no fallback to fake evidence.

## 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/testing/rules.md`
- `agent-ops/skills/common/router.md`
- `agent-ops/skills/common/plan/SKILL.md`
- `agent-ops/skills/common/finalize-task-routing/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` (Mac/external preflight shape only; not selected)
- `agent-test/dev-corp/node-smoke.md` (Mac Node assumptions only; not selected)
- `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/runtime/edge-node-execution.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/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` (external preflight/invocation/evidence sections)
- `scripts/fixtures/hot-path-agent-smoke-manifest.schema.json` (identity/redaction sections)
- `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`; `milestone-task=claude-smoke` maps to S12.
- S12 requires an actual Claude request in a writable Mac test workspace, observed Gemini → ornith-fast → Gemini stage order, stage-pure/total timing, final file and verification, Edge ingress delta one, and terminal one.
- Evidence Map row S12 requires actual Claude, ingress counter, Edge/Node/provider stage+total logs, and workspace before/after. Those exact fields must be present in `claude-smoke-evidence.json`; a local fake or manual prose summary cannot satisfy the row.

### Verification Context

- No external handoff was supplied. Repository-native inputs are the approved SDD, local test profiles, the current closed observations/ingress metric, and the task-24 harness contract.
- Current preflight: branch `feature/iop-owned-single-request-agent-execution`, HEAD `06e43f2aba7f42acb407cecb9761f30cbcc1df3c`, initially clean; 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, but the required authorized runner/Mac workspace Node runtime, synchronized checkout/binary, Edge config, live log/metrics, workspace binding, ports/processes, and credential environment were not supplied.
- `dev-corp` is not a fallback: its rule explicitly requires the user to select that environment. This plan therefore names no private host, endpoint, model alias, config, workspace, or secret. The task-24 preflight accepts those caller-owned inputs and hashes them into evidence without serializing raw values.
- Confidence is high for the deterministic oracle and low for current executability. If external inputs remain unavailable, the implementer records the exact preflight command/output and resume condition in the review stub and stops; official code review owns the `external-execution` gate.

#### External Verification Preflight

- Runner/workdir: an explicitly authorized runner at its synchronized repository checkout, controlling the declared Mac IOP Node; verify `pwd`, `uname -s`, `uname -m`, branch, HEAD, status, tree/worktree fingerprint, and source sync. Runner OS is recorded, while the workspace owner is independently required to be Darwin.
- Binaries/artifacts: completed task-23 runtime source, task-24 harness/schema, selected Edge/Node binaries and config, and Claude binary must match runtime-evidence digests; capture only hashes and closed version facts.
- Commands: `claude --version`, Edge `--help`/config check, task-24 `--preflight-only`, and manifest validator must succeed. The harness proves listening Messages/metrics ports, append-only observation log identity, configured immutable Plan/Work/Review/workspace binding, and writable disposable workspace before invocation.
- External hosts/OS: workspace execution must reach the declared Mac IOP Node; Plan/Review provider and ornith-fast Work endpoints must be healthy through the selected Edge runtime. No host is assumed until authorized inputs identify it.
- Setup/resume: synchronize the runner to the reviewed task-23/task-24 source, rebuild/restart the selected Edge/Node runtime, supply the live config/log/metrics/workspace and named secret env, then rerun preflight. Dirty/divergent source, stale binary/config, non-Darwin workspace owner, closed port, missing CLI/account/provider, or mismatched identity is a hard pre-invocation blocker.

### Test Coverage Gaps

- Repository tests and task-24 self-test cannot prove the installed Claude CLI made one real request or that real Gemini/ornith-fast/Mac workspace execution produced the observed durations/files.
- Until tasks 23 and 24 complete, the exact terminal policy and manifest validator are unavailable. This task must not start with only their plans present.
- The current contract/spec explicitly defer actual Claude/Mac evidence and must change only after a schema-valid real manifest exists.

### Symbol References

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

### Split Judgment

- Task 25 is an evidence-and-document closure packet, independent from repository-owned harness implementation. Its PASS oracle is one schema-valid actual manifest plus unchanged common regressions and current document claims.
- Directory dependencies are sibling 23 and 24. Both new active task directories currently lack `complete.log`; no archive candidate was read. Implementation/review must resolve exactly one completion path for each and read only those logs before proceeding.
- The external run cannot be decomposed further: source/runtime preflight, one invocation, fresh metric/log offsets, workspace mutation, and atomic manifest belong to the same run identity.

### Scope Rationale

Include only external preflight, one actual harness run, deterministic tracked redacted evidence, validation, and post-PASS outer-contract/spec wording. Exclude runtime code changes, deployment policy, credential storage, default endpoints/models/workspaces, dev-corp selection, multiple prompts, benchmark comparisons, roadmap mutation, and any evidence reconstructed from prose or stale logs.

### Final Routing

- `evaluation_mode=first-pass`; build/review closures are all true because the harness defines a deterministic oracle and external ownership/blocker path; no cloud-resolvable capability gap is claimed.
- Build scores `2/1/1/2/2` => G08, base `local-fit`; four loop risks select `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 loop risks are `temporal_state`, `concurrent_consistency`, `boundary_contract`, and `structured_interpretation` (4). `review_rework_count=0`; `evidence_integrity_failure=false`; finalizer `finalize-task-policy.sh`, mode `pair`.

## Dependencies and Execution Order

1. Final Verification command 1 must resolve exactly one task-23 and one task-24 `complete.log`. Read only those logs, then read the completed harness/schema/Make targets and runtime terminal/observation code.
2. Run credential-free self-test, synchronize/rebuild the selected external runtime, and pass external preflight before any Claude invocation.
3. Run exactly one credentialed smoke and validate the atomically written manifest. Do not retry automatically; any failure needs a new explicit run identity after its precondition is repaired.
4. Update current contract/spec only after the real manifest validates; leave roadmap completion to runtime aggregation.

## 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 produce the deterministic redacted `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 current implementation spec from S12 deferred to qualified with the exact evidence path and 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**

The current host is Linux and has no supplied Mac/runtime handoff. Running Claude against an arbitrary reachable endpoint or stale binary would create plausible but invalid S12 evidence and could mutate an unintended workspace.

**Solution**

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

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 every source, binary, config,
Mac workspace, log, metric, provider, CLI, and credential-name fact matches the
caller-supplied runtime-evidence digest set.
```

**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`.
- [ ] Do not create the evidence artifact or modify current docs when preflight fails.

**Test Strategy**

No new code test is written. Run the completed task-24 self-test first, then its real `preflight` target. The preflight exit status and output are the deterministic gate.

**Verification**

Run `make test-single-request-claude-smoke-self-test` followed by the exact preflight command in Final Verification on the authorized runner; both must exit zero before invocation.

### [TEST-2] Capture one actual Claude/Mac run

**Problem**

S12 cannot be satisfied by in-process fakes, one logical request ID, or manually collected logs. One run identity must join the actual CLI child, Edge ingress counter, fresh stage/terminal observations, and workspace result.

**Solution**

Run the completed harness once with the deterministic output path below. Require metric delta one, stage roles exactly `plan,work,review`, configured binding digests for Gemini/ornith-fast/Gemini, non-negative stage-pure and total timing, one `end_turn` terminal, expected final file digest, verification exit zero, and zero forbidden matches. Do not retain raw Claude output, prompts, provider payloads, endpoints, models, paths, or secret values in the repository.

Before (new evidence file; absence is expected until a real PASS run):

```sh
test ! -e agent-task/m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification/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-task/m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification/claude-smoke-evidence.json` atomically through the completed harness.
- [ ] Record the actual one-run and validation command/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 artifact through `--validate-manifest`; reject missing, duplicate, stale, mismatched, or secret-bearing evidence. There is no automatic retry.

**Verification**

Run the credentialed target once and validate the exact manifest with Final Verification commands 3 and 4.

### [TEST-3] Record qualification without overstating scope

**Problem**

The current outer contract and implementation spec say S12 is deferred. After a valid real manifest, leaving that text stale hides qualification; claiming more than the single tested runtime/run would overstate evidence.

**Solution**

Change only the current outer contract and implementation spec. Cite the deterministic task evidence path, the single-run/runtime scope, stage/ingress/terminal/workspace criteria, and privacy limits. Do not generalize to other modes, protocols, models, workspaces, or ongoing availability.

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

```text
The contract defines one marked stream and generic deterministic behavior; actual
Claude/Mac qualification remains outside the current evidence.
```

After:

```text
SDD S12 is qualified for the recorded runtime/run in the task evidence manifest:
one ingress, Plan/Work/Review, one terminal, verified workspace result, and
redacted stage/total timing. This is not a blanket availability or benchmark claim.
```

**Modified Files and Checklist**

- [ ] Update `agent-contract/outer/anthropic-compatible-api.md` only after manifest validation.
- [ ] Update `agent-spec/runtime/edge-node-execution.md` source evidence, feature/verification/limitation/history text only after manifest validation.

**Test Strategy**

No document-only test is added. The validated manifest backs the claims; deterministic search ensures `deferred` is removed only for S12 and the single-run limitation remains explicit.

**Verification**

Run the document/evidence searches in Final Verification after the real artifact validates.

## Modified Files Summary

| File | Items |
|------|-------|
| `agent-task/m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification/claude-smoke-evidence.json` | TEST-2 |
| `agent-contract/outer/anthropic-compatible-api.md` | TEST-3 |
| `agent-spec/runtime/edge-node-execution.md` | TEST-1, 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 test output and reconstructed external evidence are not acceptable.

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'` — prints exactly one task-23 and one task-24 completion path and exits zero before implementation or review.
2. `make test-single-request-claude-smoke-self-test` — the completed credential-free harness suite passes on the synchronized source.
3. `IOP_SINGLE_REQUEST_SMOKE_OUTPUT='agent-task/m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification/claude-smoke-evidence.json' make test-single-request-claude-smoke-preflight` — on the authorized runner controlling the Mac Node, source/binary/config/runtime/ports/providers/log/metrics/workspace/CLI/secret-name checks pass before invocation.
4. `IOP_SINGLE_REQUEST_SMOKE_OUTPUT='agent-task/m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification/claude-smoke-evidence.json' make test-single-request-claude-smoke` — invokes actual Claude exactly once and atomically writes one redacted manifest; do not rerun automatically on failure.
5. `./scripts/e2e-single-request-claude.sh --validate-manifest agent-task/m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification/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 SDD common regressions pass freshly on the qualification source.
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 '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-task/m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification/claude-smoke-evidence.json` — documents and evidence state the exact bounded qualification.
9. `git diff --check` — no whitespace errors.

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