<!-- task=m-multi-provider-protocol-profile-native-messages/01_protocol_core plan=1 tag=REVIEW_API -->

# Code Review Reference - REVIEW_API

> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> The task is NOT complete until every implementation-owned section below is filled in.
> Complete the `Implementation Checklist`; the final checklist item is mandatory before saving.
> Fill implementation-owned sections, then stop with active files in place and report ready for review.
> If implementation is blocked, record the exact blocker, attempted commands/output, and resume condition only in implementation-owned evidence fields.
> Do not ask the user directly, present choices, call user-input tools, create control-plane stop files, or classify the next state.
> Finalization (`Code Review Result`, log rename, `complete.log`, archive moves, `Review-Only Checklist`) is review-agent-only, even after compaction/resume.
> Follow the ownership table at the bottom of this file for which sections you own.

## Overview

date=2026-08-01
task=m-multi-provider-protocol-profile-native-messages/01_protocol_core, plan=1, tag=REVIEW_API

## Roadmap Targets

- Milestone: `agent-roadmap/phase/operational-observability-provider-management/milestones/multi-provider-protocol-profile-native-messages.md`
- Milestone link: [Milestone document](agent-roadmap/phase/operational-observability-provider-management/milestones/multi-provider-protocol-profile-native-messages.md)
- Task ids:
  - `profile-contract`: common provider profile and immutable overlay/runtime contract
  - `path-resolution`: profile-operation URL resolver
  - `profile-catalog`: built-in/custom profile catalog and admission
- Completion mode: check-on-pass

## Archive Evidence Snapshot

- Prior plan: `agent-task/m-multi-provider-protocol-profile-native-messages/01_protocol_core/plan_local_G08_01.log`
- Prior review: `agent-task/m-multi-provider-protocol-profile-native-messages/01_protocol_core/code_review_cloud_G08_01.log`
- Verdict: `FAIL`; Required=6, Suggested=0, Nit=0; `review_rework_count=1`; `evidence_integrity_failure=true`.
- Required carryover: profile-backed Models/Chat/Responses fail or ignore provider endpoints; S01/S03 validation/catalog data is incomplete; extensions and pointers violate immutable snapshot semantics; selected-candidate protocol preparation is absent; request tests do not execute the claimed path; Dart protobuf output is stale.
- Affected areas: `packages/go/config`, Edge mapper/provider-pool/OpenAI callers, Node profile adapter, runtime protobuf consumers, Dart generated output, and the credential-free OpenAI-compatible smoke.
- Verification evidence: fresh focused and full Go suites passed only after reviewer-local `GOCACHE`/`GOTMPDIR` overrides, but a reviewer model-discovery reproducer failed with `openai_compat adapter: endpoint is required`; current request tests use suffix checks, ignored errors, empty bodies, or non-value Struct assertions; no provider-first Edge→Node→upstream full-cycle ran.
- Roadmap carryover: the same `profile-contract`, `path-resolution`, and `profile-catalog` Task ids remain unchecked until this follow-up passes.

## For the Review Agent

> **[REVIEW AGENT ONLY]** The finalization steps below are review-agent only. Implementing agents must not execute this section.

Compare implementation of each item against source files and verify that output in `Verification Results` matches code.
Review completion means the following steps are finished:

1. Append verdict and `review_rework_count` / `evidence_integrity_failure` routing signals.
2. Archive `CODE_REVIEW-cloud-G09.md` → `code_review_cloud_G09_01.log` and `PLAN-cloud-G09.md` → `plan_cloud_G09_01.log`.
3. If PASS, write `complete.log` and move active task directory to `agent-task/archive/YYYY/MM/m-multi-provider-protocol-profile-native-messages/01_protocol_core/`. If WARN/FAIL, fully write the next filesystem state required by the code-review skill.
4. If PASS and task group is `m-<milestone-slug>`, report completion event metadata. Roadmap state check and `update-roadmap` calls are runtime responsibilities.
5. Check applicable `Review-Only Checklist` items at the final `.log` location before reporting.

---

## Implementation Item Completion

| Item | Status |
|------|---------|
| REVIEW_API-1 | [x] |
| REVIEW_API-2 | [x] |
| REVIEW_API-3 | [x] |
| REVIEW_API-4 | [x] |

## Implementation Checklist

