<!-- task=m-principal-provider-credential-slot-routing/08+03,04,07_secure_delivery plan=3 tag=REVIEW_REVIEW_API milestone-task=secure-transport,credential-lease,adapter-injection,revocation -->

# Code Review Reference - REVIEW_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-principal-provider-credential-slot-routing/08+03,04,07_secure_delivery, plan=3, tag=REVIEW_REVIEW_API

## Archive Evidence Snapshot

- `plan_cloud_G10_2.log` and `code_review_cloud_G10_2.log`: current-pair predicted archives; verdict `FAIL` with 4 Required, 0 Suggested, and 0 Nit findings. The worker stopped on a stale active-only predecessor path, and reviewer probes confirmed that every TLS/lease/injection production and test path remains absent.
- `plan_cloud_G10_1.log` and `code_review_cloud_G10_1.log`: prior reviewed loop; verdict `FAIL` with 4 Required findings for plaintext transports, no lease/injection path, no activation/revocation fence, and no trustworthy verification.
- `agent-task/archive/2026/08/m-principal-provider-credential-slot-routing/03+01,02_projection_auth/complete.log`: dormant secret-free projection/cache and managed ingress foundation passed.
- `agent-task/archive/2026/08/m-principal-provider-credential-slot-routing/04+03_principal_routes/complete.log`: principal-scoped route/discovery and no-fallback binding passed.
- `agent-task/archive/2026/08/m-principal-provider-credential-slot-routing/07+01,02,05_secret_material/complete.log`: secret-at-rest keyring, canonical AAD, persistence, and fail-closed startup passed. This archived file satisfies predecessor 07; no active sibling `complete.log` is required.

## 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-G10.md` -> `code_review_cloud_G10_3.log` and `PLAN-cloud-G10.md` -> `plan_cloud_G10_3.log`.
3. If PASS, write `complete.log` and move active task directory to `agent-task/archive/YYYY/MM/m-principal-provider-credential-slot-routing/08+03,04,07_secure_delivery/`. If WARN/FAIL, fully write the next filesystem state required by the code-review skill.
4. If PASS, preserve the first-line `milestone-task` metadata in `complete.log` and report it for the runtime aggregation event. Roadmap state evaluation belongs to `sync-milestone-workstate`.
5. Check applicable `Review-Only Checklist` items at the final `.log` location before reporting.

---

## Implementation Item Completion

| Item | Status |
|------|---------|
| REVIEW_REVIEW_API-1 Authenticated credential operations and TLS transport | [x] |
| REVIEW_REVIEW_API-2 Signed and Node-sealed bounded lease | [x] |
| REVIEW_REVIEW_API-3 Candidate-bound delivery and last-moment injection | [x] |
| REVIEW_REVIEW_API-4 Secure activation, revocation fence, and integrated evidence | [x] |

## Implementation Checklist

