Skip to content

Fix preflight model-family identity across routed models - #4

Merged
cirsteve merged 2 commits into
mainfrom
fix/model-family-preflight
Sep 5, 2026
Merged

cirsteve merged 2 commits into
mainfrom
fix/model-family-preflight

Conversation

@cirsteve

@cirsteve cirsteve commented Sep 5, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Separate model identity resolution from Jig transport routing and the preflight diversity policy.
  • Recognize Claude, GPT/ChatGPT, OpenAI o-series, Gemini, Kimi, and Qwen with namespace-checked OpenRouter identities; supported direct routes resolve to the same families.
  • Preserve the two-family default while allowing the deployment-local SCOUT_MODEL_IDENTITY_CONFIG JSON setting to declare a pipeline-wide minimum of 1–3 families.
  • Allow exact custom alias/model metadata in ignored local .env configuration. Infer transport from the original Jig model identifier; declarations cannot reroute models or contradict known built-in identities.
  • Reject unresolved identities, conflicting/duplicate declarations, malformed configuration, and unsupported routes rather than inventing families. Every phase must resolve even when the local policy permits a single family.
  • Retain model_families, add built-in versus declared provenance to model_identities, and print the effective model_diversity_policy.
  • Keep model selection, custom mappings, and policy choices local; public code supplies reusable resolution, validation, defaults, documentation, and tests. Diversity is not proof of evaluator independence.

Scope

Preflight currently treats the openrouter/ transport prefix as a model family,
incorrectly collapsing different underlying families into one. This change
separates model identity from routing and diversity policy. It does not select
active models, run paid experiments, or change task authority.

Kimi and Qwen support here means identity recognition, not selection as active models or authorization of experiment candidates. Family recognition does not validate endpoint availability, pricing, credentials, or behavioral qualification.

Validation

  • uv run pytest -q: 2,069 passed, 11 skipped; existing audioop deprecation warning.
  • Targeted model-identity and preflight tests: 95 passed, covering built-in identities, local alias declarations, explicit policy requirements, fail-closed validation, and database preservation.
  • uv run ruff check .: passed.
  • uv run mypy .: passed (90 source files).
  • uv build: source distribution and wheel passed.
  • git diff --check: passed.

No web code or dependencies changed; web tests were not rerun locally.

Summary by CodeRabbit

  • New Features

    • Added optional deployment-local model identity configuration, including custom aliases, routes, developers, and families.
    • Added configurable model-diversity policies, including minimum family requirements.
    • Exact declared aliases are now recognized without rerouting.
  • Bug Fixes

    • Preflight now fails early with validation feedback for missing, malformed, duplicate, or conflicting identity settings.
  • Documentation

    • Expanded configuration guidance, policy details, validation behavior, report metadata, and environment variable examples.

@coderabbitai

coderabbitai Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Essentials

Run ID: a9a6faa6-3f8f-4ac6-b219-977e51e80e3e

📥 Commits

Reviewing files that changed from the base of the PR and between 9142c07 and 2c3ad13.

📒 Files selected for processing (7)
  • .env.example
  • docs/configuration.md
  • src/scout/config.py
  • src/scout/model_identity.py
  • src/scout/scanning/runner.py
  • tests/test_load_projects.py
  • tests/test_model_identity.py

Included review availability: 1 review is currently available. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.


📝 Walkthrough

Walkthrough

The change adds deployment-local model identity declarations and configurable family-diversity policies. Preflight now validates this configuration, resolves exact aliases, records identity sources and policy metadata, and applies the configured diversity threshold. Tests and documentation cover validation, reporting, and read-only behavior.

Changes

Configurable model identity preflight

Layer / File(s) Summary
Identity configuration and resolution
src/scout/model_identity.py, tests/test_model_identity.py
Adds typed identity metadata, dispatch and ollama routes, declared identity validation, exact alias matching, configurable family thresholds, and coverage for valid and invalid configurations.
Preflight configuration and diversity checks
src/scout/config.py, src/scout/scanning/runner.py, tests/test_load_projects.py
Reads SCOUT_MODEL_IDENTITY_CONFIG, validates it during preflight, records the effective policy, resolves configured identities, and runs diversity checks after successful resolution. Integration tests verify readiness and database immutability.
Configuration and report documentation
.env.example, docs/configuration.md
Documents local identity declarations, policy limits, alias matching, validation failures, and identity and policy fields in preflight reports.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 2c3ad

The configurable identity resolution and diversity-policy changes are ready to merge.

Sequence Diagram(s)

sequenceDiagram
  participant PreflightRunner
  participant ModelIdentityConfig
  participant ModelIdentity
  participant PreflightReport
  PreflightRunner->>ModelIdentityConfig: Parse SCOUT_MODEL_IDENTITY_CONFIG
  ModelIdentityConfig-->>PreflightRunner: Validated identities and diversity policy
  PreflightRunner->>ModelIdentity: Resolve phase model identifiers
  ModelIdentity-->>PreflightRunner: Built-in or declared identities
  PreflightRunner->>ModelIdentity: Check family diversity with configured policy
  ModelIdentity-->>PreflightRunner: Diversity result
  PreflightRunner->>PreflightReport: Record identities, policy, families, and errors
Loading
🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 5 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Description check ✅ Passed The PR summary clearly describes the model-identity, routing, configuration, validation, diagnostics, and testing changes.
Title check ✅ Passed The title clearly summarizes the primary change: correcting preflight model-family identity handling across routed models.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 5 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/model-family-preflight

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Changes are scoped, well-tested, and improve correctness of preflight gating with only a minor wording nit in an error message.

Pull request overview

This PR fixes Scout’s preflight model-family gating by separating model identity (developer + family) from routing/transport (e.g., OpenRouter), preventing openrouter/ from being miscounted as a “family” and improving preflight diagnostics.

Changes:

  • Introduces a strict model-identity resolver (resolve_model_identity) that recognizes supported families across direct and openrouter/<vendor>/<slug> identifiers and fails closed on unknown/opaque aliases.
  • Updates run_preflight to compute model_families from resolved identities and to emit model_identities diagnostics, while preserving read-only DB behavior.
  • Adds focused tests covering identity resolution, “diversity counts families (not routes/versions)”, and preflight read-only + gating scenarios; documents the recognition boundaries.
File summaries
File Description
tests/test_model_identity.py New unit tests for identity resolution and family-diversity behavior.
tests/test_load_projects.py Extends preflight tests to assert identity gating and read-only DB behavior.
src/scout/scanning/runner.py Replaces prefix-splitting family inference with identity-based resolution + diagnostics in preflight.
src/scout/model_identity.py New identity resolver + diversity check used by preflight.
docs/configuration.md Documents preflight diversity semantics and supported identity recognition.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +93 to +97
return Err(ModelIdentityError(
"resolve_model_identity", model,
"unsupported route, malformed identifier, or opaque alias; "
"use a recognized direct or openrouter/<developer>/<model> identifier",
))
@cirsteve
cirsteve merged commit 2098506 into main Sep 5, 2026
3 checks passed
@cirsteve
cirsteve deleted the fix/model-family-preflight branch September 5, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants