# Complete - m-provider-usage-attribution-hot-path/01_attribution_binding_foundation

## Completion Time

2026-07-31

## Summary

Completed the provider usage-attribution binding foundation in one review loop with a final PASS verdict.

## Loop History

| Plan | Review | Verdict | Notes |
|------|--------|---------|-------|
| `plan_local_G07_0.log` | `code_review_cloud_G07_0.log` | PASS | Added validated attribution policy and direct provider identity config, propagated actual dispatch binding, synchronized contracts/specs, and repaired enabled-OpenAI guide examples. |

## Implementation/Cleanup

- Added the provider-default and explicit model-group attribution policy with validated direct provider identity configuration.
- Preserved actual provider, served target, resolved node, and effective attribution policy across direct and provider-pool normalized/tunnel dispatch results.
- Removed adapter/node fallback from strict OpenAI provider binding.
- Synchronized config-refresh classification, the config contract, current implementation specs, and public enabled-OpenAI examples.

## Final Verification

- `GOWORK=off GOFLAGS="-modfile=/config/workspace/iop-provider-review.mnA42g/provider-usage.mod" GOCACHE=/config/workspace/iop-provider-review.mnA42g/gocache GOTMPDIR=/config/workspace/iop-provider-review.mnA42g/gotmp go test -count=1 ./packages/go/config -run 'UsageAttribution|DirectProviderBinding|OpenAIRouteCatalog|ProviderPoolLegacyCompatibility|StreamEvidenceGate'` - PASS; `iop/packages/go/config`.
- `GOWORK=off GOFLAGS="-modfile=/config/workspace/iop-provider-review.mnA42g/provider-usage.mod" GOCACHE=/config/workspace/iop-provider-review.mnA42g/gocache GOTMPDIR=/config/workspace/iop-provider-review.mnA42g/gotmp go test -count=1 ./apps/edge/internal/service -run 'ActualProviderBinding'` - PASS; `iop/apps/edge/internal/service`.
- `GOWORK=off GOFLAGS="-modfile=/config/workspace/iop-provider-review.mnA42g/provider-usage.mod" GOCACHE=/config/workspace/iop-provider-review.mnA42g/gocache GOTMPDIR=/config/workspace/iop-provider-review.mnA42g/gotmp go test -count=1 ./apps/edge/internal/openai -run 'UsageAttributionRouteDispatchBinding|ProviderPoolDispatch|LegacyRoute'` - PASS; `iop/apps/edge/internal/openai`.
- `GOWORK=off GOFLAGS="-modfile=/config/workspace/iop-provider-review.mnA42g/provider-usage.mod" GOCACHE=/config/workspace/iop-provider-review.mnA42g/gocache GOTMPDIR=/config/workspace/iop-provider-review.mnA42g/gotmp go test -count=1 ./packages/go/config ./apps/edge/internal/service ./apps/edge/internal/openai ./apps/edge/internal/configrefresh` - PASS.
- `GOWORK=off GOFLAGS="-modfile=/config/workspace/iop-provider-review.mnA42g/provider-usage.mod" GOCACHE=/config/workspace/iop-provider-review.mnA42g/gocache GOTMPDIR=/config/workspace/iop-provider-review.mnA42g/gotmp go test -race -count=1 ./apps/edge/internal/service ./apps/edge/internal/openai` - PASS.
- `GOWORK=off GOFLAGS="-modfile=/config/workspace/iop-provider-review.mnA42g/provider-usage.mod" GOCACHE=/config/workspace/iop-provider-review.mnA42g/gocache GOTMPDIR=/config/workspace/iop-provider-review.mnA42g/gotmp go test -count=1 ./apps/edge/cmd/edge ./apps/edge/internal/bootstrap` - PASS.
- `GOWORK=off GOFLAGS="-modfile=/config/workspace/iop-provider-review.mnA42g/provider-usage.mod" GOCACHE=/config/workspace/iop-provider-review.mnA42g/gocache GOTMPDIR=/config/workspace/iop-provider-review.mnA42g/gotmp go test -count=1 ./packages/go/streamgate ./packages/go/config ./apps/edge/internal/openai` - PASS.
- `gofmt -l` over every changed Go file and `git diff --check` - PASS; no output.
- `rg --sort path --count-matches 'usage_attribution|provider_id' configs/edge.yaml agent-contract/inner/edge-config-runtime-refresh.md agent-spec/input/openai-compatible-surface.md agent-spec/runtime/provider-pool-config-refresh.md agent-spec/runtime/edge-node-execution.md` - PASS; counts `5, 8, 8, 5, 6`.
- `IOP_EDGE_CONFIG=/config/workspace/iop-manual-review.UiMT2g/edge.yaml ./scripts/dev/edge.sh` and `IOP_NODE_CONFIG=/config/workspace/iop-manual-review.UiMT2g/node.yaml ./scripts/dev/node.sh` as separately started processes - PASS; registration, two foreground message relays, node/Edge payload equality, terminal ordering, `/nodes`, `/capabilities`, `/transport`, `/sessions`, `/terminate-session`, and explicit unsupported `/status` were observed.
- `TMPDIR=/config/workspace/iop-provider-review.mnA42g/smoke-tmp IOP_E2E_PROFILE=mock ./scripts/e2e-smoke.sh` - PASS; Edge/Node registration, two foreground relays, background dispatch, `/nodes`, `/capabilities`, `/transport`, `/sessions`, and `/terminate-session` completed.
- `IOP_LONG_SMOKE_EDGE_BIN=/config/workspace/iop-provider-review.mnA42g/iop-edge ./scripts/e2e-long-context-admission-smoke.sh --preflight --config configs/edge.yaml --out-dir /config/workspace/iop-provider-review.mnA42g/long-preflight` - BLOCKED; config check passed, while the optional live dev `/v1/models` and Control Plane status endpoints were unavailable from this runner.

## Remaining Nits

- None.

## Follow-up Work

- The active dependent sibling `02+01_attempt_usage_emission` remains responsible for per-attempt provider usage emission and terminal-counter separation.
