<!-- task=m-iop-owned-single-request-agent-execution/08+03,07_workspace_admission plan=0 tag=API milestone-task=workspace-binding -->

# Code Review Reference - API

> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> The task is NOT complete until every implementation-owned section below is filled in.
> Complete the `Implementation Checklist`; the final checklist item is mandatory before saving.
> Fill implementation-owned sections, then stop with active files in place and report ready for review.
> Execute the plan's selected root cause, scope, files, and dependency decisions as written. Do not choose another owner, narrow/expand the write boundary, or replace a fix with another verification attempt.
> If implementation is blocked, record the exact blocker, attempted commands/output, and resume condition only in implementation-owned evidence fields.
> Do not ask the user directly, present choices, call user-input tools, create control-plane stop files, or classify the next state.
> Finalization (`Code Review Result`, log rename, `complete.log`, archive moves, `Review-Only Checklist`) is review-agent-only, even after compaction/resume.
> Follow the ownership table at the bottom of this file for which sections you own.

## Overview

date=2026-08-06
task=m-iop-owned-single-request-agent-execution/08+03,07_workspace_admission, plan=0, tag=API

## For the Review Agent

> **[REVIEW AGENT ONLY]** The finalization steps below are review-agent only. Implementing agents must not execute this section.

Compare implementation of each item against source files and verify that output in `Verification Results` matches code.
Review completion means the following steps are finished:

1. Append verdict and `review_rework_count` / `evidence_integrity_failure` routing signals.
2. Archive `CODE_REVIEW-cloud-G09.md` → `code_review_cloud_G09_0.log` and `PLAN-cloud-G08.md` → `plan_cloud_G08_0.log`.
3. If PASS, write `complete.log` and move active task directory to `agent-task/archive/YYYY/MM/m-iop-owned-single-request-agent-execution/08+03,07_workspace_admission/`. If WARN/FAIL, fully write the next filesystem state required by the code-review skill.
4. If PASS, preserve the first-line `milestone-task=workspace-binding` metadata in `complete.log` and report it for runtime aggregation. Roadmap state evaluation belongs to `sync-milestone-workstate`.
5. Check applicable `Review-Only Checklist` items at the final `.log` location before reporting.

---

## Implementation Item Completion

| Item | Status |
|------|---------|
| API-1 Snapshot exact ready workspace ownership | [ ] |
| API-2 Bind workspace before single-request execution | [ ] |

## Implementation Checklist

- [ ] Freeze each approved workspace ref to one configured Node id, ready connection generation, closed operation/command ids, and effective limits without raw root/template leakage.
- [ ] Fail before executor startup on missing, foreign, pending, stale, malformed, or unsupported workspace ownership and prohibit fallback/reselection.
- [ ] Prove admission immutability and reconnect/refresh races, then synchronize the runtime living spec.
- [ ] Run exact dependency, focused race, package, vet, documentation, and whitespace verification.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

## Review-Only Checklist

> **[REVIEW AGENT ONLY]** This checklist is used only by the review agent. Implementing agents must not modify or check this section.

- [x] Append one verdict of `PASS`, `WARN`, or `FAIL` and verified routing signals.
- [x] Verify verdict, dimensions, and finding classifications.
- [x] Archive active review and plan to the routed log names above.
- [x] Verify the Agent-Ops managed block in `.gitignore`.
- [ ] If PASS, write `complete.log` and leave no active files in this directory.
- [ ] If PASS, move this directory to `agent-task/archive/YYYY/MM/m-iop-owned-single-request-agent-execution/08+03,07_workspace_admission/`.
- [ ] If PASS, preserve/report Milestone metadata without editing roadmap state directly.
- [x] Retain the active task-group parent while sibling work remains.
- [x] If WARN/FAIL, write the next filesystem state and do not write `complete.log`.

## Deviations from Plan

_Record any deviations from the plan and the rationale here._

## Key Design Decisions

_Record key design decisions here._

## Reviewer Checkpoints

- Confirm exact ref-to-configured-node resolution and no caller Node/path fallback.
- Confirm the snapshot copies generation/capabilities and executor start happens only afterward.
- Confirm reconnect and refresh cannot retarget an admitted request.
- Confirm raw roots, executable paths, fixed args, and environment values do not enter the coordinator-facing binding.

## Verification Results

Paste actual stdout/stderr under each command; command substitutions require a recorded deviation.

### 1. Packet 03 dependency

`test -f agent-task/m-iop-owned-single-request-agent-execution/03+02_single_request_coordinator/complete.log || test "$(compgen -G 'agent-task/archive/*/*/m-iop-owned-single-request-agent-execution/03+02_single_request_coordinator/complete.log' | wc -l)" -eq 1`

```text
[fill]
```

### 2. Packet 07 dependency

`test -f agent-task/m-iop-owned-single-request-agent-execution/07+04_workspace_catalog/complete.log || test "$(compgen -G 'agent-task/archive/*/*/m-iop-owned-single-request-agent-execution/07+04_workspace_catalog/complete.log' | wc -l)" -eq 1`

```text
[fill]
```

### 3. Registry race test

`go test -race ./apps/edge/internal/node -run 'TestRegistryReadyOwnerSnapshot' -count=1`

```text
[fill]
```

### 4. Admission race test

