← Back to Pull requests

Allow self-route keys to use owned local models #471

Closed
unknown closed this pull request without merging on Jul 04, 2026 20:03 UTC
View on GitHub
unknown unknown commented on Jun 26, 2026 15:29 UTC
Author

Summary


  • Allow self-route-only API keys to use owned off-catalog local models.

  • Return owned live machine models from /v1/models for self-route-only keys.

  • Show machine models in the API-key picker when "My Machine only" is selected.
  • Before / After

    flowchart TB
      subgraph Before
        A1[request model X on self-route-only key] --> B1{X in public catalog?}
        B1 -- no --> C1[404 model_not_found]
        B1 -- yes --> D1[route to owned box only]
        L1[GET /v1/models] --> M1[public catalog list]
      end
      subgraph After
        A2[request model X on self-route-only key] --> B2{exclusive self-route?}
        B2 -- yes --> D2[route to owned box advertising X<br/>off-catalog OK; catalog builds still hash-checked;<br/>vision + hardware-fit gates use advertised metadata]
        B2 -- no --> E2{X in catalog?} -- no --> C2[404 model_not_found]
        E2 -- yes --> F2[public routing unchanged]
        L2[GET /v1/models + /v1/models/id<br/>self-route-only key] --> M2[owner's live machine models<br/>OwnedModels: fresh challenge, runtime-verified]
      end
    

    flowchart TB
      subgraph Before code
        a1[handleChatCompletions] --> b1[IsModelInCatalog gate]
        b1 --> c1[providerServesRoutableModelLocked<br/>always catalog+hash check]
        c1 --> d1[providerServesVisionModelLocked<br/>catalog-only]
        d1 --> e1[fit gates: catalogSizeGBLocked<br/>0 for off-catalog = fail open]
      end
      subgraph After code
        a2[handleChatCompletions] --> b2[catalog gate skipped when policy.enabled]
        b2 --> c2[providerServesRoutableModelLocked<br/>owner ctx: providerServesOwnedRoutableModelLocked<br/>= advertised AND catalog-allowed-or-untracked]
        c2 --> d2[providerServesVisionModelLocked allowOffCatalog<br/>same owner rule; public sites pass false]
        d2 --> e2[fit gates: modelSizeGBForFitLocked<br/>catalog size, else advertised SizeBytes]
        f2[handleListModels/handleGetModel<br/>self-route branch -> selfRouteModelEntries] --> g2[registry.OwnedModels]
        h2[console: /api/me/provider-models proxy<br/>KeyForm visibleAllowed by route mode]
      end
    

    Test plan


  • docker run --rm -v "$PWD":/repo -w /repo golang:1.25 go test ./coordinator/registry ./coordinator/api

  • npm test -- __tests__/self-route.test.tsx

  • Maintainer review pass (31eac797): weight-hash gate kept in owner context, /v1/models/{id} parity, OwnedModels attestation metadata, KeyForm preserves saved allow-list entries; full go test ./registry ./api + vitest green.
  • Diff: 308 lines (+231 / -77) across 3 files Reviewer: justin-schroeder Review duration: 11793m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 308 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.343
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #471"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.2% (MEDIUM) · Higher = larger blast radius
    40.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.9% · Safe to merge
    15.9%