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

# Freeze Claude experimental request shape and retain closed rejection classes

## For the Implementing Agent

Repair Required R14 without invoking any model. Set `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` only in the supervised Claude child environment, require that boundary in the deterministic fake self-test, and retain only an allowlisted secret-free rejection class for future pre-ingress HTTP 400s. Add bounded Edge observability that never logs a request body, header value, prompt, arbitrary field name, or credential. Run local and isolated macOS dev tests, rebuild only the disposable Edge if Edge source changes, and use only catalog/`count_tokens`/preflight provider-free probes. Fill every implementation-owned review section and stop for official review.

## Background

The fifth authorized call was consumed exactly once as `sole-live-5.rc-69` and returned HTTP 400 before accepted ingress. No raw response was retained, so its exact rejected member cannot be recovered or asserted. Installed Claude 2.1.177 static code proves its API-key path does not add the OAuth beta, but remote feature flags can add experimental beta/tool/top-level variants not frozen by the current harness. The repair is to make the smoke caller deterministic and make any future pre-ingress rejection diagnosable without retaining sensitive content.

## Archive Evidence Snapshot

- Prior pair: `plan_cloud_G10_20.log` / `code_review_cloud_G10_20.log`; verdict `FAIL`, Required R14, `review_rework_count=19`, `evidence_integrity_failure=false`.
- All five authorizations are consumed as immutable guards ending in `.rc-69`. This packet has no authority to create `sole-live-6`, run the harness `--run`, or call Claude/Gemini/Ornith/provider generation.
- Disposable managed fleet is CP/Edge/Node `47248/47254/47260`; canonical `/Users/toki/agent-work/iop-dev` remains read-only.

## Finding Resolution Map

| Finding | Mode | Exact fix/dependency evidence | Changed precondition |
|---|---|---|---|
| R14 | direct-fix | `scripts/e2e-single-request-claude.sh`, focused Edge handler/tests, installed Claude 2.1.177 static semantics, isolated provider-free gates | The child request surface is frozen independently of remote experimental flags, and a future 400 yields an allowlisted rejection class without raw evidence. |

## Analysis

### Files Read

- `scripts/e2e-single-request-claude.sh`
- `apps/edge/internal/openai/anthropic_handler.go`
- `apps/edge/internal/openai/anthropic_types.go`
- `apps/edge/internal/openai/single_request_handler_test.go`
- `agent-contract/outer/anthropic-compatible-api.md`
- `agent-test/dev/rules.md`
- `agent-test/dev/edge-smoke.md`
- `plan_cloud_G10_20.log`
- `code_review_cloud_G10_20.log`

### Installed-client evidence

Claude 2.1.177 `LEH()` becomes true when `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS` is truthy. The request builder then disables first-party experimental selection (`NN()`), strips experimental tool keys in `nu6`, does not arm context-hint/cache-diagnostic/advisor paths, and retains the supported non-experimental request core. The harness child currently sets base URL, model, API key, and supervisor variables but not this switch.

### Diagnostic boundary

The current harness reduces every HTTP 400 to `api-rejected|http-400`, and Edge emits no pre-ingress validation log. A safe replacement may classify only fixed literals owned by IOP, such as unsupported-beta, unknown-top-level-field, unknown-tool-field, invalid-thinking/output, body-limit, header/version, route/auth, and generic validation. It must never interpolate the rejected field name or raw error into logs/task output. The client-visible Anthropic error response remains unchanged.

### SDD and scope

S12 remains unqualified. This packet changes caller determinism and diagnostics only; it must not publish a manifest or update success-only contract/spec/roadmap owners. The five failed live guards remain immutable.

### Split Judgment

The child environment switch, fake self-test assertion, safe harness classification, Edge rejection classifier, and focused tests form one compact failure-diagnosis boundary. Splitting would leave either determinism or evidence unverifiable.

### Final Routing

- `evaluation_mode=isolated-reassessment`; `finalizer=finalize-task-policy.sh`; `finalizer_mode=pair`.
- Build `worker/cloud/G10`; review `review/cloud/G10`; `base_route_basis=grade-boundary`; scores `2/2/2/2/2`; `large_indivisible_context=true`.
- Loop risks: `temporal_state`, `concurrent_consistency`, `boundary_contract`, `variant_product`; count 4.
- `review_rework_count=19`, `evidence_integrity_failure=false`.

## Modified Files Summary

- `scripts/e2e-single-request-claude.sh` — child-only experimental-beta freeze, safe 400 subtype classification, and fake assertions.
- `apps/edge/internal/openai/anthropic_handler.go` — bounded pre-ingress rejection classification/observability without raw values.
- `apps/edge/internal/openai/single_request_handler_test.go` or the nearest existing focused Anthropic handler test — safe-class and non-leak regressions.

## Implementation Checklist

- [x] Freeze the supervised Claude child with `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` and no broader process mutation.
- [x] Require the fake Claude to observe that exact value and preserve every existing supervisor/cardinality invariant.
- [x] Add fixed-enum harness and Edge rejection classification with no raw request/error interpolation.
- [x] Cover known safe classes plus arbitrary/secret-shaped unknown input collapsing to generic validation.
- [x] Pass local focused/race/self-test/diff and isolated macOS focused/race/rebuild/provider-free/preflight gates.
- [x] Prove zero model/provider generation, unchanged five guards, zero Claude process, and absent result/manifest.
- [x] Fill implementation-owned review sections and stop for official review.

### REVIEW_API-1 — Freeze the child environment

Add the experimental-beta switch beside the existing child-only Anthropic environment assignments. Do not export it globally, change user configuration, or change IOP/provider credentials. Extend the fake to fail unless the child sees exactly `1`.

### REVIEW_API-2 — Make HTTP 400 evidence actionable but closed

Map only repository-owned literal patterns to a small enum in the harness. At Edge pre-ingress failure points, log a fixed event and fixed rejection class derived without including `err.Error()`, arbitrary JSON member names, headers, body, prompt, or principal. Keep existing client-visible errors and status codes unchanged.

### REVIEW_API-3 — Prove non-leak and compatibility

Tests must show known beta/field classes map as intended, an unknown field containing a secret-shaped marker maps only to generic validation, and captured logs/output contain no marker. Preserve strict decoder behavior and the current supported/unsupported provider-free matrix.

### REVIEW_API-4 — Qualify the isolated candidate provider-free

Synchronize only changed files to `/Users/toki/agent-work/iop-s12-validation-20260808/source`, run focused/race tests, rebuild/restart only disposable Edge, verify runtime identity/fleet/catalog, repeat the existing `/count_tokens` matrix and harness preflight, and prove generation/activity/Claude/guard/artifact deltas are zero.

## Final Verification

1. `bash -n scripts/e2e-single-request-claude.sh` and deterministic `--self-test`.
2. Focused Anthropic handler/bridge tests and OpenAI/service race suites locally.
3. `gofmt`, `git diff --check`, and focused secret/non-leak assertions.
4. Installed Claude 2.1.177 static proof for the environment switch; do not execute Claude.
5. Isolated macOS focused/race tests, disposable Edge rebuild/identity, provider-free catalog/`count_tokens` matrix, fleet, metrics, guards, artifacts, and `--preflight-only`.

After implementation, fill `CODE_REVIEW-cloud-G10.md` and leave the active pair in place for official review.