- [x] Repair S01/S03 catalog validation and provider endpoint normalization, including accurate Chat/Messages variants, immutable built-ins, and the Chat-only token-counter contract.
- [x] Preserve the concrete profile across mapper, protobuf, Node, adapter, queue, and selected-candidate boundaries; add protocol-aware preparation and driver-based dispatch while keeping legacy hooks compatible.
- [x] Make Models, Chat, Responses, and tunnel request construction consume operation/auth/model mapping from the selected profile and prove exact provider requests rather than helper output.
- [x] Regenerate all Go/Dart protobuf consumers and run fresh focused, full regression, and provider-first Edge→Node→fake-upstream full-cycle verification.
- [x] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

## Review-Only Checklist

> **[REVIEW AGENT ONLY]** This checklist is used only by the review agent.
> Implementing agents must not modify or check this section.

- [x] Append one verdict of `PASS`, `WARN`, or `FAIL` and verified `review_rework_count`, `evidence_integrity_failure` to `Code Review Result`.
- [x] Verify that verdict, `Dimension Assessment`, and Required/Suggested/Nit classifications match.
- [x] Archive active `CODE_REVIEW-*-G??.md` to `code_review_cloud_G09_01.log`.
- [x] Archive active `PLAN-*-G??.md` to `plan_cloud_G09_01.log`.
- [x] Verify that the Agent-Ops managed block in `.gitignore` unignores `agent-task/**/*.md` and `agent-task/**/*.log` and ignores `agent-roadmap/current.md`.
- [ ] If PASS, write `complete.log` based on `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md` files.
- [ ] If PASS, move active task directory `agent-task/m-multi-provider-protocol-profile-native-messages/01_protocol_core/` to `agent-task/archive/YYYY/MM/m-multi-provider-protocol-profile-native-messages/01_protocol_core/` and update this checklist at the final archive path.
- [ ] If PASS and task group is `m-<milestone-slug>`, report completion event metadata for runtime, without modifying roadmap or directly calling `update-roadmap`.
- [ ] If PASS for split work, remove empty active parent `agent-task/m-multi-provider-protocol-profile-native-messages/` or verify it was kept due to remaining siblings/files.
- [x] If WARN/FAIL, write the next filesystem state matching code-review verdict and do not write `complete.log`.

## Deviations from Plan

- The required Go commands were run with `GOTMPDIR` under `.local/` and `GOCACHE=/config/workspace/iop-s0/.gocache`. This is the plan-authorized workaround for the host's non-executable `/tmp` and inaccessible inherited Go cache; the command bodies were unchanged.
- `flutter test` initially found missing packages in the local Flutter cache (`vector_math`, `characters`, and `leak_tracker_flutter_testing`). `flutter pub get` was run in `apps/client` without changing tracked dependency manifests or the lockfile, after which the required Dart test passed.
- `make proto-dart` correctly changed `runtime.pbenum.dart` in addition to the two Dart files named in the modified-file checklist. It is generated output for the already-appended tunnel enum and must remain synchronized; it was not hand-edited.
- `go vet ./apps/edge/...` retains the plan-disclosed unrelated warning at `apps/edge/internal/openai/input_estimator.go:109:26` (`WriteByte` signature). Package and Node vet pass, all task-focused checks pass, and the warning's file is untouched by this task.
- The exact `go test -count=1 ./packages/go/...` command is blocked by two unrelated existing/environment fixtures: the filesystem rejects creation of a mode-`0000` directory in `TestCLIWorkspacePreflightFailures/Helper`, and `TestSerialIntegratorRestartRecoversInterruptedApplyByRollback` reports a pre-existing digest mismatch. Both reproduce individually. A replacement run skipping exactly those two tests passes every `packages/go` package, including `packages/go/config` and `packages/go/agentruntime`.
- The final drift search returns two justified legacy-only matches: `resolveLegacyURL` in `adapter.go` and its no-profile test helper. Concrete profiles do not call that resolver; they use `ConcreteProtocolProfile.ResolveOperationURL`.

## Key Design Decisions

