<!-- task=m-iop-owned-single-request-agent-execution/22+21_executor_activation plan=0 tag=API milestone-task=review-stage -->

# Code Review Reference - API

> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> Complete the fixed checklists and evidence fields, leave both active files in place, and report ready for review. Only the official review agent may append a verdict, archive files, write `complete.log`, or classify the next state. If blocked, record the blocker, attempted commands/output, and resume condition here; do not change owner or scope.

## Overview

date=2026-08-07
task=m-iop-owned-single-request-agent-execution/22+21_executor_activation, plan=0, tag=API

## For the Review Agent

Compare every item with source and freshly rerun recorded verification. Then append the official verdict and routing signals. On PASS, archive this file as `code_review_cloud_G07_0.log`, archive the plan as `plan_local_G07_0.log`, write `complete.log` preserving `milestone-task=review-stage`, and move the task directory to the dated archive. On WARN/FAIL, write only the next state prescribed by the code-review skill. The implementing agent must not perform these steps.

## Archive Evidence Snapshot

- Pre-refine parent plan: checkpoint `f4dad6ba88ae442e08ab67f49a5b1a65dd4719e9`, `agent-task/m-iop-owned-single-request-agent-execution/20+19_review_stage/PLAN-cloud-G09.md`.
- Pre-refine parent review: checkpoint `f4dad6ba88ae442e08ab67f49a5b1a65dd4719e9`, `agent-task/m-iop-owned-single-request-agent-execution/20+19_review_stage/CODE_REVIEW-cloud-G09.md`.
- The checkpoint pair contains no implementation evidence or official verdict; refinement split it once into three scope-preserving children. No active-log path is required after predecessor archival.

## Implementation Item Completion

| Item | Status |
|------|---------|
| API-1 Install and synchronize the active contract | [x] |

## Implementation Checklist

- [x] Install the completed composite at Edge input startup through the existing setter and prove production construction no longer leaves the executor unset.
- [x] Add installation/unavailable-regression coverage without adding a public getter or changing the Anthropic request/event schema.
- [x] Update the current outer contract and implementation spec with active stage order, private provider outcomes, generic failure behavior, local evidence, and explicit S12 deferral.
- [x] Run dependency, installation, changed-path regression, vet, broader Edge, deterministic constructor/document search, and diff checks.
- [x] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

## Review-Only Checklist

> **[REVIEW AGENT ONLY]** Implementing agents must not modify this section.

- [x] Append one `PASS`, `WARN`, or `FAIL` verdict with verified `review_rework_count` and `evidence_integrity_failure`.
- [x] Verify verdict, dimension assessment, and Required/Suggested/Nit classifications agree.
- [x] Archive this file to `code_review_cloud_G07_0.log` and the plan to `plan_local_G07_0.log`.
- [x] Verify `.gitignore` unignores task Markdown/log files and ignores `agent-roadmap/current.md`.
- [ ] On PASS, write template-compliant `complete.log`, preserve/report `milestone-task=review-stage`, move the task directory to the dated archive, and remove the active parent only if empty.
- [x] On WARN/FAIL, write the exact next filesystem state and do not write `complete.log`.

## Deviations from Plan

None.

## Key Design Decisions

Installed the completed single-request executor into Service during Edge input startup in `apps/edge/internal/input/manager.go` after Service initialization. Added installation regression test in `apps/edge/internal/input/manager_test.go` verifying that `Service.StartSingleRequest` no longer returns `ErrSingleRequestExecutorUnavailable` after `NewManager` is invoked. Synchronized outer contract and runtime spec to document active stage execution while keeping external qualification deferred to S12.

## Reviewer Checkpoints

- Verify production construction uses the completed executor constructor and existing setter without new public accessors or schema changes.
- Verify installation happens only after dependencies exist and the regression fixture distinguishes installed behavior from the prior unavailable path.
- Verify the outer contract/spec claim only deterministic local activation and explicitly defer actual Claude/provider qualification to S12.

## Verification Results

Paste actual stdout/stderr for every command. Any replacement requires a matching `Deviations from Plan` entry.

### 1. Dependency evidence

`bash -c 'set -euo pipefail; shopt -s nullglob; candidates=(agent-task/m-iop-owned-single-request-agent-execution/21_*/complete.log agent-task/m-iop-owned-single-request-agent-execution/21+*/complete.log agent-task/archive/*/*/m-iop-owned-single-request-agent-execution/21_*/complete.log agent-task/archive/*/*/m-iop-owned-single-request-agent-execution/21+*/complete.log); printf "%s\n" "${candidates[@]}"; ((${#candidates[@]} == 1))'`

Expected: exactly one predecessor completion path and exit zero.

```text
agent-task/archive/2026/08/m-iop-owned-single-request-agent-execution/21+20_single_request_executor/complete.log
```

### 2. Production installation

`go test ./apps/edge/internal/input -run 'TestManager.*SingleRequestExecutor' -count=1`

```text
ok  	iop/apps/edge/internal/input	0.026s
```

### 3. Changed-path regression

