<!-- task=m-iop-agent-cli-runtime/26+19,21,22,23,25_parity_cutover plan=1 tag=REFACTOR -->

# Code Review Reference - REFACTOR

> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> Complete every implementation-owned field, keep active files in place, and report ready for review.
> If dependency 25 is incomplete, record dependency waiting only. Do not ask the user, create stop files, archive artifacts, or write `complete.log`.

## Overview

date=2026-07-30
task=m-iop-agent-cli-runtime/26+19,21,22,23,25_parity_cutover, plan=1, tag=REFACTOR

## Roadmap Targets

- Milestone: `agent-roadmap/phase/automation-runtime-bridge/milestones/iop-agent-cli-runtime.md`
- Milestone link: [Milestone document](agent-roadmap/phase/automation-runtime-bridge/milestones/iop-agent-cli-runtime.md)
- Task ids:
  - `parity-cutover`: classify Python/Node behavior and cut production task-loop ownership to Go with zero unclassified/runtime dependency/duplicate
- Completion mode: check-on-pass

## Archive Evidence Snapshot

- Superseded plan: `agent-task/m-iop-agent-cli-runtime/26+19,21,22,23,25_parity_cutover/plan_cloud_G10_0.log`
- Superseded review stub: `agent-task/m-iop-agent-cli-runtime/26+19,21,22,23,25_parity_cutover/code_review_cloud_G10_0.log`
- Supersession reason: the sibling task 25 review proved that composition-after-smoke created a dependency cycle. The prior pair was unstarted and had no verdict or implementation evidence.
- Preserved scope: S13 disposition completeness, Go operator cutover, zero stale Python/static/Node ownership, and Python disposal inventory.
- Removed scope: standalone workflow/provider/recovery/evidence/review/integration adapters and manager/daemon composition; those are owned and verified by predecessor 25.

## For the Review Agent

> **[REVIEW AGENT ONLY]** Implementing agents must not execute finalization.

Require predecessor 25 completion, zero unclassified rows, zero Python production callers/static ownership/Node duplicate, and checksum-bound disposal evidence. Archive this pair as `code_review_cloud_G07_1.log` and `plan_cloud_G07_1.log`.

## Implementation Item Completion

| Item | Status |
|------|--------|
| REFACTOR-1 Manifest | [x] |
| REFACTOR-2 Thin Go operator | [x] |
| REFACTOR-3 Skill/guards | [x] |
| REFACTOR-4 Contract evidence | [x] |

## Implementation Checklist

