← Back to Pull requests

Add no-network model-name validation check and test #37

Closed
unknown closed this pull request without merging on Oct 19, 2026 00:58 UTC
View on GitHub
unknown unknown commented on Oct 19, 2026 00:14 UTC
Author

Adds an offline Django system check and tests so a misconfigured pydantic-ai model identifier fails at manage.py check / CI instead of as a runtime 404.

  • races/agents.py: _build_model_identifier() is now the single place that builds the identifier. Both the race agent and the chat agent use it, so the check exercises the real construction path.

  • races/checks.py (registered through the new races/apps.py ready()): check_pydantic_ai_model builds Agent(_build_model_identifier()). It reports:

  • - ai.E001 if the model name still contains : (double prefix),
    - ai.E002 if the model class isn't OpenAIChatModel (for example bare openai: or openai-responses:),
    - ai.E003 if the model can't be resolved at all.
    It supplies a placeholder OPENAI_API_KEY only when none is set, because the provider constructor requires one. No request is ever made.
  • tests/test_ai_model_check.py: asserts the configured model resolves with no : in the name and is an OpenAIChatModel, and that the check flags double-prefix, openai:, openai-responses: and unknown-provider identifiers.

  • CI: new manage check step before pytest.

  • pyproject.toml: whitespace change from the repo's TOML formatter, which just lint applies.
  • Notes:

  • The issue refers to AI_MODEL, but this project's setting is PYDANTIC_AI_MODEL, so the check and the error messages use that name.

  • The default was openai-responses:gpt-5.6-luna, which the new check rejects (it resolves to OpenAIResponsesModel). I changed the default in config/settings.py and .env-dist to openai-chat:gpt-5.6-luna. Deployments that set PYDANTIC_AI_MODEL explicitly, and local .env files copied from the old .env-dist, need updating, or manage.py check will fail.
  • Testing:

  • Ran in the project's docker compose service with PYDANTIC_AI_MODEL=openai-chat:gpt-5.6-luna and SECRET_KEY set.

  • The new tests all pass.

  • manage check reports no issues.

  • With the stale local .env (openai-responses:), the new tests fail with ai.E002, as intended.

  • The rest of the suite errors in my environment because no database was available there, so I didn't run those tests.

  • just lint passes.
  • Closes #24

    Diff: 276 lines (+207 / -69) across 3 files Reviewer: jefftriplett Review duration: 43m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.45) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 276 lines diff across 3 files
    0.45
    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%
    56%
    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.336
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #37"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 44.6% (MEDIUM) · Higher = larger blast radius
    44.6%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 19.3% · Safe to merge
    19.3%