<!-- task=m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification plan=32 tag=REVIEW_API milestone-task=workspace-binding,claude-smoke -->

# Code Review Reference - canonical empty Work content

> **[IMPLEMENTING AGENT]** Fill all implementation-owned fields and stop with this active pair in place. Do not append a verdict, archive files, write `complete.log`, or change roadmap state.

## Overview

date=2026-08-08
task=m-iop-owned-single-request-agent-execution/25+23,24_claude_smoke_qualification, plan=32, tag=REVIEW_API

## Archive Evidence Snapshot

- Prior pair: `plan_cloud_G10_31.log` / `code_review_cloud_G10_31.log`; verdict `FAIL`, Required R31, `review_rework_count=30`, `evidence_integrity_failure=false`.
- `sole-live-14.rc-69` is immutable with one Plan success, one Work validation error, no result/manifest, and no retry.
- Canonical llama.cpp emitted one valid `workspace_write`; its OpenAI-compatible serializer uses exact empty string content for an otherwise content-empty tool-call message.

## For the Review Agent

Compare every checklist item with source and actual output. Append one verdict, archive this pair to suffix 32, and materialize the verdict's required next state. PASS alone may write `complete.log` and archive the task; WARN/FAIL must route a follow-up. Do not update the roadmap directly.

## Implementation Item Completion

| Item | Status |
|---|---|
| empty-tool-content-codec | [x] |
| exact-regression-tests | [x] |
| disposable-rebuild-and-guard | [x] closed failure; no manifest publication |

## Implementation Checklist

- [x] Admit only nil/exact-empty content for the Work single-tool-call branch and reject non-empty content.
- [x] Retain every other Work fail-closed validation boundary.
- [x] Run fresh local and remote focused/package/race/Edge/build gates.
- [x] Sync only the two reviewed source files, refresh the disposable Edge/runtime identities, and pass all provider-free gates.
- [x] Finalize exactly one `sole-live-15` guard with no retry and validate success evidence or closed no-publication failure.
- [x] Fill all implementation-owned review evidence.

## Review-Only Checklist

- [x] Append exactly one verdict and verified routing signals.
- [x] Verify all findings, dimensions, cardinality, identities, credential boundary, and evidence integrity.
- [x] Archive the active pair to suffix 32 and materialize the matching next state.
- [ ] On PASS, write `complete.log`, archive the task, and preserve `milestone-task=workspace-binding,claude-smoke` for aggregation without direct roadmap mutation.

## Deviations from Plan

- The first remote full Edge run hit `TestRefreshConfigApplyNoChangeSkipsNodePush` once. A 20-count diagnostic exposed the test's fixed-port/repeated-process sensitivity after the first failed iteration; a clean single execution passed, and a fresh full Edge rerun passed. No runtime deployment had begun when this occurred.
- `sole-live-15` completed two Work tools and left `smoke-result.txt` in the disposable workspace before its final Work completion was rejected. The harness published no manifest, the guard finalized once with exit 69, and no retry occurred.

## Key Design Decisions

- Exact empty string and nil are equivalent only as absence of visible content in the Work single-tool-call branch. Non-empty content plus a tool call remains malformed.
- Canonical dev, provider hosts, config, credentials, Control Plane, and Node remained unchanged. Only the disposable Edge was rebuilt/restarted, and SOPS caller material remained process-memory only.
- The partial workspace file is failure evidence, not S12 completion. Its digest and missing terminating newline were recorded; it must be preserved recoverably and removed from the active workspace before any later preflight.

## Reviewer Checkpoints

- Exact empty string is treated as absent only for the single Work tool-call branch; non-empty content remains rejected.
- `system_fingerprint` and `timings` remain bounded, discarded diagnostics; arbitrary fields remain rejected.
- Fourteen finalized guards precede exactly one `sole-live-15`; no `.started` remains and no retry occurs.
- PASS requires Gemini → ornith-fast → Gemini, exact verified workspace output, cleanup, one successful terminal, and schema-valid redacted evidence.

## Verification Results

### Formatting

Actual output: completed with no formatter output.

### Focused Work codec tests

Actual output: `ok iop/apps/edge/internal/openai 0.031s`.

### OpenAI package tests

Actual output: `ok iop/apps/edge/internal/openai 8.343s`.

### Focused race tests

Actual output: `ok iop/apps/edge/internal/openai 1.080s`.

### Edge regression tests

Actual output: local all packages PASS; remote fresh rerun all packages PASS. The prior remote bootstrap timing failure is recorded under deviations.

### Edge build

Actual output: local linux/arm64 PASS; remote `/usr/bin/make build-edge BUILD_DIR=build/s12 EDGE_TARGET=darwin-arm64` PASS.

### Disposable dev preflight and sole live guard

Actual output:

- Exact synchronized digests: Work codec `e628040ddb221f6e2a59743e69a86d1b8da9bd4ab95218a25d05e19f382ee0ca`; test `c086cc0a319dd81e728249148fa859c02b9a4e4e8087eb58ea826d04456c344f`.
- Runtime identities: worktree `sha256:f477de722de2fadeb6d73db6241ab8b9eeacd7b7e5264a82b2b67dbdab1b0591`; Edge `sha256:f5ee9eda8d5b8975957e0fae044c5b2417b3613b85057df27631df80342d0ce4`; new Edge PID 67878; unchanged Control Plane PID 35448 and Node PID 43830.
- Harness self-test PASS. Provider-free catalog 200, count-token 200, preflight PASS, TLS 1224 seconds, ingress `0 -> 0`, provider tunnels `14 -> 14`, Claude processes `0 -> 0`, fourteen finalized guards, zero started guards, and no preexisting result/manifest.
- Guarded output:

```text
[single-request-claude-smoke] validation failed: Claude invocation failed (status 1 class api-rejected reason api-error)
SOLE_LIVE_15_RC=69
INGRESS=0->1
PROVIDER_TUNNELS=14->18
CLAUDE_PROCESSES=0->0
FINAL_GUARD=sole-live-15.rc-69
OBSERVATION_COUNT=cleanup|none|success|none|1
OBSERVATION_COUNT=request|none|success|none|1
OBSERVATION_COUNT=stage|plan|success|none|1
OBSERVATION_COUNT=stage|work|error|validation|1
OBSERVATION_COUNT=terminal|none|error|validation|1
OBSERVATION_COUNT=tool|none|success|none|2
OBSERVATION_CORRELATIONS=1
WORKSPACE_RESULT=present MANIFEST=absent
```

- Isolated correlation `sr-717f9d4a89624d23d2969ae35e7806f0`: Plan success 19175 ms, `workspace_write` and `workspace_read` success, Work validation error after 2051 ms with tool count 2, cleanup success, terminal validation error after 21241 ms.
- Canonical Work correlations: first response one `workspace_write` with empty content; second response one `workspace_read` with empty content; third response no tool call and a 1240-byte visible completion wrapped in a single Markdown `json` code fence. The strict Work completion decoder correctly rejects the fence rather than stripping provider text.
- Partial result digest `sha256:1e7f1d005ef7680d6a1c1055477c508133ea449a54c2134b1902c88543b82acb`; its visible text matches the expected phrase but it has no terminating newline (`wc -l = 0`), so it would not pass the harness's byte-exact verifier even after Work completion admission.

## Section Ownership

| Section | Owner |
|---|---|
| Implementation completion/checklist, deviations, decisions, verification | Implementing agent |
| Review-only checklist and Code Review Result | Review agent |

## Code Review Result

### Overall Verdict

FAIL

### Dimension Assessment

| Dimension | Assessment | Evidence |
|---|---|---|
| Correctness | Fail | Exact llama.cpp tool calls now execute, but the final Work completion is Markdown-fenced rather than the required JSON object. |
| Completeness | Fail | Work does not complete, Review does not start, terminal is validation error, and no manifest exists. |
| Test coverage | Pass | Nil/empty admission and non-empty rejection are directly covered and both live tool calls passed the repaired boundary. |
| API contract | Fail | Work requests a structured completion only by prompt and does not own `response_format`, allowing a supported provider to return incompatible fenced JSON. |
| Code quality | Pass | The R31 predicate is minimal and preserves all other fail-closed checks. |
| Implementation deviation | Warn | One unrelated remote fixed-port test required a clean rerun; the final passing full run and scoped tests are fresh. |
| Verification trust | Pass | Four provider tunnels, two tool successes, exact correlations, partial-file digest, guard finalization, and absent manifest are internally consistent. |

### Findings

- Required R32 — `apps/edge/internal/openai/single_request_work_stage.go:432`: Work's final output contract is prompt-only, so canonical llama.cpp returned a single Markdown `json` fence that the strict decoder correctly rejected. Add a server-owned strict `response_format` JSON schema for exactly non-empty `completion` and `verification`, reserve it against stage-option override/case aliases, and prove the body retains tools while emitting the exact closed schema. Do not strip fences or loosen the decoder.
- Required R33 — `scripts/e2e-single-request-claude.sh:13`: the live model wrote the correct visible phrase without a terminating newline, while the harness byte-exact verifier requires one. Make the smoke prompt explicitly require the final newline and extend self-test coverage so the generated request retains that exact instruction. Preserve the partial result recoverably, then clear only that active workspace file before the next provider-free preflight.

### Routing Signals

- `evaluation_mode=isolated-reassessment`
- `verdict=FAIL`
- `review_rework_count=31`
- `evidence_integrity_failure=false`
- `next_state=plan`
- `finalizer=finalize-task-policy.sh`
- `finalizer_mode=pair`
- build route `worker/cloud/G10`; review route `review/cloud/G10`

### Next Step

- Route R32 and R33 together because the next valid S12 call requires both a structured Work completion and byte-exact workspace result. Preserve `sole-live-15.rc-69`; use exactly one new `sole-live-16` only after all code, harness, self-test, runtime-identity, and provider-free gates pass.