- The canonical built-in map is private. Runtime catalog assembly always obtains a recursive clone and rejects custom ids that collide with reserved built-ins; the exported map remains a compatibility snapshot for direct callers.
- Provider `endpoint` takes precedence over `base_url`. It overlays only the provider's cloned profile. A root endpoint retains the profile's documented base path (for example `/v1`), while an explicit endpoint path wins, preserving legacy root and `/v1` endpoints without mutating built-ins.
- Built-in operations are represented as a documented base path plus an operation path. Profile resolution performs URL composition directly; the old `/v1` suffix compatibility check remains confined to the no-profile legacy resolver. MiniMax and MiMo have explicit `_chat` and `_messages` ids, and no MiMo plan-specific endpoint was invented.
- Capability, driver, operation, and auth values use closed matrices. Token counters accept deterministic mode with no rate or estimate mode with `1..1000` tokens per 1k characters, and any model group selecting a Messages or Responses driver is rejected.
- Every profile boundary owns a recursive clone, including nested extensions. Edge serializes the real `structpb.Struct`; Node decodes it; adapter, queue candidate, live refresh, selected-candidate callback, and dispatch metadata never retain the caller's mutable maps or slices.
- `PrepareProtocolTunnel` receives the actually selected provider and cloned profile and is preferred when present. The old `PrepareTunnel` hook remains unchanged and is used when the protocol-aware hook is absent. Profile driver takes precedence over legacy provider type for execution-path classification.
- Node uses one request-preparation path for Models, normalized Chat, Responses, and raw tunnel requests. A concrete profile requires an operation, resolves its exact URL, maps the selected/canonical model once at final request encoding, and retargets the request-time credential to the declared auth header/scheme without persisting it. Only a nil profile uses endpoint plus legacy `Path`.
- The fake Lemonade smoke now uses top-level `protocol_profiles`, `models`, and `nodes[].providers[]`; Edge generates the Node adapter config. The fake upstream rejects wrong method, URI, auth, or mapped model and asserts Models/Chat/Responses request counts.

## Reviewer Checkpoints

- Confirm legacy/provider-first endpoints are cloned into the concrete provider snapshot and never mutate or silently override reserved built-ins.
- Confirm S01/S03 rejects invalid capability/auth/driver/token-counter combinations and catalog variants come from current official provider contracts.
- Confirm nested extensions and every profile map/slice are value-equal and mutation-isolated across mapper, protobuf, Node, adapter, queue, and refresh boundaries.
- Confirm selected-candidate protocol preparation receives the actual selected profile/provider, driver controls execution path when present, and old `PrepareTunnel` callers remain compatible.
- Confirm Models, Chat, Responses, and tunnel tests execute an actual loopback HTTP request and assert exact URI, auth header, mapped body model, error, and request count.
- Confirm Go and Dart generated protobuf outputs are current and the fake Lemonade smoke uses provider-first profile config through real Edge and Node entrypoints.
- Confirm unrelated roadmap edits and all out-of-scope Messages/contract/spec work remain untouched.

## Verification Results

> **Implementation owner:** Run every command below exactly as written and paste actual stdout/stderr. If a command changes, record the replacement and reason in `Deviations from Plan` first. Long output may be saved to a deterministic file only when the exact save command and path are recorded.

### Verification 1 — Toolchain preflight

```bash
command -v go && go version && go env GOROOT
command -v protoc && protoc --version
command -v flutter && flutter --version
command -v protoc-gen-dart || flutter pub global activate protoc_plugin
```

```text
/config/.local/bin/go
go version go1.26.2 linux/arm64
/config/opt/go
/config/.local/bin/protoc
libprotoc 29.3
/sdk/flutter/bin/flutter
Flutter 3.41.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 2c9eb20739 (5 months ago) • 2026-03-17 16:14:01 -0700
Engine • hash c1db59d880ca73dd86cec08a6663f287522d9f39 (revision 052f31d115) (4 months ago) • 2026-03-17 20:29:11.000Z
Tools • Dart 3.11.3 • DevTools 2.54.2
/config/.local/bin/protoc-gen-dart
```

### Verification 2 — Reproducible protobuf generation

```bash
make proto
make proto-dart
```

```text
protoc \
	--go_out=. \
	--go_opt=module=iop \
	--proto_path=. \
	proto/iop/agent.proto \
	proto/iop/runtime.proto \
	proto/iop/node.proto \
	proto/iop/control.proto \
	proto/iop/job.proto
mkdir -p apps/client/lib/gen
protoc \
	--plugin=protoc-gen-dart=/config/.local/bin/protoc-gen-dart \
	--dart_out=apps/client/lib/gen \
	--proto_path=. \
	--proto_path=/config/.local/include \
	proto/iop/runtime.proto \
	proto/iop/node.proto \
	proto/iop/control.proto \
	proto/iop/job.proto
```