- [x] Enforce authenticated TLS 1.3 on every credential-bearing Client-Control Plane, Control Plane-Edge, and Edge-Node operation, with no plaintext fallback, and pass the complete peer matrix.
- [x] Add a canonical issuer-signed, Node-sealed, bounded credential lease and pass scope, TTL, cache, replay, overflow, tamper, and redaction tests.
- [x] Bind acquisition and delivery to the exact projection generation, candidate Node, principal/slot/route/profile/target and revisions; inject only at Node adapter admission and zero request-local plaintext on every terminal path.
- [x] Activate managed mode only for a complete secure composition and pass deterministic revoke/rotate, queue, retry, in-flight, full-cycle, race, generated-contract, Flutter, vet, and secret-guard 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_G10_3.log`.
- [x] Archive active `PLAN-*-G??.md` to `plan_cloud_G10_3.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-principal-provider-credential-slot-routing/08+03,04,07_secure_delivery/` to `agent-task/archive/YYYY/MM/m-principal-provider-credential-slot-routing/08+03,04,07_secure_delivery/` and update this checklist at the final archive path.
- [ ] If PASS, preserve and report `milestone-task` metadata for runtime aggregation, without modifying roadmap or directly calling `update-roadmap`.
- [ ] If PASS for split work, remove the empty active parent or verify it was kept due to remaining siblings/files.
- [x] If WARN/FAIL, write the next filesystem state matching the verdict and do not write `complete.log`.

## Deviations from Plan

- The listed Go commands were executed with `GOCACHE=/config/tmp/gocache-secure-delivery`, `GOTMPDIR=/config/workspace/.gotmp-iop-secure-delivery`, and `TMPDIR=/config/workspace/.gotmp-iop-secure-delivery`. The inherited Go cache contains entries inaccessible to this user, and this host mounts `/tmp` and `/config/tmp` with `noexec`; without the workspace `TMPDIR`, Go-created test binaries fail with `permission denied`. The package lists, flags, counts, race mode, and test semantics were unchanged.
- Credential lease acquisition messages live in `proto/iop/runtime.proto` rather than the Client-owned `control.proto` bootstrap surface. `control.proto` received only the secret-free projection field on the Edge hello response. This preserves the existing structural prohibition against adding credential management to the Client wire while still using dedicated typed CP-Edge messages.
- HTTPS servers use `net.Listen` plus `tls.NewListener` and `http.Server.Serve` with a TLS 1.3 configuration instead of `ListenAndServeTLS`. This keeps listener startup/shutdown composition shared and is transport-equivalent: no plaintext listener or downgrade path is opened.
- Edge bounds concurrent live lease acquisition/delivery rather than caching reusable sealed envelopes. Every lease is selected-candidate-specific and single-use at Node, so reuse would conflict with the replay fence. Control Plane issuance, Edge live delivery, and Node replay sets all retain the required 1..4096 bounds and fail closed on overflow.
- `make test-control-plane-edge-wire` now retains its legacy CP-Edge smoke and additionally runs the opt-in three-process managed delivery fixture. The fixture creates its executable workspace beneath the repository because this host's global temporary mounts are non-executable.
- The TLS identity matrix is centralized in `packages/go/auth/auth_test.go`, with transport reconnect/use tests kept in their existing package test files, rather than adding three duplicate `credential_tls_test.go` fixtures. Likewise, Edge lease acquisition/fencing is colocated with the provider-tunnel and service ownership paths instead of adding the predicted `credential_lease.go`/`run_types.go` files. This follows the existing source ownership boundaries and avoids parallel implementations of the same invariant.

## Key Design Decisions

- TLS identity is CA plus normal server-name verification plus an exact URI SAN workload identity, `spiffe://iop/<role>/<name>`. Credential-enabled CP-Edge and Edge-Node require TLS 1.3 mTLS, configured peer roles/names, and the same TLS configuration on reconnect. Principal credential lifecycle and managed OpenAI ingress use server-authenticated TLS 1.3 HTTPS with bearer principal authentication at the HTTP layer. Managed configuration rejects incomplete TLS/key composition and legacy principal/provider-auth mixing before readiness.
- The lease scope uses deterministic length-delimited canonical encoding over lease ID, principal, slot, route, profile, upstream target, selected Node, recipient key ID, credential/route revisions, projection generation, profile header/scheme, and issuance/expiry timestamps. Control Plane opens the at-rest envelope only after durable generation/route/slot checks, seals plaintext to the selected Node's X25519 public key using HKDF-SHA256 plus AES-256-GCM, and signs the complete envelope with a dedicated Ed25519 issuer key.
- Private deployment key files are base64 fixed-size values loaded from strict regular files with owner and `0600` checks; public issuer material may be non-secret. Key IDs are explicit configuration and signed scope fields. Lease TTL is restricted to 5..300 seconds. Issuance/live and replay sets are restricted to 1..4096, prune only expired replay entries, and reject overflow instead of evicting a live replay fence.
- Route/profile/provider candidate resolution precedes acquisition. The immutable binding is carried by OpenAI Chat Completions, Responses, Anthropic, direct, queued, and recovery paths. Edge validates the current projection before acquisition and again inside the current-owner pre-send fence. The three-process fixture exposed and fixed a missing `attachCredentialLease` call in provider-pool tunnel dispatch; a focused regression test now asserts dedicated lease fields are attached after candidate selection.
- Protobuf has dedicated signed lease and binding fields; provider credentials are never put in generic header maps. Node waits for adapter capacity admission, verifies signature, recipient, exact scope, expiry, and replay atomically, decrypts to one request-local `ProviderCredential`, and returns only generic rejection errors on failure.
- OpenAI-compatible and vLLM adapters reject case-insensitive auth-header collisions, inject the profile-defined credential immediately before the single upstream `Do`, remove the header after the call, and zero owned plaintext buffers on all terminal paths. The fake-upstream tests assert exactly one expected auth header and zero upstream calls for invalid/collision/replayed input.
- Every slot/route mutation commits a new durable projection generation before broadcasting the secret-free projection. Managed Edge waits for its authenticated Control Plane hello/projection before opening ingress. Revocation/rotation fences new lease acquisition, queued sends, retries, and recovery; an attempt that already crossed Node adapter admission may finish. The three-process barrier test revokes while the fake upstream is blocked, then proves the started request finishes and a subsequent request never reaches upstream.

## Reviewer Checkpoints

- Confirm archived predecessor 07 evidence was used and no active sibling `complete.log` was required.
- Confirm the slot/route lifecycle adapter is HTTPS plus principal authentication, secret create/rotate uses a bounded zeroed octet-stream body, Client protobuf remains hello-only, and remote bootstrap remains impossible.
- Confirm credential-enabled CP-Edge and Edge-Node use mTLS 1.3 with peer-role/name verification and no reconnect or error path downgrades to plaintext.
- Confirm the lease is canonical, issuer-signed, sealed to the selected Node, bounded by every scope/revision/generation/expiry dimension, and absent from generic maps and protobuf debug output.
- Confirm issuer/recipient key formats and key IDs are deterministic, TTL remains 5..300 seconds, cache/replay bounds remain 1..4096, and overflow never evicts a live replay fence.
- Confirm route/profile/candidate selection precedes lease acquisition and Node repeats every scope/revision/generation check before atomic consumption.
- Confirm adapter injection occurs immediately before one upstream call, rejects collision, and zeroes every owned plaintext buffer on success, error, validation failure, and cancellation.
- Confirm managed mode starts only with the complete secure composition, disabled mode preserves legacy behavior, and managed mode rejects caller-supplied provider auth rather than mixing sources.
- Confirm S13 ordering: an already-started attempt may terminate, while revoke/rotate prevents every new lease, queued send, recovery, and retry using the old revision.
- Confirm generated Go/Dart bindings are deterministic and fresh peer, tamper, full-cycle, race, redaction, and structural secret guards all pass.

## Verification Results

Paste actual stdout/stderr and exit status below each command. Do not summarize or reconstruct output. Replacement commands require a `Deviations from Plan` entry.

### REVIEW_REVIEW_API-1

