Skip to content

feat(mcpx/model): provider-routing guarantee + typed profile exhaustion (#1925 slice) - #16611

Merged
developing-today-fleet[bot] merged 4 commits into
mainfrom
lane/1652g-1925-model-routing
Nov 28, 2026
Merged

developing-today-fleet[bot] merged 4 commits into
mainfrom
lane/1652g-1925-model-routing

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Slice of #1925 — the model-layer requirements of the settled script-generate contract (pkgs/mcpx/docs/script-generate.md §3 routing guarantee + §6 typed exhaustion), in pkgs/mcpx/internal/model only. Claim: #1925 (comment) (lane 1652-G).

What

  1. Provider-prefix routing guarantee (§3). OpenAIProvider.Generate stripped ANY provider prefix via ModelID(req.Model) and sent the bare id to its own endpoint — anthropic/claude-sonnet reaching the openai backend was silently sent to OpenAI. The contract forbids exactly this ("never merely strip a mismatching provider prefix and send the model to another provider's endpoint… an implementation requirement, not a claim that the current single-provider resolver already enforces it"). Now: a qualified id whose prefix names a different provider is refused with the new typed ErrWrongProvider before any request is built (a misrouted call spends nothing); a matching prefix or a bare id is served as before. configured() likewise stops stripping a mismatched model.default prefix into a default for the wrong endpoint — a mismatched default is no default, so a call naming no model reports ErrUnavailable instead of misrouting.
  2. Typed profile-exhaustion classification (§6). generateProfile flattened every exhausted chain into ErrUnavailable via string failures. Now the typed attempt failures are preserved: an expired overall deadline returns the deadline error (context.DeadlineExceeded), a chain that reached at least one provider returns that provider's last failure, and ErrUnavailable remains only when no configured backend could be attempted. HTTP 402 still stops the chain immediately (unchanged).

Tests (fake providers only — the contract's oracle)

  • TestOpenAIProviderRefusesMismatchedProviderPrefix — mismatched prefix refused with ErrWrongProvider, fake server sees 0 hits; matching/bare/case-insensitive ids served.
  • TestResolveMismatchedDefaultModelIsNotStripped — mismatched default → ErrUnavailable, 0 endpoint hits.
  • TestProfileExhaustionPreservesProviderFailure — attempted chain failing with HTTP 500 returns the 500 failure, not ErrUnavailable.
  • TestProfileExhaustionDeadlineIsTimeout — overall deadline expiry wraps context.DeadlineExceeded, not ErrUnavailable.

Local pre-check (package assembled from main + this branch's files): go vet clean, full internal/model suite green including all pre-existing tests. Verification of record: repo CI on this branch.

Not in scope: the daemon handler, client transport, codegen globals, or the script surface itself — #1925 stays open as the tracker for those.

Refs #1925.

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-28T23:21:21Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": null,
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": null,
    "auth_subject": "archer",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

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

@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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: e085bfa0-0b50-4414-a4ea-6460bfd8f6f4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

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.

0 participants