### Verification 3 — Config catalog and endpoint contract

```bash
go test -count=1 ./packages/go/config/... -run 'Test(ProtocolProfile|LegacyProviderAlias|BuiltInProtocolProfile)'
```

```text
ok  	iop/packages/go/config	0.043s
```

### Verification 4 — Wire, candidate, and request-focused regressions

```bash
go test -count=1 ./apps/edge/internal/node ./apps/edge/internal/service -run 'Test.*ProtocolProfile|Test.*TunnelOperation'
go test -count=1 ./apps/node/internal/adapters -run 'Test.*ProtocolProfile'
go test -count=1 ./apps/node/internal/adapters/openai_compat -run 'Test(ProtocolProfile|LegacyEndpointPathFallback|OpenAICompat.*Models)'
go test -count=1 ./apps/edge/internal/openai -run 'Test.*(ProtocolProfile|ProviderDispatch|Responses)'
```

```text
ok  	iop/apps/edge/internal/node	0.038s
ok  	iop/apps/edge/internal/service	0.054s
ok  	iop/apps/node/internal/adapters	0.033s
ok  	iop/apps/node/internal/adapters/openai_compat	0.020s
ok  	iop/apps/edge/internal/openai	0.065s
```

### Verification 5 — Vet and full Go regression

```bash
go vet ./packages/go/...
go vet ./apps/edge/...
go vet ./apps/node/...
go test -count=1 ./packages/go/...
go test -count=1 ./apps/edge/...
go test -count=1 ./apps/node/...
```

```text
go vet ./packages/go/...: exit 0, no output
go vet ./apps/edge/...:
apps/edge/internal/openai/input_estimator.go:109:26: method WriteByte(b byte) should have signature WriteByte(byte) error
go vet ./apps/node/...: exit 0, no output

go test -count=1 ./packages/go/...:
--- FAIL: TestCLIWorkspacePreflightFailures (0.06s)
    --- FAIL: TestCLIWorkspacePreflightFailures/Helper (0.02s)
        cli_workspace_test.go:189: failed to create inaccessible dir: mkdir /config/workspace/iop-s0/.local/gotmp-g09-packages/TestCLIWorkspacePreflightFailuresHelper3436074951/001/inaccessible: permission denied
        testing.go:1464: TempDir RemoveAll cleanup: unlinkat /config/workspace/iop-s0/.local/gotmp-g09-packages/TestCLIWorkspacePreflightFailuresHelper3436074951/001: directory not empty
FAIL	iop/packages/go/agentprovider/cli	31.140s

Individual second unrelated failure:
=== RUN   TestSerialIntegratorRestartRecoversInterruptedApplyByRollback
    integrator_test.go:373: interrupted apply rollback digest = ee8b4a36e1f000cfd15925ec8a52aaa4840b508665dd5f547279360b53ffbb68, want 4be67186cf6e788dd79dbffa945325af9fc77256e9547bfad9da89481761b818
--- FAIL: TestSerialIntegratorRestartRecoversInterruptedApplyByRollback (0.67s)

Replacement verification:
go test -count=1 ./packages/go/... -skip 'TestCLIWorkspacePreflightFailures/Helper|TestSerialIntegratorRestartRecoversInterruptedApplyByRollback'
ok  	iop/packages/go/agentconfig
ok  	iop/packages/go/agentguard
ok  	iop/packages/go/agentpolicy
ok  	iop/packages/go/agentprovider/catalog
ok  	iop/packages/go/agentprovider/cli
ok  	iop/packages/go/agentprovider/cli/status
ok  	iop/packages/go/agentruntime
ok  	iop/packages/go/agentstate
ok  	iop/packages/go/agenttask
ok  	iop/packages/go/agentworkspace
ok  	iop/packages/go/audit
ok  	iop/packages/go/config
ok  	iop/packages/go/hostsetup
ok  	iop/packages/go/observability
ok  	iop/packages/go/streamgate

go test -count=1 ./apps/edge/...:
ok  	iop/apps/edge/cmd/edge	0.624s
ok  	iop/apps/edge/internal/bootstrap	4.663s
ok  	iop/apps/edge/internal/configrefresh	0.522s
ok  	iop/apps/edge/internal/controlplane	4.544s
ok  	iop/apps/edge/internal/edgecmd	0.295s
ok  	iop/apps/edge/internal/edgevalidate	0.085s
ok  	iop/apps/edge/internal/events	0.047s
ok  	iop/apps/edge/internal/input	0.117s
ok  	iop/apps/edge/internal/input/a2a	0.091s
ok  	iop/apps/edge/internal/node	0.090s
ok  	iop/apps/edge/internal/openai	7.477s
ok  	iop/apps/edge/internal/opsconsole	0.099s
ok  	iop/apps/edge/internal/service	5.922s
ok  	iop/apps/edge/internal/transport	4.825s

go test -count=1 ./apps/node/...:
ok  	iop/apps/node/cmd/node	0.137s
ok  	iop/apps/node/internal/adapters	0.115s
?   	iop/apps/node/internal/adapters/mock	[no test files]
ok  	iop/apps/node/internal/adapters/ollama	0.051s
ok  	iop/apps/node/internal/adapters/openai_compat	0.172s
ok  	iop/apps/node/internal/adapters/vllm	0.166s
ok  	iop/apps/node/internal/bootstrap	1.536s
ok  	iop/apps/node/internal/node	0.921s
ok  	iop/apps/node/internal/router	0.528s
ok  	iop/apps/node/internal/store	0.173s
ok  	iop/apps/node/internal/transport	5.629s
```

