<!-- task=m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization plan=4 tag=REVIEW_API milestone-task=preset-model -->

# Clarify the Anthropic Response Model Contract

## For the Implementing Agent

Implement every checklist item, run every verification command, and fill the implementation-owned sections of `CODE_REVIEW-cloud-G05.md` with actual notes and stdout/stderr. Keep the active PLAN/review files in place and report ready for review; finalization is code-review-skill only. If blocked, record only the exact blocker, attempted commands/output, and resume condition in implementation-owned evidence fields. Do not ask the user, call user-input tools, create control-plane stop files, classify the next state, archive logs, or write `complete.log`.

## Background

The native preset response-start repair and its focused regressions pass, and the Anthropic routing sections now distinguish virtual presets from ordinary native and Chat-bridge responses. The general non-streaming response-field description still says that every `model` is the request-model echo, which contradicts both the ordinary native byte-preserving implementation and the active plan. This follow-up makes that single public contract field consistent with the already verified behavior.

## Archive Evidence Snapshot

- Current review evidence will be archived as `agent-task/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/plan_cloud_G08_3.log` and `agent-task/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/code_review_cloud_G08_3.log`.
- Verdict: FAIL. Findings: 1 Required, 0 Suggested, 0 Nit.
- Required contract repair: replace the general non-streaming response `model` description so authorized virtual presets, ordinary native responses, and Chat-bridge converted responses use the same semantics as the managed-auth and Native-vs-Bridge sections.
- Fresh review evidence: both predecessor logs exist; the focused native/preset suite, common race suite, OpenAI vet, gofmt diff, current contract inspection, and `git diff --check` exited 0. The current inspection missed the contradictory general field at `agent-contract/outer/anthropic-compatible-api.md:198`, so `evidence_integrity_failure=true` remains part of routing evidence.
- Roadmap carryover: milestone task `preset-model`, approved SDD scenario S01. Predecessors remain satisfied by `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/02+01_preset_generation/complete.log` and `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/03+01_preset_model_config/complete.log`.

## Dependencies and Execution Order

- `02+01_preset_generation` is satisfied by `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/02+01_preset_generation/complete.log`.
- `03+01_preset_model_config` is satisfied by `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/03+01_preset_model_config/complete.log`.
- Complete `REVIEW_API-1` and then run its exact contract and runtime verification.

## Analysis

### Files Read