```bash
go test -count=1 ./packages/go/auth ./packages/go/config ./apps/control-plane/cmd/control-plane ./apps/control-plane/internal/wire ./apps/edge/internal/controlplane ./apps/edge/internal/transport ./apps/node/internal/transport
```

_Actual stdout/stderr and exit status:_

```text
ok  	iop/packages/go/auth	8.082s
ok  	iop/packages/go/config	1.334s
ok  	iop/apps/control-plane/cmd/control-plane	3.966s
ok  	iop/apps/control-plane/internal/wire	1.549s
ok  	iop/apps/edge/internal/controlplane	4.508s
ok  	iop/apps/edge/internal/transport	4.800s
ok  	iop/apps/node/internal/transport	5.610s
exit status: 0
```

### REVIEW_REVIEW_API-2

```bash
go test -count=1 -race ./packages/go/credentiallease ./apps/control-plane/internal/credentiallease ./apps/edge/internal/controlplane ./apps/edge/internal/service ./apps/node/internal/node
```

_Actual stdout/stderr and exit status:_

```text
ok  	iop/packages/go/credentiallease	1.118s
ok  	iop/apps/control-plane/internal/credentiallease	1.396s
ok  	iop/apps/edge/internal/controlplane	5.489s
ok  	iop/apps/edge/internal/service	6.978s
ok  	iop/apps/node/internal/node	2.141s
exit status: 0
```

### REVIEW_REVIEW_API-3

```bash
go test -count=1 ./apps/edge/internal/openai ./apps/edge/internal/service ./apps/node/internal/node ./apps/node/internal/adapters/openai_compat
```

_Actual stdout/stderr and exit status:_

```text
ok  	iop/apps/edge/internal/openai	7.509s
ok  	iop/apps/edge/internal/service	5.944s
ok  	iop/apps/node/internal/node	0.863s
ok  	iop/apps/node/internal/adapters/openai_compat	0.149s
exit status: 0
```

### REVIEW_REVIEW_API-4 and Final Verification

```bash
command -v go && go version && go env GOROOT
command -v protoc && command -v protoc-gen-dart && command -v flutter
git status --short --branch
test -f agent-task/archive/2026/08/m-principal-provider-credential-slot-routing/07+01,02,05_secret_material/complete.log
make proto
make proto-dart
sha256sum proto/gen/iop/control.pb.go proto/gen/iop/runtime.pb.go apps/client/lib/gen/proto/iop/control.pb.dart apps/client/lib/gen/proto/iop/control.pbenum.dart apps/client/lib/gen/proto/iop/control.pbjson.dart apps/client/lib/gen/proto/iop/control.pbserver.dart apps/client/lib/gen/proto/iop/runtime.pb.dart apps/client/lib/gen/proto/iop/runtime.pbenum.dart apps/client/lib/gen/proto/iop/runtime.pbjson.dart apps/client/lib/gen/proto/iop/runtime.pbserver.dart > /tmp/iop-credential-proto-first.sha256
make proto
make proto-dart
sha256sum proto/gen/iop/control.pb.go proto/gen/iop/runtime.pb.go apps/client/lib/gen/proto/iop/control.pb.dart apps/client/lib/gen/proto/iop/control.pbenum.dart apps/client/lib/gen/proto/iop/control.pbjson.dart apps/client/lib/gen/proto/iop/control.pbserver.dart apps/client/lib/gen/proto/iop/runtime.pb.dart apps/client/lib/gen/proto/iop/runtime.pbenum.dart apps/client/lib/gen/proto/iop/runtime.pbjson.dart apps/client/lib/gen/proto/iop/runtime.pbserver.dart > /tmp/iop-credential-proto-second.sha256
diff -u /tmp/iop-credential-proto-first.sha256 /tmp/iop-credential-proto-second.sha256
make client-test
(cd apps/client && flutter analyze)
go test -count=1 ./packages/go/auth ./packages/go/config ./packages/go/credentiallease
go test -count=1 ./apps/control-plane/... ./apps/edge/... ./apps/node/...
go test -count=1 -race ./packages/go/credentiallease ./apps/control-plane/internal/credentiallease ./apps/edge/internal/authprojection ./apps/edge/internal/service ./apps/node/internal/node
make test-control-plane-edge-wire
go vet ./apps/control-plane/... ./apps/edge/... ./apps/node/... ./packages/go/...
git diff --check
if rg --sort path -n 'bytes[[:space:]]+(secret|provider_secret)|map<string, string>[[:space:]]+(credential|provider_auth)' proto/iop/runtime.proto; then exit 1; fi
```

_Actual stdout/stderr, exit status, sanitized full-cycle observations, authenticated HTTPS boundary, intentional sealed/injection references, and sentinel-absence evidence:_

All Go invocations below used the environment overrides recorded in `Deviations from Plan`.

