Skip to content

mcpx: provider-keyed model settings and model profiles (#1925 slice 2) - #4836

Merged
dezren39 merged 1 commit into
mainfrom
queue/6913-1925-profiles-fallback
Nov 3, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/6913-1925-profiles-fallback

Conversation

@dezren39

@dezren39 dezren39 commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

What

Slice 2 of #1925: provider-keyed model settings and named model profiles with ordered cross-provider fallback, per the 2026-11-03 owner ruling on #1925.

Changes

  • model.providers (new, internal/settings/model.go): JSON object keyed by provider name with per-provider baseURL and apiKeyEnv. Falls back to the singular model.baseURL/model.apiKeyEnv for the provider named by model.provider, so single-provider configurations keep working unchanged.
  • model.profiles (new): JSON object of named ordered provider/model chains, each optionally bounded by a profile budget and per-attempt timeout.
  • internal/model: Config gains the two settings payloads; Resolve returns a router when either is configured. Resolution accepts a profile name or a provider/model id from model.default or a per-operation override, tries profile entries in order, skips unconfigured providers and unset explicitly-named key variables, and fails with ErrUnavailable (no fabricated output) when the whole chain is exhausted.
  • No environment scanning: a key is read only from a variable the user names in model.apiKeyEnv or a provider-keyed entry.
  • internal/daemon: policy carries both settings; the model layer activates for profile-only configurations; the answering provider is reported in the used label.
  • Docs: docs/configuration.md prose, docs/consumer.md, and the generated settings inventory.

Tests

New in internal/model:

  • ordered cross-provider fallback with provider-keyed routing, keys and profile budget observed on both endpoints
  • unavailable-entry skip and whole-chain clean failure
  • unset explicit key variable skips to the configured fallback without touching other variables
  • invalid model.providers/model.profiles JSON rejected

New in internal/settings: registry presence, kind/default/scope, and that the singular model.* settings are unchanged.

New in internal/daemon: generation through a named profile with model.provider: none.

Verification (laptop)

  • go test ./internal/model -count=1 — PASS (also -race -shuffle=on -count=5 on the resolver/profile tests)
  • go test ./internal/daemon -run 'TestGenerateModelLayer|TestGenerateUsesNamedProfile' -count=1 — PASS
  • go test ./internal/settings -run 'TestModelProfiles|TestEffectExemptionsOnlyShrink|TestTheDocumentationListsEverySetting' -count=1 — PASS
  • CI (go test in pkgs/mcpx) is the merge authority for the full suite.

Known pre-existing test gaps on main (not from this diff)

The full internal/settings package currently fails on main for reasons unrelated to this slice: the compendium manifest is missing three docs, the env-read/script-env setter guards disagree in internal/daemon and internal/execsvc, and the effect guard still lists five unclassified proto.*/script.* settings. This PR adds the model settings to the effect exemption ratchet (pin 193 → 201) because no settings-driven e2e probe exists for them yet.

Risk

Low. Additive settings; model.provider: none with nothing else configured keeps the deterministic path exactly as before.

Implements slice 2 of #1925 (task 6913). The parent issue remains open for the explicitly deferred plugin backend and sampling.answerLocally slices.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 3, 2026 09:55
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-03T09:55:19.931842Z
We couldn’t complete this review. Comment @codex review to try again.
8170d60 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4cc993aa-2b84-47fe-aa93-1875641f3f77
Commits

Reviewing files that changed from the base of the PR and between 4fc40be and 8170d60.

Files selected for processing: 10
  • pkgs/mcpx/docs/configuration.md
  • pkgs/mcpx/docs/consumer.md
  • pkgs/mcpx/internal/daemon/consumer.go
  • pkgs/mcpx/internal/daemon/model_layer_test.go
  • pkgs/mcpx/internal/daemon/routes_consumer.go
  • pkgs/mcpx/internal/model/model_test.go
  • pkgs/mcpx/internal/model/resolve.go
  • pkgs/mcpx/internal/settings/effect.go
  • pkgs/mcpx/internal/settings/model.go
  • pkgs/mcpx/internal/settings/model_profiles_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@dezren39

dezren39 commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

CI coverage note: fresh PR checks show only basic: production line limit (2500) (pass) plus CodeRabbit skipped. .github/ci-policy.md lists mcpx test (unit, lint, and e2e shards) in the PR tier, but .github/workflows/mcpx-test.yml declares only push and workflow_dispatch, with no pull_request trigger. I verified this workflow trigger directly; no mcpx-test run is being assumed here. Local targeted internal/model, daemon profile integration, and settings registry/docs tests passed. This is a pre-existing CI coverage gap, not a result of this change.

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.

1 participant