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

# Code Review Reference - Work structured output and exact smoke bytes

## Overview

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

## Implementation Item Completion

| Item | Status |
|---|---|
| work-response-format | [x] |
| exact-smoke-prompt | [x] |
| disposable-guard-16 | [x] closed failure; no manifest publication |

## Implementation Checklist

- [x] Work emits a server-owned strict response format with tools and rejects option authority.
- [x] Completion decoder remains strict and every existing Work boundary is retained.
- [x] Smoke prompt and self-test bind the terminating newline instruction.
- [x] Fresh local/remote tests, race, harness self-test, and builds pass.
- [x] Partial result is preserved recoverably; only active workspace state is cleared before preflight.
- [x] Exactly one guard 16 is finalized with no retry and complete success/closed failure evidence is validated.
- [x] All implementation-owned evidence is filled.

## Review-Only Checklist

- [x] Append one verdict and routing signals.
- [x] Verify scope, tests, identities, credential boundary, guard cardinality, result bytes, manifest, and evidence integrity.
- [x] Archive suffix 33 and materialize the verdict's next state.
- [ ] On PASS write `complete.log`, archive the task, and preserve milestone task ids without direct roadmap mutation.

## Deviations from Plan

- The isolated TLS identities had only 450 seconds remaining before the provider-free gate. Existing disposable smoke tooling generated a fresh isolated CA and service identities, the retained temporary directory was removed after copying, and only the isolated Control Plane, Edge, and Node were restarted.
- `sole-live-16` reached a structured Work completion but Work made no workspace call. Review then attempted the missing-file read; the service delivered typed `not_found`, while the quality gate converted it to `internal_tool_failed` before Review could repair it.

## Key Design Decisions

- Work owns a closed `json_schema` response format for exactly non-empty `completion` and `verification`; canonical option input is ignored and case aliases are rejected.
- The strict completion decoder and every prior message/tool boundary remain unchanged. The smoke prompt and fake-Claude digest test now bind the terminating LF requirement.
- Canonical dev, provider hosts, routes, configs, and credentials remained unchanged. The live-15 partial result was moved to the isolated runtime as `smoke-result.txt.sole-live-15-partial`; the active workspace was empty before and after guard 16.

## Verification Results

### Local Go and build

Formatting PASS. Focused Work tests PASS (`0.038s`), OpenAI package PASS (`8.268s`), focused race PASS (`1.067s`), all Edge packages PASS, and `make build-edge` PASS.

### Harness self-test

Local and isolated remote `./scripts/e2e-single-request-claude.sh --self-test` PASS, including exact prompt digest validation.

### Remote rebuild and provider-free gates

Exact synchronized digests: Work source `06ebb950575560d757da2f38c84e7bbb95dd7c1fb64953e2184ebe489a612f60`; Work test `8c06347468451fa19504d20ecc56cd9bab247a62f5467b4d82b1c5f8512ec11b`; harness `16a75b1ee8a1e953729e738e9b30a17f2737c4cf5ccb579d2d2233e15e383d7a`. Remote focused (`0.687s`), package (`8.627s`), race (`1.659s`), all Edge packages, Darwin arm64 build, and harness self-test PASS.

Runtime identities: worktree `sha256:90db896d72e4d9b36a54d07d9591fe7c9cd4c60e33b2e1a4ce42940a7e75cd90`; Edge `sha256:7ff6c8f0b5811e8bfdf5cfa40d351761f274ab1ea8b6cdbda3e60897b7aebea5`; isolated Control Plane PID 89925, Edge PID 89937, Node PID 89945. Provider-free catalog 200 with exact `ornith-fast`, count-token 200, preflight PASS, TLS 7051 seconds, ingress `0 -> 0`, provider tunnels `18 -> 18`, Claude processes `0 -> 0`, fifteen finalized guards, zero started guards, and no active result/manifest.

### Sole live guard 16

Exactly one `sole-live-16` finalized with exit 69 and no retry:

```text
[single-request-claude-smoke] validation failed: Claude invocation failed (status 1 class api-rejected reason api-error)
SOLE_LIVE_16_RC=69
INGRESS=0->1
PROVIDER_TUNNELS=18->21
CLAUDE_PROCESSES=0->0
FINAL_GUARD=sole-live-16.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|review|error|internal_tool_failed|1
OBSERVATION_COUNT=stage|work|success|none|1
OBSERVATION_COUNT=terminal|none|error|internal_tool_failed|1
OBSERVATION_COUNT=tool|none|success|none|1
OBSERVATION_CORRELATIONS=1
WORKSPACE_RESULT=absent MANIFEST=absent
```

Correlation `sr-57fd48f65d7a39ddad63f9b78378887d`: Plan success 5857 ms; Work success 1384 ms with zero tools; Review made one `workspace_read`, received typed `not_found`, then failed `internal_tool_failed` after 1825 ms; cleanup succeeded; one terminal error completed in 9071 ms. Canonical Work correlation `req.manual-1786196736258307000` returned the strict JSON schema but falsely claimed it wrote and verified the file. Review run `manual-1786196737631645000` correctly attempted to read the absent file. Workspace result and manifest remain absent.

## Reviewer Checkpoints

- Structured output is request authority owned by Work and cannot be overridden.
- Tools remain usable before the final structured completion.
- No fence stripping or decoder relaxation exists.
- The live prompt explicitly requires a terminating LF and self-test checks the exact prompt argument.
- Fifteen prior guards precede one guard 16, and PASS meets every S12 manifest condition.

## Section Ownership

Implementation sections belong to the implementing agent; Review-Only Checklist and Code Review Result belong to the official reviewer.

## Code Review Result

### Overall Verdict

FAIL

### Dimension Assessment

| Dimension | Assessment | Evidence |
|---|---|---|
| Correctness | Fail | Work can return its structured completion without performing any tool, and Review cannot consume the model-visible missing-file result. |
| Completeness | Fail | Review terminates `internal_tool_failed`, no exact result exists, and no manifest is published. |
| Test coverage | Fail | Structured output and exact prompt are covered, but initial Work tool enforcement and real Review `not_found` repair are not. |
| API contract | Fail | `tool_choice=auto` permits a no-work completion; the quality gate rejects a typed result that the service intentionally delivers to the model. |
| Code quality | Pass | R32/R33 changes are scoped, strict, and preserve prior guards. |
| Implementation deviation | Pass | The isolated certificate refresh was necessary, bounded, and fully evidenced. |
| Verification trust | Pass | Guard cardinality, correlations, process/tunnel counts, identities, and absent publication agree. |

### Findings

- Required R34 — `apps/edge/internal/openai/single_request_work_stage.go:462`: Work always emits `tool_choice: "auto"`, so the first canonical response can claim completion without any workspace operation. Make the initial Work provider call server-owned `required`, switch resumed calls to `auto` only after a tool call/result exists, preserve option authority, and test the exact initial/resumed bodies.
- Required R35 — `apps/edge/internal/openai/single_request_quality_gate.go:136`: the service intentionally returns a model-visible `status=error,error_code=not_found` for a missing workspace file, but the quality gate treats it as an internal failure. Admit and fingerprint only this exact typed error alongside success so the model can repair it; retain fail-closed handling for every other error combination and add real coordinator coverage for missing read -> repair write -> verification read -> Review pass.

### Routing Signals

- `evaluation_mode=isolated-reassessment`
- `verdict=FAIL`
- `review_rework_count=32`
- `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 R34 and R35 together. Preserve `sole-live-16.rc-69`; after fresh local/remote gates and provider-free preflight, use exactly one new `sole-live-17` with no retry.