```text
/config/.local/bin/go
go version go1.26.2 linux/arm64
/config/opt/go
/config/.local/bin/protoc
/config/.local/bin/protoc-gen-dart
/sdk/flutter/bin/flutter
## agent/dispatcher-work-log-artifact-loop...origin/agent/dispatcher-work-log-artifact-loop
 M Makefile
 M agent-contract/index.md
 M agent-contract/inner/control-plane-edge-wire.md
 M agent-contract/outer/anthropic-compatible-api.md
 M agent-contract/outer/openai-compatible-api.md
 M agent-roadmap/phase/operational-observability-provider-management/PHASE.md
 M agent-roadmap/phase/operational-observability-provider-management/milestones/principal-provider-credential-slot-routing.md
 D agent-task/m-principal-provider-credential-slot-routing/01_principal_store/CODE_REVIEW-cloud-G06.md
 D agent-task/m-principal-provider-credential-slot-routing/01_principal_store/PLAN-local-G06.md
 D agent-task/m-principal-provider-credential-slot-routing/02+01_credential_catalog/CODE_REVIEW-cloud-G07.md
 D agent-task/m-principal-provider-credential-slot-routing/02+01_credential_catalog/PLAN-local-G07.md
 D agent-task/m-principal-provider-credential-slot-routing/02+01_credential_catalog/code_review_cloud_G07_0.log
 D agent-task/m-principal-provider-credential-slot-routing/02+01_credential_catalog/plan_local_G07_0.log
 D agent-task/m-principal-provider-credential-slot-routing/03+01,02_projection_auth/CODE_REVIEW-cloud-G09.md
 D agent-task/m-principal-provider-credential-slot-routing/03+01,02_projection_auth/PLAN-cloud-G09.md
 D agent-task/m-principal-provider-credential-slot-routing/03+01,02_projection_auth/code_review_cloud_G10_0.log
 D agent-task/m-principal-provider-credential-slot-routing/03+01,02_projection_auth/plan_cloud_G10_0.log
 D agent-task/m-principal-provider-credential-slot-routing/04+03_principal_routes/CODE_REVIEW-cloud-G08.md
 D agent-task/m-principal-provider-credential-slot-routing/04+03_principal_routes/PLAN-local-G07.md
 D agent-task/m-principal-provider-credential-slot-routing/04+03_principal_routes/code_review_cloud_G09_0.log
 D agent-task/m-principal-provider-credential-slot-routing/04+03_principal_routes/plan_local_G08_0.log
 D agent-task/m-principal-provider-credential-slot-routing/05+01,02_management_core/CODE_REVIEW-cloud-G06.md
 D agent-task/m-principal-provider-credential-slot-routing/05+01,02_management_core/PLAN-local-G06.md
 D agent-task/m-principal-provider-credential-slot-routing/05+01,02_management_core/code_review_cloud_G08_1.log
 D agent-task/m-principal-provider-credential-slot-routing/05+01,02_management_core/code_review_cloud_G10_0.log
 D agent-task/m-principal-provider-credential-slot-routing/05+01,02_management_core/plan_cloud_G10_0.log
 D agent-task/m-principal-provider-credential-slot-routing/05+01,02_management_core/plan_local_G07_1.log
 D agent-task/m-principal-provider-credential-slot-routing/06+01,02_host_local_bootstrap/CODE_REVIEW-cloud-G06.md
 D agent-task/m-principal-provider-credential-slot-routing/06+01,02_host_local_bootstrap/PLAN-local-G06.md
 M apps/client/lib/gen/proto/iop/control.pb.dart
 M apps/client/lib/gen/proto/iop/control.pbjson.dart
 M apps/client/lib/gen/proto/iop/runtime.pb.dart
 M apps/client/lib/gen/proto/iop/runtime.pbjson.dart
 M apps/control-plane/cmd/control-plane/config_test.go
 M apps/control-plane/cmd/control-plane/main.go
 M apps/control-plane/cmd/control-plane/server.go
 M apps/control-plane/internal/wire/edge.go
 M apps/control-plane/internal/wire/edge_server.go
 M apps/control-plane/internal/wire/edge_test.go
 M apps/edge/internal/bootstrap/runtime.go
 M apps/edge/internal/controlplane/connector.go
 M apps/edge/internal/input/manager.go
 M apps/edge/internal/input/manager_test.go
 M apps/edge/internal/node/registry.go
 M apps/edge/internal/openai/anthropic_handler.go
 M apps/edge/internal/openai/anthropic_surface_test.go
 M apps/edge/internal/openai/chat_handler.go
 M apps/edge/internal/openai/dispatch_context.go
 M apps/edge/internal/openai/identity_metering_test.go
 M apps/edge/internal/openai/principal.go
 M apps/edge/internal/openai/provider_tunnel.go
 M apps/edge/internal/openai/responses_handler.go
 M apps/edge/internal/openai/responses_protocol_profile_test.go
 M apps/edge/internal/openai/route_resolution.go
 M apps/edge/internal/openai/routes.go
 M apps/edge/internal/openai/server.go
 M apps/edge/internal/openai/stream_gate_runtime.go
 M apps/edge/internal/service/provider_pool.go
 M apps/edge/internal/service/provider_tunnel.go
 M apps/edge/internal/service/run_dispatch_internal_test.go
 M apps/edge/internal/service/service.go
 M apps/edge/internal/transport/connection_handlers.go
 M apps/edge/internal/transport/server.go
 M apps/node/internal/adapters/openai_compat/provider_tunnel.go
 M apps/node/internal/adapters/openai_compat/provider_tunnel_test.go
 M apps/node/internal/adapters/vllm/provider_tunnel.go
 M apps/node/internal/bootstrap/module.go
 M apps/node/internal/node/node.go
 M apps/node/internal/node/provider_tunnel_test.go
 M apps/node/internal/node/tunnel_handler.go
 M apps/node/internal/transport/client.go
 M configs/control-plane.yaml
 M configs/edge.yaml
 M configs/node.yaml
 M go.mod
 M go.sum
 M go.work.sum
 M packages/go/agentruntime/types.go
 M packages/go/auth/auth.go
 M packages/go/config/edge_types.go
 M packages/go/config/load.go
 M packages/go/config/node_types.go
 M packages/go/config/validate.go
 M proto/gen/iop/control.pb.go
 M proto/gen/iop/runtime.pb.go
 M proto/iop/control.proto
 M proto/iop/runtime.proto
?? agent-task/archive/2026/08/m-principal-provider-credential-slot-routing/
?? agent-task/m-principal-provider-credential-slot-routing/08+03,04,07_secure_delivery/
?? agent-task/m-principal-provider-credential-slot-routing/09+08_migration_attribution/
?? agent-task/m-principal-provider-credential-slot-routing/10+08,09_verification_contracts/
?? agent-task/m-principal-provider-credential-slot-routing/WORK_LOG.md
?? apps/control-plane/cmd/control-plane/credential_commands.go
?? apps/control-plane/cmd/control-plane/credential_commands_test.go
?? apps/control-plane/cmd/control-plane/credential_http_handlers.go
?? apps/control-plane/cmd/control-plane/credential_http_handlers_test.go
?? apps/control-plane/cmd/control-plane/credential_store_test.go
?? apps/control-plane/cmd/control-plane/secure_delivery_integration_test.go
?? apps/control-plane/internal/credentiallease/
?? apps/control-plane/internal/credentialops/
?? apps/control-plane/internal/credentialseal/
?? apps/control-plane/internal/credentialstore/
?? apps/edge/internal/authprojection/
?? apps/edge/internal/openai/principal_routes.go
?? apps/edge/internal/openai/principal_routes_test.go
?? apps/edge/internal/service/provider_tunnel_credential_test.go
?? packages/go/auth/auth_test.go
?? packages/go/config/tls_types.go
?? packages/go/config/tls_types_test.go
?? packages/go/credentiallease/
exit status: 0
```