`go test ./apps/edge/internal/service ./apps/edge/internal/openai ./apps/edge/internal/input -count=1`

```text
ok  	iop/apps/edge/internal/service	3.882s
ok  	iop/apps/edge/internal/openai	0.985s
ok  	iop/apps/edge/internal/input	0.016s
```

### 4. Vet and Edge regression

`go vet ./apps/edge/internal/service ./apps/edge/internal/openai ./apps/edge/internal/input && go test ./apps/edge/... -count=1`

```text
ok  	iop/apps/edge/internal/authprojection	0.047s
ok  	iop/apps/edge/internal/bootstrap	0.448s
ok  	iop/apps/edge/internal/configrefresh	0.096s
ok  	iop/apps/edge/internal/controlplane	6.615s
ok  	iop/apps/edge/internal/edgecmd	0.101s
ok  	iop/apps/edge/internal/edgevalidate	0.067s
ok  	iop/apps/edge/internal/events	0.050s
ok  	iop/apps/edge/internal/input	0.082s
ok  	iop/apps/edge/internal/input/a2a	0.067s
ok  	iop/apps/edge/internal/node	0.062s
ok  	iop/apps/edge/internal/openai	8.104s
ok  	iop/apps/edge/internal/opsconsole	0.034s
ok  	iop/apps/edge/internal/service	6.487s
ok  	iop/apps/edge/internal/transport	4.788s
```

### 5. Production constructor evidence

`rg --sort path -n 'NewSingleRequestExecutor|SetSingleRequestExecutor' apps/edge/internal/openai apps/edge/internal/input --glob '*.go'`

```text
apps/edge/internal/openai/single_request_executor.go:20:// NewSingleRequestExecutor constructs a production composite single-request executor
apps/edge/internal/openai/single_request_executor.go:22:func NewSingleRequestExecutor(service edgeserviceRunner) *SingleRequestExecutor {
apps/edge/internal/openai/single_request_executor_test.go:81:	service.SetSingleRequestExecutor(executor)
apps/edge/internal/openai/single_request_executor_test.go:121:	executor := NewSingleRequestExecutor(&mockService{})
apps/edge/internal/openai/single_request_executor_test.go:148:	executor := NewSingleRequestExecutor(mockSvc)
apps/edge/internal/openai/single_request_executor_test.go:199:	executor := NewSingleRequestExecutor(mockSvc)
apps/edge/internal/openai/single_request_executor_test.go:246:	executor := NewSingleRequestExecutor(mockSvc)
apps/edge/internal/openai/single_request_executor_test.go:329:	executor := NewSingleRequestExecutor(mockSvc)
apps/edge/internal/openai/single_request_executor_test.go:452:	executor := NewSingleRequestExecutor(mockSvc)
apps/edge/internal/openai/single_request_executor_test.go:487:		executor := NewSingleRequestExecutor(mockSvc)
apps/edge/internal/openai/single_request_executor_test.go:522:		executor := NewSingleRequestExecutor(mockSvc)
apps/edge/internal/openai/single_request_executor_test.go:564:		executor := NewSingleRequestExecutor(mockSvc)
apps/edge/internal/openai/single_request_executor_test.go:599:	executor := NewSingleRequestExecutor(mockSvc)
apps/edge/internal/openai/single_request_executor_test.go:646:		executor := NewSingleRequestExecutor(mockSvc)
apps/edge/internal/openai/single_request_executor_test.go:701:		executor := NewSingleRequestExecutor(mockSvc)
apps/edge/internal/openai/single_request_executor_test.go:762:		executor := NewSingleRequestExecutor(mockSvc)
apps/edge/internal/openai/single_request_handler_test.go:77:	svc.SetSingleRequestExecutor(executor)
apps/edge/internal/openai/single_request_handler_test.go:403:	service.SetSingleRequestExecutor(executor)
apps/edge/internal/openai/single_request_review_stage_test.go:268:	service.SetSingleRequestExecutor(executor)
apps/edge/internal/openai/single_request_work_stage_test.go:347:	service.SetSingleRequestExecutor(executor)
apps/edge/internal/input/manager.go:27:		svc.SetSingleRequestExecutor(edgeopenai.NewSingleRequestExecutor(svc))
```

### 6. Contract/spec synchronization

`rg --sort path -n 'Plan|Work|Review|repair|active|claude-smoke|S12|deferred' agent-contract/outer/anthropic-compatible-api.md agent-spec/runtime/edge-node-execution.md`