### Verification 6 — Dart consumer

```bash
cd apps/client && flutter test test/iop_wire/generated_proto_import_test.dart
```

```text
00:00 +0: loading /config/workspace/iop-s0/apps/client/test/iop_wire/generated_proto_import_test.dart
00:00 +0: Generated proto compile guard and field verification
00:00 +1: All tests passed!
```

### Verification 7 — Provider-first full-cycle

```bash
cd /config/workspace/iop-s0 && IOP_LEMONADE_MODE=fake ./scripts/e2e-openai-lemonade.sh
```

```text
[openai-lemonade] OpenAI-compatible Lemonade serving test PASSED (mode=fake).
```

### Verification 8 — Drift and ownership

```bash
cd /config/workspace/iop-s0 && rg -n --sort path 'joinOpenAIPath|HasSuffix\(.*"/v1"|api\.minimo\.ai|api\.anthropic\.com/anthropic/v1' apps packages configs
git diff --check
git status --short
```

```text
apps/node/internal/adapters/openai_compat/adapter.go:94: if strings.HasSuffix(basePath, "/v1") && strings.HasPrefix(path, "/v1/") {
apps/node/internal/node/protocol_profile_tunnel_test.go:73: if strings.HasSuffix(basePath, "/v1") && strings.HasPrefix(path, "/v1/") {

git diff --check: exit 0, no output

git status --short:
warning: could not open directory '.local/gotmp-g09-packages/TestCLIWorkspacePreflightFailuresHelper3436074951/001/inaccessible/': No such file or directory
warning: could not open directory '.local/testbin/TestCLIWorkspacePreflightFailuresHelper3808099981/001/inaccessible/': No such file or directory
warning: could not open directory '.local/testbin/TestCLIWorkspacePreflightFailuresHelper215257300/001/inaccessible/': No such file or directory
 M agent-roadmap/phase/knowledge-tool-optimization-extension/PHASE.md
 M agent-roadmap/phase/knowledge-tool-optimization-extension/milestones/openai-compatible-output-validation-filters.md
 M agent-roadmap/phase/operational-observability-provider-management/PHASE.md
 M agent-roadmap/phase/operational-observability-provider-management/milestones/multi-provider-protocol-profile-native-messages.md
 M apps/client/lib/gen/proto/iop/runtime.pb.dart
 M apps/client/lib/gen/proto/iop/runtime.pbenum.dart
 M apps/client/lib/gen/proto/iop/runtime.pbjson.dart
 M apps/client/test/iop_wire/generated_proto_import_test.dart
 M apps/edge/internal/node/mapper.go
 M apps/edge/internal/openai/chat_handler.go
 M apps/edge/internal/openai/provider_dispatch_test.go
 M apps/edge/internal/openai/provider_test_support_test.go
 M apps/edge/internal/openai/provider_tunnel.go
 M apps/edge/internal/openai/responses_handler.go
 M apps/edge/internal/openai/stream_gate_runtime.go
 M apps/edge/internal/service/model_queue_admission.go
 M apps/edge/internal/service/model_queue_types.go
 M apps/edge/internal/service/provider_pool.go
 M apps/edge/internal/service/provider_resolution.go
 M apps/edge/internal/service/provider_tunnel.go
 M apps/edge/internal/service/run_types.go
 M apps/node/internal/adapters/factory.go
 M apps/node/internal/adapters/openai_compat/adapter.go
 M apps/node/internal/adapters/openai_compat/execute.go
 M apps/node/internal/adapters/openai_compat/execute_test.go
 M apps/node/internal/adapters/openai_compat/provider.go
 M apps/node/internal/adapters/openai_compat/provider_tunnel.go
 M apps/node/internal/adapters/openai_compat/request.go
 M apps/node/internal/adapters/openai_compat/stream.go
 M apps/node/internal/node/tunnel_handler.go
 M configs/edge.yaml
 M packages/go/agentruntime/types.go
 M packages/go/config/adapter_types.go
 M packages/go/config/edge_types.go
 M packages/go/config/load.go
 M packages/go/config/normalize.go
 M packages/go/config/provider_types.go
 M packages/go/config/validate.go
 M proto/gen/iop/runtime.pb.go
 M proto/iop/runtime.proto
 M scripts/e2e-openai-lemonade.sh
?? .gocache/
?? .local/
?? agent-task/m-multi-provider-protocol-profile-native-messages/
?? apps/edge/internal/node/protocol_profile_mapper_test.go
?? apps/edge/internal/service/protocol_profile_test.go
?? apps/node/internal/adapters/openai_compat/protocol_profile_test.go
?? apps/node/internal/adapters/protocol_profile_config_test.go
?? apps/node/internal/node/protocol_profile_tunnel_test.go
?? packages/go/config/protocol_profile.go
?? packages/go/config/protocol_profile_test.go

The four roadmap paths were already user-owned changes and were preserved untouched. The inaccessible `.local` paths are test residue. No central common rule/skill, archive, completion log, or unrelated roadmap file was changed by this implementation.
```

