Skip to content

Model routing: settings default, quota failover chain, evidence-based pool routing #711

Closed

Description

@currentbits

Research findings (thread e4551617). There is no routing layer today: every provider/model decision is user pick, inheritance, lead-LLM alias pick, or registry-order contrast. The building blocks for a real router mostly exist.

Highest value

  1. Settings-level default provider/model. createThread hard-codes provider: "claude" (services.js:542); the renderer patches from the selected thread, but autodispatch (autodispatch.js:21-25) and issue-created threads always get claude. Fix: settings.defaultProvider/default model, thread through createThread.
  2. Cross-provider failover on quota exhaustion. quotaWait.js parks the same thread on the same provider; exhausted balance hard-fails; the header comment itself references "model failover (Automatic model failover mid-run #294)" as not-present. The two hard parts are already solved: setProvider clears sessionId for portability (services.js:1205) and snapPermissionMode (providers.js:110) handles mode portability. A per-thread ordered fallback chain on quota-fail is feasible with existing seams (runner.js:2381 markRunFailed).
  3. Filter worker pool by availability + re-route on start failure. The lead picks pool aliases by free-text description; resolveSubagentPool never checks the binary exists — failure only surfaces at assertProviderBinary (runner.js:465), and dispatchOrchCommand silently drops the failed worker (runner.js:5509-5519). Cheap wins: filter formatPoolMenu by isBinAvailable; re-route a start failure to the next pool entry.

Medium

  1. Join fleet evidence back into routing. Real per-run cost/outcome data is collected (fleet.js:419-424, usageByThread) but only feeds a report view. A cost-per-success-per-provider/model table per project would let fillProviders (orchcommands.js:108-126, currently registry-order contrast only) and pool auto-pick route on evidence instead of order.
  2. Context-pressure model escalation. modelInfo.contextTokens metadata and the live context ring signal are both in-process; nothing escalates to a 1M-window model when a thread outgrows its window. Natural first automatic router.
  3. Capability flag for interactivity. Only claude has the blocking permission channel; question cards die to machine turns on other CLIs (Question cards are erased by machine-delivered turns (grok/kimi hit it every time) #687). Any auto-router must weight "can prompt the user" (derivable from permissionModes) for interactive threads vs unattended workers — otherwise routing silently downgrades interactivity.

Low / noted

  1. Cursor's ~200-model list is hand-copied (providers.js:611-816), stale by construction.
  2. Generic provider (CODER_AGENT_CMD) bypasses the whole registry contract — relevant if arbitrary CLIs become route targets.

Files to touch: electron/providers.js (capability metadata), electron/services.js:542 (default), electron/quotaWait.js + runner.js:2381 (failover seam), electron/subagentPool.js (availability, auto-pick), electron/fleet.js/src/fleet.ts (evidence loop).

Activity

  1. added
    plan:todo
    plan:doing
    and removed
    plan:todo
    on Aug 25, 2026
  2. currentbits commented on Aug 27, 2026

    @currentbits
    OwnerAuthor

    Shipped the three highest-value items on this issue:

    1. Settings default provider/model — settings.defaultProvider / defaultModel. createThread uses them (so autodispatch and issue-created threads no longer hard-code Claude). The renderer still inherits from the selected thread when there is one.
    2. Quota failover chain — settings.quotaFailover (ordered provider ids). On a quota-like error, the thread switches to the next unused id in the chain and replays the same prompt. Empty chain preserves today's park-or-fail behaviour.
    3. Pool availability + start re-route — formatPoolMenu hides candidates whose CLI is not installed. A worker that fails with "Provider binary not found" retries the next pool entry.

    Not in this pass (still open on the issue): fleet evidence routing, context-pressure escalation, interactivity capability weighting, Cursor catalogue freshness, generic-provider contract.

    Settings UI: Threads pane.

  3. added
    plan:done
    and removed
    plan:doing
    on Aug 27, 2026
  4. currentbits commented on Aug 27, 2026

    @currentbits
    OwnerAuthor

    Landed from Solenta thread "Fork: Model routing: settings default, quota failover chain,". Closed on merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    plan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions