# Complete - m-provider-catalog-device-status/02+01_edge_dispatch

## 완료 일시

2026-06-20

## 요약

Provider-pool Edge dispatch의 adapter/target rewrite와 provider slot selection-policy 보강을 3회 리뷰 루프로 완료했다. 최종 판정은 PASS.

## 루프 이력

| Plan | Review | Verdict | 메모 |
|------|--------|---------|------|
| `plan_local_G07_0.log` | `code_review_local_G07_0.log` | FAIL | provider-pool selected candidate가 dispatch adapter를 보존하지 않았고 provider slot accounting/filtering이 부족했다. |
| `plan_local_G07_1.log` | `code_review_local_G07_1.log` | FAIL | timeout/cancel race cleanup mutex contract, capacity 0/unknown filtering, 실제 경로 테스트 evidence가 부족했다. |
| `plan_local_G07_2.log` | `code_review_local_G07_2.log` | PASS | Required 항목 해소, 실제 SubmitRun/candidate filtering tests와 race/full Edge 검증 통과. |

## 구현/정리 내용

- Provider-pool candidate가 provider id, dispatch adapter, concrete served target을 보존하고 selected candidate 기준으로 Node `RunRequest.Adapter`와 `Target`을 rewrite한다.
- Queue admission, release, load-ratio, status accounting을 provider slot 단위로 분리하면서 legacy adapter/target queue 동작을 유지했다.
- Provider-pool candidate generation에서 unavailable/unknown health, served-model mismatch, empty adapter, capacity 0/unknown provider를 제외한다.
- Timeout/cancel race cleanup이 shared queue state를 mutex 없이 수정하지 않도록 lock-aware release path를 사용한다.
- Provider-pool SubmitRun request capture, real `resolveProviderPoolCandidates` filtering, same-node provider capacity, queue timeout/status regression tests를 추가/보강했다.
- 리뷰 중 stale mutex comment를 비동작성으로 정리했다.

## 최종 검증

- `go test ./apps/edge/internal/service -run 'TestModelQueue.*Provider|TestModelQueue.*Timeout|TestSubmitRunModelQueueDispatchesQueuedRunAfterDisconnectToLiveNode' -count=1 -v` - PASS; `ok iop/apps/edge/internal/service 0.132s`.
- `go test -race ./apps/edge/internal/service -run 'TestModelQueue.*Provider|TestModelQueue.*Timeout' -count=1` - PASS; `ok iop/apps/edge/internal/service 1.109s`.
- `go test ./apps/edge/internal/service -run 'TestSubmitRunProviderPoolRewritesAdapterAndTarget|TestResolveProviderPoolCandidatesFiltersInvalidProviders|TestBuildRunRequest' -count=1 -v` - PASS; `ok iop/apps/edge/internal/service 0.056s`.
- `go test ./apps/edge/internal/service -run 'TestSubmitRunProviderPool|TestResolveProviderPoolCandidates|TestModelQueue.*Provider|TestModelQueue.*Timeout|TestProviderStatus|TestListNodeSnapshots' -count=1 -v` - PASS; `ok iop/apps/edge/internal/service 0.155s`.
- `go test ./apps/edge/internal/openai ./apps/edge/internal/service -count=1` - PASS; `ok iop/apps/edge/internal/openai 1.509s`, `ok iop/apps/edge/internal/service 0.440s`.
- `go test ./apps/edge/... -count=1` - PASS; all Edge packages passed, including service/openai/controlplane/transport.
- `git diff --check` - PASS; no whitespace errors.

## Roadmap Completion

- Milestone: `agent-roadmap/phase/operational-observability-provider-management/milestones/provider-catalog-device-status.md`
- Completed task ids:
  - `target-rewrite`: PASS; evidence=`plan_local_G07_2.log`, `code_review_local_G07_2.log`; verification=`go test ./apps/edge/internal/service -run 'TestSubmitRunProviderPool|TestResolveProviderPoolCandidates|TestModelQueue.*Provider|TestModelQueue.*Timeout|TestProviderStatus|TestListNodeSnapshots' -count=1 -v`
  - `selection-policy`: PASS; evidence=`plan_local_G07_2.log`, `code_review_local_G07_2.log`; verification=`go test -race ./apps/edge/internal/service -run 'TestModelQueue.*Provider|TestModelQueue.*Timeout' -count=1`
- Not completed task ids: 없음

## Spec Completion

- SDD: `agent-roadmap/sdd/operational-observability-provider-management/provider-catalog-device-status/SDD.md`
- Completed scenario ids:
  - `S03`: PASS; task=`target-rewrite`; evidence=`plan_local_G07_2.log`, `code_review_local_G07_2.log`; verification=`TestSubmitRunProviderPoolRewritesAdapterAndTarget`
  - `S04`: PASS; task=`selection-policy`; evidence=`plan_local_G07_2.log`, `code_review_local_G07_2.log`; verification=`TestResolveProviderPoolCandidatesFiltersInvalidProviders`, `TestModelQueueProviderCapacityIsPerProviderSlot`, `go test -race ./apps/edge/internal/service -run 'TestModelQueue.*Provider|TestModelQueue.*Timeout' -count=1`
- Not completed scenario ids: 없음

## 잔여 Nit

- 없음

## 후속 작업

- 없음