The predecessor `test -f` produced no stdout and exited 0.

Deterministic generation produced the following stdout and exited 0; the second `diff` produced no stdout:

```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
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
exit status: 0
```

Both redirected hash files contained the same values:

```text
187ef418518d846cc6aee9ff8846a27a9194d8afe7b43ebdc65ec592591b877c  proto/gen/iop/control.pb.go
5a28a2c5c66c8021c1cbf641d13aaf13ce1a2f283d5c0209c95276b53dee1625  proto/gen/iop/runtime.pb.go
99ddc39284a88981a13635bfc18341a9481a8f5709ffaf882d801504bb01130e  apps/client/lib/gen/proto/iop/control.pb.dart
4d8d27eabde5391ab3b5991dc55ed89168e97fdec93731aaa78892c7aa760d3a  apps/client/lib/gen/proto/iop/control.pbenum.dart
d095291d2fa2b08a22d2a24ad1f18cc8f4f43076ebc80b8f5322332c3b549d94  apps/client/lib/gen/proto/iop/control.pbjson.dart
0e58b825a2948c8854522756128d51568915b1a7aa07c830629659db33ff4890  apps/client/lib/gen/proto/iop/control.pbserver.dart
9f64d2c689944af26d57625c1aefd2d60d9e4d1ed31edc053339abc60dc99f54  apps/client/lib/gen/proto/iop/runtime.pb.dart
96f3fe414871f6ce0140adb78364c10bb786640db0b2686c2e46503e2b619b8c  apps/client/lib/gen/proto/iop/runtime.pbenum.dart
1ab3628c29f0738926717930e093dacb1912ad0ce5983116769cec09cd72b74f  apps/client/lib/gen/proto/iop/runtime.pbjson.dart
8c9977e8c4efe4ab24ee4c999abf325ca4a9688794595f7ba411d632b68cc03e  apps/client/lib/gen/proto/iop/runtime.pbserver.dart
```

```text
cd apps/client && flutter test
00:00 +0: loading /config/workspace/iop-s0/apps/client/test/app_shell_test.dart
00:00 +0: /config/workspace/iop-s0/apps/client/test/app_shell_test.dart: Client App basic rendering and success handshake test
00:00 +1: /config/workspace/iop-s0/apps/client/test/app_shell_test.dart: Client App basic rendering and success handshake test
00:00 +2: /config/workspace/iop-s0/apps/client/test/edge_nodes_panels_test.dart: Client App opens Edges panel and displays Edge details
00:01 +3: /config/workspace/iop-s0/apps/client/test/edge_nodes_panels_test.dart: Client App opens Edges panel and displays Edge details
00:01 +4: /config/workspace/iop-s0/apps/client/test/client_bootstrap_test.dart: runIopClient can skip external integrations
00:01 +5: /config/workspace/iop-s0/apps/client/test/client_bootstrap_test.dart: runIopClient can skip external integrations
00:01 +6: /config/workspace/iop-s0/apps/client/test/edge_nodes_panels_test.dart: Client App opens Nodes panel and displays active Nodes and configurations
00:01 +7: /config/workspace/iop-s0/apps/client/test/edge_nodes_panels_test.dart: Client App opens Nodes panel and displays active Nodes and configurations
00:01 +8: /config/workspace/iop-s0/apps/client/test/edge_nodes_panels_test.dart: Client App opens Nodes panel and displays active Nodes and configurations
00:01 +9: /config/workspace/iop-s0/apps/client/test/edge_nodes_panels_test.dart: Client App opens Nodes panel and displays active Nodes and configurations
00:01 +10: /config/workspace/iop-s0/apps/client/test/edge_nodes_panels_test.dart: Client App opens Nodes panel and displays active Nodes and configurations
00:01 +11: /config/workspace/iop-s0/apps/client/test/edge_nodes_panels_test.dart: Client App opens Nodes panel and displays active Nodes and configurations
00:01 +12: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:02 +13: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:02 +14: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:02 +15: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:02 +16: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:02 +17: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:02 +18: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:02 +19: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:02 +20: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:02 +21: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:02 +22: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:02 +23: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:02 +24: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:02 +25: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:02 +26: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:02 +27: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App opens Operations & Domain Agents panel and verifies agents, operations history, and command triggering
00:03 +28: /config/workspace/iop-s0/apps/client/test/provider_status_test.dart: Provider with health=degraded and status=active shows DEGRADED text with yellow color
00:03 +29: /config/workspace/iop-s0/apps/client/test/provider_status_test.dart: Provider with health=degraded and status=active shows DEGRADED text with yellow color
00:03 +30: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App handles unsupported or error command responses and shows error banner
00:03 +31: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App handles unsupported or error command responses and shows error banner
00:03 +32: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App handles unsupported or error command responses and shows error banner
00:03 +33: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App handles unsupported or error command responses and shows error banner
00:03 +34: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App handles unsupported or error command responses and shows error banner
00:03 +35: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App gates agent.status and agent.command without required inputs
00:03 +36: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: Client App gates agent.status and agent.command without required inputs
00:04 +37: /config/workspace/iop-s0/apps/client/test/runtime_panel_test.dart: RuntimePanel keeps loaded empty history visible while a command is pending
00:04 +38: /config/workspace/iop-s0/apps/client/test/notification_integration_test.dart: notification stream from NexoNotificationHostIntegration connects to UI snackbar
00:04 +39: /config/workspace/iop-s0/apps/client/test/notification_integration_test.dart: notification stream from NexoNotificationHostIntegration connects to UI snackbar
00:04 +40: /config/workspace/iop-s0/apps/client/test/notification_integration_test.dart: notification stream shows channel-only message when sender is empty
00:04 +41: /config/workspace/iop-s0/apps/client/test/notification_integration_test.dart: notification stream ignores non-message events (e.g. system)
00:05 +42: All tests passed!
Analyzing client...

No issues found! (ran in 12.0s)
exit status: 0
```

```text
ok  	iop/packages/go/auth	8.086s
ok  	iop/packages/go/config	0.742s
ok  	iop/packages/go/credentiallease	0.030s
exit status: 0
```

```text
ok  	iop/apps/control-plane/cmd/control-plane	7.025s
ok  	iop/apps/control-plane/internal/credentiallease	0.473s
ok  	iop/apps/control-plane/internal/credentialops	4.262s
ok  	iop/apps/control-plane/internal/credentialseal	0.349s
ok  	iop/apps/control-plane/internal/credentialstore	8.814s
ok  	iop/apps/control-plane/internal/wire	1.581s
ok  	iop/apps/edge/cmd/edge	0.813s
ok  	iop/apps/edge/internal/authprojection	0.073s
ok  	iop/apps/edge/internal/bootstrap	8.484s
ok  	iop/apps/edge/internal/configrefresh	0.612s
ok  	iop/apps/edge/internal/controlplane	4.533s
ok  	iop/apps/edge/internal/edgecmd	0.220s
ok  	iop/apps/edge/internal/edgevalidate	0.057s
ok  	iop/apps/edge/internal/events	0.040s
ok  	iop/apps/edge/internal/input	0.104s
ok  	iop/apps/edge/internal/input/a2a	0.077s
ok  	iop/apps/edge/internal/node	0.066s
ok  	iop/apps/edge/internal/openai	7.511s
ok  	iop/apps/edge/internal/opsconsole	0.091s
ok  	iop/apps/edge/internal/service	5.988s
ok  	iop/apps/edge/internal/transport	4.833s
ok  	iop/apps/node/cmd/node	0.149s
ok  	iop/apps/node/internal/adapters	0.080s
?   	iop/apps/node/internal/adapters/mock	[no test files]
ok  	iop/apps/node/internal/adapters/ollama	0.058s
ok  	iop/apps/node/internal/adapters/openai_compat	0.177s
ok  	iop/apps/node/internal/adapters/vllm	0.156s
ok  	iop/apps/node/internal/bootstrap	1.559s
ok  	iop/apps/node/internal/node	0.900s
ok  	iop/apps/node/internal/router	0.523s
ok  	iop/apps/node/internal/store	0.144s
ok  	iop/apps/node/internal/transport	5.596s
exit status: 0
```

```text
ok  	iop/packages/go/credentiallease	1.099s
ok  	iop/apps/control-plane/internal/credentiallease	1.312s
ok  	iop/apps/edge/internal/authprojection	1.053s
ok  	iop/apps/edge/internal/service	7.010s
ok  	iop/apps/node/internal/node	2.283s
exit status: 0
```

```text
./scripts/e2e-control-plane-edge-wire.sh
[cp-edge-wire] NOTE: auxiliary smoke only - verifies Control Plane-Edge hello and disconnect via real processes.
[cp-edge-wire] shellcheck not found, skipping
[cp-edge-wire] ports: cp_http=29361 cp_ws=30532 cp_edge_wire=31434 edge_node=32257 edge_bootstrap=34064 edge_metrics=34402
[cp-edge-wire] building temp binaries...
[cp-edge-wire] starting Control Plane...
[cp-edge-wire] waiting for Control Plane edge wire port 31434 (timeout: 20s)...
[cp-edge-wire] Control Plane edge wire port ready
[cp-edge-wire] starting Edge...
[cp-edge-wire] waiting for hello accepted (timeout: 30s)...
[cp-edge-wire] CP: hello accepted
[cp-edge-wire] Edge: connected to control plane
[cp-edge-wire] stopping Edge process to trigger disconnect...
[cp-edge-wire] waiting for disconnect marker on CP (timeout: 20s)...
[cp-edge-wire] CP: edge disconnected
=== CONTROL PLANE OUTPUT ===
{"level":"info","ts":1785594611.2072315,"caller":"control-plane/server.go:28","msg":"control-plane client wire endpoint reserved","protocol":"protobuf-socket","transport":"proto-socket-ws","listen":"127.0.0.1:30532"}
{"level":"info","ts":1785594611.2076738,"caller":"control-plane/server.go:33","msg":"control-plane edge wire endpoint reserved","protocol":"protobuf-socket","transport":"proto-socket-tcp","listen":"127.0.0.1:31434"}
{"level":"info","ts":1785594611.2078788,"caller":"wire/client.go:92","msg":"starting client wire WS server","host":"127.0.0.1","port":30532,"path":"/client"}
{"level":"info","ts":1785594611.2096481,"caller":"wire/edge_server.go:189","msg":"starting edge wire TCP server","host":"127.0.0.1","port":31434,"transport":"proto-socket-tcp"}
{"level":"info","ts":1785594611.2103,"caller":"control-plane/server.go:224","msg":"control-plane http endpoint listening","listen":"127.0.0.1:29361"}
{"level":"info","ts":1785594611.7158916,"caller":"wire/edge_server.go:126","msg":"edge hello accepted","edge_id":"smoke-edge-wire","edge_name":"Smoke Edge Wire","version":"0.1.0"}
{"level":"info","ts":1785594612.1833556,"caller":"wire/edge_server.go:170","msg":"edge disconnected","edge_id":"smoke-edge-wire","reason":"remote_closed"}
=== EDGE PROCESS OUTPUT ===
[Fx] PROVIDE	fx.Lifecycle <= go.uber.org/fx.New.func1()
[Fx] PROVIDE	fx.Shutdowner <= go.uber.org/fx.(*App).shutdowner-fm()
[Fx] PROVIDE	fx.DotGraph <= go.uber.org/fx.(*App).dotGraph-fm()
[Fx] PROVIDE	*config.EdgeConfig <= iop/apps/edge/internal/bootstrap.Module.func1()
[Fx] PROVIDE	*bootstrap.Runtime <= iop/apps/edge/internal/bootstrap.NewRuntime()
[Fx] INVOKE		iop/apps/edge/internal/bootstrap.Module.func2()
[Fx] RUN	provide: go.uber.org/fx.New.func1()
[Fx] RUN	provide: iop/apps/edge/internal/bootstrap.Module.func1()
[Fx] RUN	provide: iop/apps/edge/internal/bootstrap.NewRuntime()
[Fx] HOOK OnStart		iop/apps/edge/internal/bootstrap.Module.func2.1() executing (caller: iop/apps/edge/internal/bootstrap.Module.func2)
[Fx] HOOK OnStart		iop/apps/edge/internal/bootstrap.Module.func2.1() called by iop/apps/edge/internal/bootstrap.Module.func2 ran successfully in 3.552334ms
[Fx] RUNNING
[Fx] TERMINATED
[Fx] HOOK OnStop		iop/apps/edge/internal/bootstrap.Module.func2.2() executing (caller: iop/apps/edge/internal/bootstrap.Module.func2)
[Fx] HOOK OnStop		iop/apps/edge/internal/bootstrap.Module.func2.2() called by iop/apps/edge/internal/bootstrap.Module.func2 ran successfully in 1.078458ms
=== EDGE LOG ===
{"level":"info","ts":1785594611.7123413,"caller":"transport/server.go:130","msg":"edge listening for nodes","addr":"127.0.0.1:32257"}
{"level":"warn","ts":1785594611.7137084,"logger":"bootstrap","caller":"bootstrap/artifact_server.go:35","msg":"bootstrap artifact directory does not exist","dir":"/config/workspace/.gotmp-iop-secure-delivery/tmp.wPcd3erKIq/artifacts"}
{"level":"info","ts":1785594611.713952,"logger":"bootstrap","caller":"bootstrap/artifact_server.go:59","msg":"bootstrap artifact server listening","addr":"127.0.0.1:34064","dir":"/config/workspace/.gotmp-iop-secure-delivery/tmp.wPcd3erKIq/artifacts"}
{"level":"info","ts":1785594611.7167394,"logger":"controlplane","caller":"controlplane/connector.go:358","msg":"connected to control plane","wire_addr":"127.0.0.1:31434","protocol":"protobuf-socket"}
===========================
[cp-edge-wire] Control Plane-Edge wire smoke PASSED.
IOP_SECURE_DELIVERY_E2E=1 go test -count=1 -run '^TestSecureDeliveryThreeProcess$' ./apps/control-plane/cmd/control-plane
ok  	iop/apps/control-plane/cmd/control-plane	8.253s
exit status: 0
```

The same three-process test was also run with `-v`; its actual sanitized result was:

```text
=== RUN   TestSecureDeliveryThreeProcess
    secure_delivery_integration_test.go:398: secure delivery full cycle passed: HTTPS management and ingress, CP-Edge/Edge-Node mTLS, Node-sealed lease, exact upstream auth, in-flight completion, and post-revoke fence
--- PASS: TestSecureDeliveryThreeProcess (8.98s)
PASS
ok  	iop/apps/control-plane/cmd/control-plane	9.032s
exit status: 0
```