- [x] Create a machine-validated disposition and disposal manifest covering every Python dispatcher/selector/observation and Node reference behavior.
- [x] Add a thin Go task-loop operator command over predecessor 25's authoritative runtime without duplicating lifecycle, policy, provider, review, or integration logic.
- [x] Redirect the project orchestration skill and testing ownership to the Go command and remove static model/route/capacity ownership from those surfaces.
- [x] Add deterministic guards for zero unclassified rows, zero Python production callers/fallbacks, zero stale static policy text, and zero Node duplicate implementation.
- [x] Record exact Python reference paths/checksums and the Milestone-completion deletion/verification procedure without deleting reference fixtures.
- [x] Update the standalone contract with S13 sources and run fresh parity, dry-run, package, vet, zero-match, and diff verification.
- [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 checklist.

- [x] Append one verdict and verified routing signals.
- [x] Verify dimensions, findings, and every zero-match claim.
- [x] Archive `CODE_REVIEW-cloud-G07.md` as `code_review_cloud_G07_1.log`.
- [x] Archive `PLAN-cloud-G07.md` as `plan_cloud_G07_1.log`.
- [x] Verify the Agent-Ops managed `.gitignore` block.
- [ ] If PASS, write canonical `complete.log`, move the task to the dated archive, and update this checklist there.
- [ ] If PASS, report `parity-cutover` completion metadata without editing the roadmap.
- [x] If WARN/FAIL, materialize the exact next state without `complete.log`.

## Deviations from Plan

None. The configuration-free dry-run path uses the same Go workflow parser for
structural inspection only; configured dry-runs and live passes use the
registered authoritative runtime projection.

## Key Design Decisions

- The S13 manifest is embedded, schema-validated, path-validated, and
  checksum-validated. Retained references remain fixtures until the documented
  Milestone-completion deletion gate.
- `task-loop` is a bounded presentation adapter. It delegates configured live
  work to `taskloop.Runtime` and exposes only dry-run, exact task-group, and
  explicit retry-blocked controls.
- Repository ownership guards reject reference callers/static route text in the
  production skill/rules and reject Node manager/provider construction.

## Reviewer Checkpoints

- Predecessor 25 has a verified completion and owns all manager/host composition.
- Every reference behavior has exactly one disposition and concrete Go evidence.
- The thin command delegates to the authoritative runtime and creates no second manager/provider path.
- Production skill/rules contain no Python invocation or static provider/model/capacity table.
- Python files are reference-only, checksum-bound, zero-caller, and not deleted before Milestone completion.
- Node remains a common-runtime consumer.

## Verification Results

### Focused and race

```bash
go test -count=1 ./apps/agent/internal/taskloop ./apps/agent/internal/command ./apps/agent/cmd/agent
go test -count=1 -race ./apps/agent/internal/taskloop ./apps/agent/internal/command ./apps/agent/cmd/agent
go vet ./apps/agent/internal/taskloop ./apps/agent/internal/command ./apps/agent/cmd/agent
```

PASS

```text
go test -count=1 ./apps/agent/internal/taskloop ./apps/agent/internal/command ./apps/agent/cmd/agent
ok   iop/apps/agent/internal/taskloop
ok   iop/apps/agent/internal/command
ok   iop/apps/agent/cmd/agent

go test -count=1 -race ./apps/agent/internal/taskloop
ok   iop/apps/agent/internal/taskloop

go test -count=1 -race ./apps/agent/internal/command ./apps/agent/cmd/agent
ok   iop/apps/agent/internal/command
ok   iop/apps/agent/cmd/agent

go vet ./apps/agent/internal/taskloop ./apps/agent/internal/command ./apps/agent/cmd/agent
vet=pass
```

### Parity and operator cutover

```bash
make test-iop-agent-parity
make build-agent
build/bin/iop-agent task-loop --help
build/bin/iop-agent task-loop --dry-run --task-group m-iop-agent-cli-runtime
build/bin/iop-agent task-loop parity --disposal-manifest
```

PASS

```text
make test-iop-agent-parity
ok   iop/apps/agent/internal/taskloop

make build-agent
go build -trimpath -o build/bin/iop-agent ./apps/agent/cmd/agent

build/bin/iop-agent task-loop --dry-run --task-group m-iop-agent-cli-runtime
task-loop dry_run=true projects=1
  - project=workspace group=m-iop-agent-cli-runtime status=read-only next=26
  exit_code: 0

build/bin/iop-agent task-loop parity --disposal-manifest
parity: ok
  behaviors: 13
  disposal_files: 4
  deletion_gate: milestone-completion-transition
```

### Zero-match and full regression

```bash
rg -n --sort path 'dispatch\.py|python3 .*orchestrate-agent-task-loop|gpt-5\.6|claude-opus|Gemini|ornith|laguna' agent-ops/skills/project/orchestrate-agent-task-loop/SKILL.md agent-ops/rules/project/domain/testing/rules.md agent-ops/rules/project/rules.md
go test -count=1 ./packages/go/... ./apps/agent/...
git diff --check
```

PASS

```text
rg -n --sort path '<ownership patterns>' <three production ownership documents>
exit=1 (no matches)

git diff --check
exit=0
```

---

> **[IMPLEMENTING AGENT — BEFORE SAVING]** Fill every implementation-owned section and leave review-only content unchanged.

## Section Ownership

| Section | Owner | Note |
|---------|-------|------|
| Header, Overview, Roadmap Targets, Archive Snapshot, Review Instructions | Fixed | Implementer must not modify |
| Implementation Item Completion, Implementation Checklist | Implementing agent | Check status only |
| Review-Only Checklist | Review agent | Implementer must not modify |
| Deviations, Decisions, Verification Results | Implementing agent | Record actual implementation and evidence |
| Reviewer Checkpoints | Fixed | Reviewer verifies |
| Code Review Result and finalization | Review agent | Append/execute only after review |

## Code Review Result

- Overall Verdict: FAIL
- Dimension Assessment:
  - Correctness: Fail — the live operator derives terminal exit status from whether it attempted `StartProject`/`ResumeProject`, not from the reconciled final project states.
  - Completeness: Fail — the S13 manifest and repository guards do not prove zero Python production callers or a complete Python disposal inventory.
  - Test Coverage: Fail — no live command-adapter test covers a retry that remains blocked, and the cutover test scans only three project documents while active common skills still invoke the retained dispatcher.
  - API Contract: Fail — the implementation does not meet the S13 zero-runtime-dependency and completion-transition disposal evidence required by the approved SDD and `iop.agent-cli-runtime`.
  - Code Quality: Pass — the reviewed Go changes are formatted, focused, and pass fresh vet and regression checks with a valid local cache/tmp setup.
  - Implementation Deviation: Pass — the implementation stayed within the planned file and ownership boundaries; the defects are incomplete acceptance behavior rather than unrelated scope.
  - Verification Trust: Fail — the planned narrow zero-match command passes, but broader fresh repository evidence contradicts the claimed zero production caller and complete disposal conclusions.
  - Spec Conformance: Fail — SDD S13 and its Evidence Map remain unsatisfied.
- Findings:
  - Required — `apps/agent/internal/taskloop/parity.go:132`, `apps/agent/internal/taskloop/testdata/parity.yaml:260`, `agent-ops/skills/common/code-review/SKILL.md:236`, and `agent-ops/skills/common/plan/SKILL.md:272`: `production_caller: go-only` is only a self-attested manifest string, the cutover guard scans only three project documents, and the disposal list records four scripts while five tracked Python test/`.orig` fixtures remain outside it. Fresh `git grep` also proves that active common plan/code-review workflows still execute `dispatch.py --validate-plan`, so deleting the four recorded scripts would break production review/plan finalization and would not dispose all retained Python fixtures. Replace the remaining active validator calls with a Go-owned validation surface, make the repository guard cover every active production caller, include every retained tracked Python source/test fixture in the checksum-bound inventory (or explicitly and verifiably classify its disposal), and add negative tests that fail on an unrecorded fixture or caller.
  - Required — `apps/agent/cmd/agent/main.go:455`: `hasRunnable` becomes true whenever `StartProject` or `ResumeProject` returns, and exit code `2` is assigned only when no such call was attempted. If `--retry-blocked` reconciles back to a drained blocked state, the command therefore reports exit `0`, contradicting `TaskLoopResponse` and the skill contract. Derive the terminal exit from the final post-reconcile project views (distinguishing completed/idle from blocked/runnable) and add a command-adapter test where retry remains blocked and must return exit `2`.
- Routing Signals:
  - `review_rework_count=1`
  - `evidence_integrity_failure=false`
- Next Step: Invoke the plan skill with these raw findings and materialize the freshly routed follow-up pair; do not write `complete.log` or update the roadmap.
