← Back to Pull requests

Model access plans: (model, plan) routing with per-plan auth, endpoints and listing #1414

Open
unknown opened this pull request with 435 lines diff across 5 files
View on GitHub
unknown unknown commented on Dec 05, 2026 02:54 UTC
Author

Adds access plans: named, authenticated routes to models ([access.<name>]) plus a [routing] order. A conversation now targets (model, access_plan). Existing [llm]/env/Codex setups keep working unchanged.

What changes for users


  • Several providers or accounts at once. Each plan has its own auth (codex_oauth, env, or helper), its own endpoints per protocol, scoped headers and request tags, name rules (strip_prefix, add_prefix, overrides), include/exclude filters, output caps and an optional models_url. The TOML never holds a secret.

  • Model-first picker. There is still one row per model. A via <plan> select appears only when more than one plan serves the selected model. Switching plans between turns goes through upgrade-model, and a plan never changes mid-turn.

  • connection in [agents]/[tiers]/spawn_agents now names an access plan. With no [access] section, plan names are the old connection names.

  • No automatic failover. A pinned plan that stops serving its model fails with a message naming the plans that still do.
  • How it works


  • Legacy mode (no [access]): Phoenix builds plans named codex, anthropic, openai_responses, openai_chat_completions and mock. A golden route table recorded on main before the refactor proves the routes are byte-identical: request name, endpoint, auth style, tags, route key, capabilities and default model.

  • Declared mode ([access] present): any [llm] table or legacy routing env var is a startup error that names its replacement. --validate-user-config also checks worker/tier connections against the declared plans.

  • Registry: keyed by RouteId { model, plan }. Declared plans append :access=<plan> to the continuation route key, so a plan change always retires provider-private replay. An official provider URL declared on a plan behaves exactly like direct access.

  • Listing: each plan's listing is cached and refreshed in the background, so startup no longer waits on it. Listings decide which routes are advertised. They never block execution of a route a conversation is already pinned to. Listed IDs with a leading models/ (Google's OpenAI-compatible endpoint) match.

  • Persistence: migration 201 adds conversations.access_plan, moves the old sub_agent_execution_routes rows into it and drops that table. It also adds a nullable plan to product creation jobs, turn_usage and request metrics.

  • - New conversations pin a plan at creation.
    - Older rows pin lazily at their first runtime build to today's route. Continuation successors inherit their predecessor's plan.
    - Sub-agents inherit the parent's exact route.
  • API:

  • - /api/models adds per-model access_plans and default_access_plan, plus a status for each plan.
    - Create and upgrade-model accept access_plan. Upgrade keeps the current plan for the same model when it is omitted. A capacity replan runs on a model or plan change.
    - /api/credential-helper/run accepts ?plan=.
    - Conversation JSON and usage turns carry the plan.
    - phoenix-client.py gets --access-plan.

    Specs: ADR-362; REQ-LLM-015–018 plus revised LLM, agents, sub-agent and scanner requirements, with Allium updated. Docs: docs/agents-config.md has both example configs and a migration table.

    Not in this PR: a plan editor in Phoenix.app. The app's [llm] editor still works in legacy mode; in declared mode the bundled validator rejects a mixed file.

    Diff: 435 lines (+326 / -109) across 5 files Reviewer: scottopell Review duration: 451m
    All Vouch review confidence checks passed
    Residual risk 0.44 = Change Risk (0.73) × (1 − Review Confidence (0.40)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.73 · 435 lines diff across 5 files
    0.73
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    40%
    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.364
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.073
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #1414"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 40.5% reviewed sensitive_module
    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: 73.4% (HIGH) · Higher = larger blast radius
    73.4%
    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: 40.5% · Lower = rushed or shallow review
    40.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: 43.7% · Moderate risk
    43.7%