`go vet`, `git diff --check`, and the guarded runtime-proto search each produced no stdout; the combined exit status was 0.

Full-cycle observations: the fixture generates a temporary CA, named SPIFFE identities, strict Ed25519/X25519 key files, and an at-rest key manifest; starts real Control Plane, Edge, and Node processes; performs principal-authenticated slot and route mutations only over TLS 1.3 HTTPS; waits for both authenticated mTLS wires; sends the managed request over TLS 1.3 HTTPS; and checks the fake upstream receives exactly one expected `Authorization` value. It holds that upstream attempt, revokes the route through HTTPS, permits that already-started request to finish, rejects a second request before upstream, and asserts the upstream call count remains one.

Intentional secret-bearing representations are limited to the signed/sealed `SignedCredentialLease` dedicated protobuf field and Node request-local `ProviderCredential.Secret`. Generic protobuf header maps contain no credential field, as proven by the zero-match structural guard. The integration fixture reads all three process output files after shutdown and fails if the provider-secret sentinel occurs; it passed. Unit redaction tests additionally assert the sentinel is absent from protobuf debug strings, errors, responses, and captured generic headers.

After adding idempotent fixture cleanup for failure paths, the exact three-process test and `git diff --check` were rerun. `git diff --check` produced no stdout:

```text
ok  	iop/apps/control-plane/cmd/control-plane	10.979s
exit status: 0
```

---

> **[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 finalization steps |
| Archive Evidence Snapshot | Fixed at stub creation from plan | Implementing agent uses it as prior-loop context |
| Implementation Item Completion (item names) | Fixed at stub creation | Implementing agent checks status only |
| Implementation Checklist (item text/order) | Fixed at stub creation from plan | Implementing agent checks status 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 placeholders with actual content |
| Reviewer Checkpoints | Fixed | Pre-filled from plan |
| Verification Results | Implementing agent | Fill actual output only; command changes require a deviation entry |
| Code Review Result | Review agent appends | Not included in stub |

## Code Review Result

- Overall Verdict: FAIL
- Dimension Assessment:
  - Correctness: Fail — same-role certificates are not bound to the logical Edge or Node enrollment identity, and managed projections become unusable after an unchanged reconnect or five minutes without a credential mutation.
  - Completeness: Fail — the secure transport and managed activation items omit enrollment-name binding, periodic projection renewal, and same-generation reconnect handling.
  - Test coverage: Fail — the passing peer matrix covers wrong role/CA/server DNS name but not same-role wrong-name impersonation, and connector tests never combine reconnect with an installed principal projection.
  - API contract: Fail — TLS authentication currently establishes only a role when `peer_name` is omitted; the application hello/register contracts then trust caller-supplied logical identity without binding it to the authenticated URI SAN.
  - Code quality: Pass — no independent debug-code, dead-code, or formatting defect was found in the reviewed secure-delivery implementation.
  - Plan deviation: Fail — the implementation records exact peer role/name verification and reconnect coverage as complete, but production managed defaults permit empty peer names and the managed reconnect path rejects the Control Plane's unchanged generation.
  - Verification trust: Fail — fresh reviewer tests pass, but static production evidence directly contradicts the claimed exact enrollment-name and managed reconnect closure, so the reported suite is not a sufficient behavioral oracle.
  - Spec conformance: Fail — SDD S10's enrollment-bound system identity and the projection fresh/stale refresh model required by S02 and secure activation are not met.
- Findings:
  - Required — `packages/go/auth/auth.go:31`, `packages/go/auth/auth.go:92`, `apps/control-plane/internal/wire/edge_server.go:109`, and `apps/edge/internal/transport/connection_handlers.go:70`: an empty `peer_name` accepts every `spiffe://iop/<role>/<name>` certificate, while Edge hello accepts any caller-supplied `edge_id` and Node registration accepts the node selected only by a bearer registration token. Consequently, a CA-issued `edge/edge-a` certificate can enroll as `edge-b`, and a CA-issued `node/node-a` certificate can use `node-b`'s token and register as `node-b`. Parse one unambiguous authenticated URI SAN from the TLS connection and require its name to equal `EdgeHelloRequest.edge_id` or the token-resolved Node record ID before registry mutation, lease access, or recipient-key acceptance; add same-role wrong-name CP-Edge and Edge-Node TLS regressions.
  - Required — `apps/control-plane/cmd/control-plane/server.go:95`, `apps/control-plane/cmd/control-plane/server.go:109`, `apps/control-plane/internal/wire/edge_server.go:214`, `apps/edge/internal/controlplane/connector.go:333`, and `apps/edge/internal/authprojection/cache.go:316`: the Control Plane builds five-minute projections only for hello and credential mutations, while the Edge rejects every candidate whose generation is equal to the installed generation. With no mutation, the cache expires permanently; after any transient disconnect, hello returns the same durable generation and the connector closes and retries forever until another mutation advances it. Add authenticated periodic renewal before expiry and make an equal-generation renewal idempotent only when its immutable token/route content is identical, while retaining rejection for lower generations or changed equal-generation content; cover expiry renewal, managed reconnect, mutation/revocation ordering, and concurrent refresh with deterministic tests.
- Routing Signals: `review_rework_count=3`, `evidence_integrity_failure=true`
- Next Step: Create and execute a freshly routed follow-up PLAN/CODE_REVIEW pair for both Required findings, preserving the S10-S13 secure-delivery scope.