---

> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?**
> If anything is blank, go back and fill it in before saving this file.
> Leave review-agent-only sections unchanged.

## Section Ownership

| Section | Owner | Note |
|---------|-------|------|
| Header comment, Overview, Review Agent Instructions | Fixed at stub creation | Implementing agent must not modify or execute these (archive, complete.log, and task-directory archive move are review-agent only) |
| Roadmap Targets | Fixed at stub creation from plan when present | Implementing agent must not modify; code-review copies it into `complete.log` as `Roadmap Completion` only on PASS |
| Archive Evidence Snapshot | Fixed at stub creation from plan when present | Implementing agent uses it as default prior-loop context; read only the specific archive files cited there when more detail is required |
| Implementation Item Completion (item names) | Fixed at stub creation | Implementing agent checks `[ ]` → `[x]` only |
| Implementation Checklist (item text/order) | Fixed at stub creation from plan | Implementing agent checks `[ ]` → `[x]` only |
| Review-Only Checklist | Review agent only | Implementing agent must not modify or check this section |
| Deviations from Plan, Key Design Decisions | Implementing agent | Replace placeholder text with actual content |
| Reviewer Checkpoints | Fixed at stub creation | Pre-filled from plan |
| Verification Results (section headings + commands) | Fixed at stub creation | Implementing agent fills in command output only; command changes require a `Deviations from Plan` entry |
| Code Review Result | Review agent appends | Not included in stub |

## Code Review Result

- Overall Verdict: FAIL

### Dimension Assessment

- Correctness: Fail
- Completeness: Fail
- Test coverage: Fail
- API contract: Fail
- Code quality: Fail
- Implementation deviation: Fail
- Verification trust: Fail
- Spec conformance: Fail

### Findings