`go test -race ./apps/edge/internal/service -run 'TestSingleRequestWorkspace' -count=1`

```text
[fill]
```

### 5. Package regression

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

```text
[fill]
```

### 6. Vet

`go vet ./apps/edge/internal/node ./apps/edge/internal/service`

```text
[fill]
```

### 7. Spec search

`rg --sort path -n 'workspace_ref|connection generation|admission|reselect|defer' agent-spec/runtime/edge-node-execution.md`

```text
[fill]
```

### 8. Whitespace

`git diff --check`

```text
[fill]
```

---

> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?**
> If anything is blank, go back and fill it in before saving this file.
> Leave review-agent-only sections unchanged.

## Section Ownership

| Section | Owner | Note |
|---------|-------|------|
| Header comment, Overview, Review Agent Instructions | Fixed at stub creation | Implementing agent must not modify or execute these (archive, complete.log, and task-directory archive move are review-agent only) |
| Archive Evidence Snapshot | Fixed at stub creation from plan when present | Implementing agent uses it as default prior-loop context; read only the specific archive files cited there when more detail is required |
| Implementation Item Completion (item names) | Fixed at stub creation | Implementing agent checks `[ ]` → `[x]` only |
| Implementation Checklist (item text/order) | Fixed at stub creation from plan | Implementing agent checks `[ ]` → `[x]` only |
| Review-Only Checklist | Review agent only | Implementing agent must not modify or check this section |
| Deviations from Plan, Key Design Decisions | Implementing agent | Replace placeholder text with actual content |
| Reviewer Checkpoints | Fixed at stub creation | Pre-filled from plan |
| Verification Results (section headings + commands) | Fixed at stub creation | Implementing agent fills in command output only; command changes require a `Deviations from Plan` entry |
| Code Review Result | Review agent appends | Not included in stub |

## Code Review Result

- Overall Verdict: FAIL
- Dimension Assessment:
  - Correctness: Fail — the public service path can bypass workspace admission, and valid operation-specific workspace catalogs are rejected by unconditional limit validation.
  - Completeness: Fail — the planned admission test file, living-spec synchronization, implementation notes, checklist completion, and verification evidence are missing.
  - Test Coverage: Fail — the exact admission race command exits successfully with `[no tests to run]`, and the registry test exercises reconnect only sequentially.
  - API Contract: Fail — `StartSingleRequest` does not universally enforce approved workspace ownership before executor startup, and its limit projection is stricter than the accepted workspace catalog contract.
  - Code Quality: Pass — the snapshot and binding helpers are structured and avoid raw root/template leakage.
  - Implementation Deviation: Fail — `service.go` changed outside the declared modified-files boundary without a recorded deviation, while the declared test file was not created.
  - Verification Trust: Fail — all implementation-owned evidence remains unfilled, and one mandatory focused command runs no matching test.
  - Spec Conformance: Fail — SDD scenario S04 has no admission-matrix evidence and the living spec still defers concrete workspace admission.
- Findings:
  - Required R1 — `apps/edge/internal/service/service.go:85`: `StartSingleRequest` explicitly sends a zero-value `Service` directly to `startSingleRequest`, allowing an executor to start with only an opaque ref and no configured owner, ready generation, or capability snapshot. Remove this public-path bypass; coordinator-only tests can call the internal coordinator helper or construct an admitted service fixture.
  - Required R2 — `apps/edge/internal/service/single_request_workspace.go:95`: admission requires all four workspace limits to be positive, while `packages/go/config/load.go:629` requires positive limits only for enabled operations. A valid read-only or write-only catalog is therefore rejected. Validate and clone limits according to `OperationIDs`, preserve zero for disabled operations, and add regression coverage for partial capability sets and effective preset minima.
  - Required R3 — `agent-task/m-iop-owned-single-request-agent-execution/08+03,07_workspace_admission/CODE_REVIEW-cloud-G09.md:107`: the planned `TestSingleRequestWorkspace` coverage does not exist; the exact command returned `ok ... [no tests to run]`. `apps/edge/internal/node/registry_test.go:300` also performs reconnect sequentially, so `-race` does not prove the planned snapshot/reconnect race. Add the declared service admission matrix and concurrent registry/service race tests, including executor non-invocation and immutable binding assertions.
  - Required R4 — `agent-spec/runtime/edge-node-execution.md:128`: the living spec still says concrete Node/workspace admission is deferred and contains no `workspace_ref` admission contract, contradicting this packet's intended implemented state. Document exact catalog-owner resolution, ready connection-generation fencing, closed capability projection, no reselection, and the narrower executor/wire deferral.
  - Required R5 — `agent-task/m-iop-owned-single-request-agent-execution/08+03,07_workspace_admission/CODE_REVIEW-cloud-G09.md:35`: both implementation items, all implementation checklist entries, deviations, design decisions, and all eight command outputs remain unfilled. Record the `service.go` write-boundary deviation, fill the implementation-owned evidence with actual fresh output, and do not leave a mandatory command green through an empty test selection.
- Routing Signals:
  - `review_rework_count=1`
  - `evidence_integrity_failure=false`
- Next Step: Invoke the plan skill in `prepare-follow-up` mode with Required R1-R5 and materialize the freshly routed follow-up PLAN/CODE_REVIEW pair after archiving this pair.