- `agent-roadmap/current.md`
- `agent-roadmap/phase/knowledge-tool-optimization-extension/PHASE.md`
- `agent-roadmap/phase/knowledge-tool-optimization-extension/milestones/iop-hot-path-one-shot-execution.md`
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`
- `agent-spec/index.md`
- `agent-spec/input/openai-compatible-surface.md`
- `agent-contract/index.md`
- `agent-contract/outer/anthropic-compatible-api.md`
- `agent-ops/rules/project/domain/edge/rules.md`
- `agent-ops/rules/project/domain/platform-common/rules.md`
- `agent-ops/rules/project/domain/testing/rules.md`
- `agent-test/local/rules.md`
- `agent-test/local/edge-smoke.md`
- `agent-test/local/platform-common-smoke.md`
- `apps/edge/internal/openai/anthropic_handler.go`
- `apps/edge/internal/openai/anthropic_native.go`
- `apps/edge/internal/openai/anthropic_native_test.go`
- `agent-task/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/PLAN-cloud-G08.md`
- `agent-task/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/CODE_REVIEW-cloud-G08.md`
- `agent-task/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/code_review_cloud_G08_2.log`
- `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/02+01_preset_generation/complete.log`
- `agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/03+01_preset_model_config/complete.log`

### SDD Criteria

- SDD: `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-hot-path-one-shot-execution/SDD.md`, status approved and unlocked.
- Milestone task metadata: `preset-model`.
- Target: Acceptance Scenario S01.
- Evidence Map: S01 requires authorized virtual preset responses to preserve the external model identity instead of an internal stage target. The contract-only repair keeps that guarantee while accurately documenting the executable ordinary native and Chat-bridge variants used to distinguish it.

### Verification Context

- Handoff supplied: current FAIL verdict, one raw Required contract finding, and fresh reviewer output from the active review.
- Sources read: the local test rules/profiles, approved SDD S01, active Anthropic contract, native handler/relay/test evidence, and the exact predecessor completion logs listed above.
- Commands/criteria: fresh focused native/preset/bridge regression tests, the SDD common race suite, OpenAI vet, an exact fixed-string assertion for the corrected general response field, and `git diff --check`.
- Preconditions: Go resolves to `/config/.local/bin/go`, version `go1.26.2`, with `GOROOT=/config/opt/go`; both archived predecessor `complete.log` files exist.
- Constraints: deterministic local fixtures only; no external credentials, services, hosts, ports, or runtime processes are required. Go test cache output is not acceptable, so test commands use `-count=1`.
- Gaps: the existing broad `rg` inspection exits 0 without matching the contradictory general response field; the follow-up replaces it with an exact field assertion.
- Confidence: high. Runtime behavior is covered by ordinary-native, virtual-preset, terminal-boundary, provider-error, and Chat-bridge tests; the remaining change is one contract sentence.

### Test Coverage Gaps

- Contract response-model variants: current prose is inconsistent; an exact fixed-string assertion will cover the corrected general field.
- Runtime behavior: no new Go test is required because existing deterministic tests already cover ordinary native byte preservation, successful preset identity, pre-response terminal handling, provider errors, and Chat-bridge model conversion.

### Symbol References

None. No symbols are renamed or removed.

### Split Judgment

Do not split. This is one contract sentence and one deterministic semantic assertion; a separate child would not provide an independently useful intermediate state. Predecessor indices 02 and 03 are satisfied by the exact archived `complete.log` paths listed under Dependencies and Execution Order.

### Scope Rationale

Limit implementation changes to `agent-contract/outer/anthropic-compatible-api.md` and the active review evidence file. Exclude Go source/tests, the OpenAI outer contract, config/runtime contracts, roadmap state, and agent-spec because fresh executable evidence passes and the Required finding is only the contradictory Anthropic response-field sentence. The broader living-spec wording remains a separate synchronization candidate and is not part of this repair loop.

### Final Routing

- `evaluation_mode=isolated-reassessment`; finalizer `finalize-task-policy.sh pair`.
- Build target: all closures true; scores `(1,0,2,1,1)` = G05; base `local-fit`, recovery boundary matched, route cloud; canonical `PLAN-cloud-G05.md`.
- Review target: all closures true; scores `(1,0,2,1,1)` = G05; official review route cloud; canonical `CODE_REVIEW-cloud-G05.md`.
- `large_indivisible_context=false`.
- Positive loop risks: `boundary_contract`, `variant_product`; count 2.
- Recovery signals: `review_rework_count=4`, `evidence_integrity_failure=true`.
- Capability-gap evidence: none.

## Implementation Checklist

- [x] Correct the general Anthropic response `model` field description so virtual-preset, ordinary-native, and Chat-bridge semantics match the executable contract.
- [x] Run the focused, race, vet, exact-contract, and diff verification exactly as written.
- [x] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [REVIEW_API-1] Correct the general response-model field

#### Problem

`agent-contract/outer/anthropic-compatible-api.md:198` states that `model` is always the request-model echo. That conflicts with the same contract at lines 70-73 and 286-287, `writeAnthropicNativeTunnelResponse`, and `TestAnthropicNativeProviderFixturesPreserveBytesAndHeaders`, which preserve the provider response model/body for ordinary native routes while only authorized virtual presets receive a rewritten public identity.

#### Solution

Replace the generic field sentence with the exact three-way distinction already used by the routing sections.

Before (`agent-contract/outer/anthropic-compatible-api.md:198`):

```markdown
- `model`: 요청 model echo.
```

After:

```markdown
- `model`: Authorized virtual presets echo the requested virtual model. Ordinary native responses preserve the provider response model, while Chat bridge responses use the converted Anthropic request model.
```

Do not change runtime behavior or broaden the contract beyond these existing variants.

#### Modified Files and Checklist

- [x] `agent-contract/outer/anthropic-compatible-api.md` — correct the general response `model` field semantics.

#### Test Strategy

Do not add or modify Go tests. Existing `TestAnthropicNativeVirtualPresetPreservesPublicModelIdentity`, `TestAnthropicNativeProviderFixturesPreserveBytesAndHeaders`, `TestAnthropicNativeProviderErrorPreservesStatusAndBody`, and `TestAnthropicChatBridgeMixedContentToolsAndResponse` provide executable evidence for all documented variants. Add deterministic verification by requiring the exact corrected field sentence.

#### Verification

Run the focused Go suite and exact fixed-string contract assertion from Final Verification; expect both commands to exit 0 and the contract output to show only the corrected general field.

## Modified Files Summary

| File | Items |
|------|-------|
| `agent-contract/outer/anthropic-compatible-api.md` | REVIEW_API-1 |
| `agent-task/m-iop-hot-path-one-shot-execution/04+02,03_preset_model_authorization/CODE_REVIEW-cloud-G05.md` | REVIEW_API-1 |

## Final Verification

```bash
test -f agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/02+01_preset_generation/complete.log
test -f agent-task/archive/2026/08/m-iop-hot-path-one-shot-execution/03+01_preset_model_config/complete.log
go test -count=1 ./apps/edge/internal/openai -run 'Test(AnthropicNativeVirtualPresetPreservesPublicModelIdentity|AnthropicNativeProviderFixturesPreserveBytesAndHeaders|AnthropicNativeProviderErrorPreservesStatusAndBody|AnthropicChatBridgeMixedContentToolsAndResponse)'
go test -race -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai ./apps/edge/internal/service
go vet ./apps/edge/internal/openai
rg --sort path -n --fixed-strings -- '- `model`: Authorized virtual presets echo the requested virtual model. Ordinary native responses preserve the provider response model, while Chat bridge responses use the converted Anthropic request model.' agent-contract/outer/anthropic-compatible-api.md
git diff --check
```

Expected: every command exits 0 with fresh tests; the general response `model` field exactly distinguishes authorized virtual presets, ordinary native responses, and Chat-bridge conversion while all existing runtime behavior remains passing.

After completing all code changes, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.