```text
agent-contract/outer/anthropic-compatible-api.md:175:single-request executor driving the active Plan -> Work -> Review stage pipeline with
agent-contract/outer/anthropic-compatible-api.md:177:while actual external Claude qualification remains explicitly deferred to S12 (`claude-smoke`).
agent-spec/runtime/edge-node-execution.md:197:| Plan stage | The Plan runner emits the `planning` envelope, sends the immutable task through the frozen Gemini Chat binding with `reasoning_effort=high`, requires one strict small `plan`/`verification` JSON result, and writes deterministic bounded Markdown through `SingleRequestArtifactPlan`. |
agent-spec/runtime/edge-node-execution.md:198:| Work stage | The `ornith-fast` Work runner reads the closed PLAN artifact, projects only the admitted workspace tools, and resumes the same frozen provider route after exactly correlated Node results. It rejects any Work `reasoning_effort`, malformed or multiple tool calls, and empty completion or verification evidence. |
agent-spec/runtime/edge-node-execution.md:221:- The private Plan stage is installed in the composite single-request executor at Edge input startup (`apps/edge/internal/input/manager.go`). Its provider codec accepts only frozen Plan options and selected dispatch facts, uses the admitted stage deadline and exact output limit, accepts only `RESPONSE_START`, zero or more `BODY`, then `END`, and projects all provider failures to a generic internal failure. The fixed Plan prompt requests a small plan plus verification criteria and writes only the closed PLAN artifact.
agent-spec/runtime/edge-node-execution.md:222:- The private Work stage is installed in the composite single-request executor at Edge input startup (`apps/edge/internal/input/manager.go`). It reads only `SingleRequestArtifactPlan`, retains only request/stage/tool identifiers while waiting for the coordinator-owned continuation, and sends no `reasoning_effort` field in an initial or resumed provider request. Its provider messages contain the immutable task, PLAN, admitted tool schemas, and bounded typed tool results; Review/repair and composite installation are active, while external Claude qualification remains explicitly deferred to S12 (`claude-smoke`).
agent-spec/runtime/edge-node-execution.md:322:- The composite single-request executor is installed at Edge input startup (`apps/edge/internal/input/manager.go`), wiring the active Plan -> Work -> Review stage pipeline for single-request execution. Private stage provider outcomes use generic failure behavior. Deterministic local activation is proven, while actual external Claude qualification remains explicitly deferred to S12 (`claude-smoke`).
agent-spec/runtime/edge-node-execution.md:327:- 2026-08-07: Installed the composite single-request executor at Edge input startup (`apps/edge/internal/input/manager.go`), activating the Plan -> Work -> Review stage pipeline. Production construction evidence is test-covered (`apps/edge/internal/input/manager_test.go`), while actual Claude/Mac external qualification remains explicitly deferred to S12 (`claude-smoke`).
```

### 7. Diff hygiene

`git diff --check`

```text
```

External qualification remains S12 `claude-smoke`.

---

> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?**
> Leave review-agent-only sections unchanged.

## Section Ownership

| Section | Owner | Note |
|---------|-------|------|
| Header, Overview, Review Agent Instructions | Fixed at stub creation | Implementing agent must not change finalization metadata |
| Archive Evidence Snapshot | Fixed at stub creation | Read only cited prior evidence when needed |
| Implementation Item Completion and Checklist text/order | Fixed at stub creation | Implementing agent changes only `[ ]` to `[x]` |
| Review-Only Checklist | Review agent | Implementing agent must not modify it |
| Deviations, Key Design Decisions | Implementing agent | Replace placeholders with actual evidence |
| Reviewer Checkpoints and verification commands | Fixed at stub creation | Implementing agent fills output only; command changes require a deviation |
| Code Review Result | Review agent appends | Not present in this stub |

## Code Review Result

- **Overall Verdict:** FAIL
- **Dimension Assessment:**
  - Correctness: Pass — production construction installs the completed executor through the existing setter, and fresh focused and broader Edge tests pass.
  - Completeness: Fail — the current input-surface living spec still describes implemented stage drivers and artifact cleanup as deferred.
  - Test Coverage: Pass — the installation regression distinguishes the prior unavailable path, and the recorded changed-package and Edge regressions pass freshly.
  - API Contract: Pass — the Anthropic outer contract describes the active private pipeline, generic private-stage failure behavior, and explicit S12 deferral without changing the request/event schema.
  - Code Quality: Pass — the installation is localized to the production input construction seam and adds no public accessor or unrelated runtime behavior.
  - Implementation Deviation: Fail — synchronization stopped at the runtime spec even though the matching current input-surface spec now contradicts the installed production behavior.
  - Verification Trust: Pass — every recorded command was rerun successfully, and the captured outputs match the current checkout.
  - Spec Conformance: Pass — the implementation and deterministic predecessor evidence satisfy the SDD S10 review-stage activation boundary while leaving S12 external qualification open.
- **Findings:**
  - **Required R1** — `agent-spec/input/openai-compatible-surface.md:296`: the current living spec says provider-specific Plan/Work/Review stage drivers and request-artifact cleanup remain deferred, contradicting the installed composite at `apps/edge/internal/input/manager.go:27`, the active outer contract, and the runtime spec. Update the input-surface spec's current behavior/evidence and limitation text to describe the installed active pipeline and defer only S12 external Claude qualification; add a deterministic search that rejects the stale current-state claim.
- **Routing Signals:** `review_rework_count=1`, `evidence_integrity_failure=false`
- **Next Step:** Invoke the plan skill in `prepare-follow-up` mode with R1 as a repository-owned direct fix, then archive this pair and materialize the freshly routed follow-up pair.