- Required — `apps/edge/internal/openai/chat_handler.go:258`, `apps/edge/internal/openai/responses_handler.go:381`, `apps/edge/internal/service/provider_pool.go:104`, `apps/edge/internal/openai/provider_tunnel.go:125`: operation support is checked by `PrepareProtocolTunnel` only after queue admission selects and reserves one candidate. `AcceptCandidate` contains only the optional stream-gate predicate, including on queue re-resolution. A model group containing a Chat-only Gemini profile and a Responses-capable OpenAI profile can therefore select Gemini for `/v1/responses` and fail even though a valid OpenAI candidate is available. Compose the requested-operation predicate with every existing candidate predicate before initial admission and re-resolution, preserve legacy nil-profile compatibility deliberately, and add a mixed-candidate regression that proves the unsupported candidate is filtered before selection.
- Required — `apps/edge/internal/configrefresh/classify.go:81`, `apps/edge/internal/configrefresh/classify.go:267`, `apps/edge/internal/configrefresh/classify.go:344`, `apps/edge/internal/configrefresh/classify.go:409`, `apps/edge/internal/bootstrap/runtime.go:223`: config refresh classification omits top-level `protocol_profiles`, provider `profile`/resolved profile changes, and model `token_counter`. Such an apply is reported as `no changes detected`; Edge still commits the candidate snapshot but skips the Node push, so Edge selection and the Node adapter may use different profile revisions. Classify every profile-affecting field deterministically as live-applied only if the existing Edge-to-Node transaction can preserve one snapshot, otherwise as restart-required, classify `token_counter`, and replace the direct `SetRuntimeConfig`-only test with actual refresh classification/apply coverage.
- Required — `packages/go/config/normalize.go:16`, `apps/edge/internal/node/mapper.go:47`, `apps/edge/internal/node/mapper.go:125`, `apps/edge/internal/service/provider_resolution.go:284`: normalization attaches a concrete profile to adapter-backed legacy providers, but the mapper skips every provider with `Adapter != ""` and neither legacy vLLM nor OpenAI-compatible adapter payload receives that provider snapshot. Edge then classifies and prepares the request from the concrete profile while Node executes the unprofiled legacy adapter. Compile a provider-specific profile-backed adapter instance from the referenced legacy adapter configuration, route the selected provider to that instance while retaining the legacy adapter for direct compatibility, and reject missing/ambiguous backing references. Add an Edge payload to Node adapter test with a custom path/auth/model mapping so this production boundary, not only candidate metadata, is exercised.
- Required — `apps/node/internal/adapters/openai_compat/request.go:51`, `apps/node/internal/adapters/openai_compat/protocol_profile_test.go:179`: model mapping decodes the entire raw provider request into `map[string]any` and marshals it again. JSON integers outside the exact `float64` range and provider-native lexical forms are changed even though the tunnel contract permits only the model/auth rewrite and requires all other fields to survive. Rewrite only the top-level `model` value with `json.RawMessage`-equivalent preservation and add actual HTTP assertions covering a provider extension with `9007199254740993`, nested unknown data, and unchanged non-model raw values.
- Required — `packages/go/config/protocol_profile.go:573`, `packages/go/config/protocol_profile_test.go:132`, `packages/go/config/protocol_profile.go:236`, `apps/node/internal/adapters/openai_compat/protocol_profile_test.go:17`: invalid HTTP field names such as `Bad Header` pass because `textproto.CanonicalMIMEHeaderKey` returns invalid input unchanged rather than returning an empty string. In addition, the claimed current-official MiMo fixture expects `X-Api-Key`, while Xiaomi's 2026-07-16 documentation declares `api-key` or `Authorization: Bearer` for the pay-as-you-go endpoint. Use HTTP token syntax validation, anchor each built-in auth declaration to a supported official header/scheme, and add negative syntax plus exact built-in auth matrix tests. Reference: [Xiaomi MiMo First API Call](https://mimo.mi.com/docs/en-US/quick-start/summary/first-api-call), [Xiaomi MiMo API Integration FAQ](https://mimo.mi.com/docs/en-US/quick-start/faq/api-integration).

### Fresh Reviewer Verification

- Passed: all four focused Go commands from the active plan.
- Passed: `make proto`, `make proto-dart`, the focused Dart generated-proto test, and the fake provider-first Lemonade full-cycle.
- Passed: full `apps/edge/...` and `apps/node/...` Go suites, plus the documented `packages/go/...` replacement that skips exactly the two unrelated fixtures recorded by the implementing agent.
- Passed: `git diff --check`.
- These green commands do not exercise mixed-operation admission, real config-refresh classification/push, adapter-backed profile execution, large-integer raw-body preservation, or invalid header token syntax.

### Routing Signals

- `review_rework_count=2`
- `evidence_integrity_failure=true`

### Next Step

- Create and execute an automatically routed `REVIEW_API` follow-up plan that closes every Required finding; do not write `complete.log` or update roadmap state.
