feat(models): presets with a ladder — a run goes to the first route with quota left #50
Closed
gabrielvidal
wants to merge 0 commits from
model-router into main
pull from: model-router
merge into: gabrielvidal:main
gabrielvidal:main
gabrielvidal:fresh-context-plugin
gabrielvidal:remove-hooks-page
gabrielvidal:palette-plugins
gabrielvidal:linear-projects
gabrielvidal:agent-messaging
gabrielvidal:conv-card-layout
gabrielvidal:ask-more-options
gabrielvidal:agent-limits
gabrielvidal:generic-ui-strings
gabrielvidal:android-push-bridge
gabrielvidal:auto-translate
gabrielvidal:filter-chips
gabrielvidal:plugin-catalog
gabrielvidal:file-viewers
gabrielvidal:plugins-page-rework
gabrielvidal:hub-mcp-plugin
gabrielvidal:translation-plugin
gabrielvidal:scheduled-doors
gabrielvidal:cron-jobs-plugin
gabrielvidal:context-skills-plugin
gabrielvidal:files-plugins
gabrielvidal:worker-names
gabrielvidal:details-panel-perf
gabrielvidal:services-plugin-only
gabrielvidal:fix-test-env-leaks
gabrielvidal:bg-shells-plugin
gabrielvidal:feat-commits-plugins
gabrielvidal:fix-branch-line-tag-rows
gabrielvidal:retire-dead-leftovers
gabrielvidal:runner-into-harness-pi
gabrielvidal:retire-tool-proxy
gabrielvidal:new-project-policy-plugin-only
gabrielvidal:guest-jobs-sonnet
gabrielvidal:push-buttons-everywhere
gabrielvidal:mail-send-plugin
gabrielvidal:ui-polish-batch
gabrielvidal:command-palette-plugin
gabrielvidal:keyboard-shortcuts-plugin
gabrielvidal:prompt-shortcuts-plugin
gabrielvidal:matomo-site-grants
gabrielvidal:lab-chrome-plugin
gabrielvidal:performance-plugin
gabrielvidal:whats-new-plugin
gabrielvidal:skills-agents-plugin
gabrielvidal:goals-plugin-only
gabrielvidal:storage-server-side
gabrielvidal:plugin-scheduled-conversations
gabrielvidal:plugin-fences
gabrielvidal:handoff-plugin
gabrielvidal:plugin-commands
gabrielvidal:plugin-speed
gabrielvidal:cleanup-provider-harness
gabrielvidal:plugin-conversation-labels
gabrielvidal:plugin-plan-usage
gabrielvidal:fix-worker-harness-sync
gabrielvidal:plugin-gcloud-reauth
gabrielvidal:feat/plugin-cards-in-thread
gabrielvidal:feat/plugin-proxy-wake
gabrielvidal:unify-subagents-children
gabrielvidal:wave3d-frontend-typed-plugins
gabrielvidal:wave3c-sidecar-strict-plugins
gabrielvidal:wave3a-catalog-accounts-profiles
gabrielvidal:wave3b-pricing-usage-cutover
gabrielvidal:wave1a-typed-plugins
gabrielvidal:wave1b-sidecar-runtime
gabrielvidal:fix-ios-overlay-scroll
gabrielvidal:batch2-work-resources-core
gabrielvidal:batch2-apikeys
gabrielvidal:plugin-blue-green-deploy
gabrielvidal:plugin-ship
gabrielvidal:plugin-project-env
gabrielvidal:plugin-memories
gabrielvidal:plugin-activity
gabrielvidal:plugin-templates
gabrielvidal:plugin-desk-phone
gabrielvidal:batch1-platform
gabrielvidal:plugins-list-view
gabrielvidal:dash-plugins
gabrielvidal:pets-plugin
gabrielvidal:ha-push-channel
gabrielvidal:mail-agents
gabrielvidal:graph-fix
gabrielvidal:graph-plugin
gabrielvidal:services-plugin
gabrielvidal:left-to-do-plugin
gabrielvidal:plugins-gallery
gabrielvidal:home-conv-menu
gabrielvidal:meta-business
gabrielvidal:agy-rdrand
gabrielvidal:bg-lag
gabrielvidal:conv-load-perf
gabrielvidal:askform-instant
gabrielvidal:fix/drawer-menu-done-chip
gabrielvidal:pi-midrun-compaction
gabrielvidal:interrupt-menu-btn
gabrielvidal:authz
gabrielvidal:inkling
gabrielvidal:repo-plugins
gabrielvidal:work-sync
gabrielvidal:leftovers
gabrielvidal:fix/agy-guest-guard
gabrielvidal:feat/model-presets
gabrielvidal:scroll-back
gabrielvidal:feedback-bell
gabrielvidal:feat/movies-tool
gabrielvidal:feat/running-thread-padding
gabrielvidal:feat/drawer-filter-button-card-chat
gabrielvidal:burn-rate
gabrielvidal:guest-install
gabrielvidal:guest-usage
gabrielvidal:guest-palette
gabrielvidal:guest-form-links
gabrielvidal:form-open-buttons
gabrielvidal:clarifier-lean
gabrielvidal:auto-archive
gabrielvidal:guests-profile
gabrielvidal:conv-motion
gabrielvidal:share-target
gabrielvidal:terminal-sync
gabrielvidal:work-context-past
gabrielvidal:work-context-brief
gabrielvidal:enroll-codes
gabrielvidal:open-image-file
gabrielvidal:worker-uploads
gabrielvidal:conv-drawer-search
gabrielvidal:stack-motion-v3
gabrielvidal:notif-stack-fixes
gabrielvidal:home-motion
gabrielvidal:i18n-fr
gabrielvidal:local-electricity-cost
gabrielvidal:cache-pill-thread
gabrielvidal:cache-scenarios
gabrielvidal:fresh-start
gabrielvidal:msg-select
gabrielvidal:shortcuts-setup
gabrielvidal:ui-0-40-3
gabrielvidal:outbox-landing
gabrielvidal:resume-scope
gabrielvidal:conv-filter-range
gabrielvidal:fix-subagent-form-session
gabrielvidal:ask-form-integration
gabrielvidal:form-visual-options
gabrielvidal:watcher-perf
gabrielvidal:last-msg-summary
gabrielvidal:secret-fields
gabrielvidal:commit-review
gabrielvidal:summary-mode-fixes
gabrielvidal:service-tag-parser
gabrielvidal:clarifier
gabrielvidal:fetch-diet-2
gabrielvidal:fetch-diet
gabrielvidal:conv-look
gabrielvidal:pwa-links
gabrielvidal:tool-widgets
gabrielvidal:worker-autoupdate
gabrielvidal:usage-rings
gabrielvidal:opencode-harness
gabrielvidal:notif-diet
gabrielvidal:conv-resources
gabrielvidal:scheduled-tasks
gabrielvidal:profiles
gabrielvidal:notify-exact-cost
gabrielvidal:usage-measuring
gabrielvidal:guest-projects
gabrielvidal:usage-calibration
gabrielvidal:account-switch
gabrielvidal:multiuser-improve
gabrielvidal:form-groups
gabrielvidal:multiuser
gabrielvidal:motion-reel
gabrielvidal:dashboards-fixes
gabrielvidal:split-big-files
gabrielvidal:held-regex
gabrielvidal:subagent-interrupts
gabrielvidal:form-html
gabrielvidal:tokunia-video
gabrielvidal:settings-uniform
gabrielvidal:worker-ask-fix
gabrielvidal:worker-generic-mac
gabrielvidal:runner-shortcuts
gabrielvidal:notify-unify
gabrielvidal:perf-list-cache
gabrielvidal:mac-worker
gabrielvidal:model-switch
gabrielvidal:pipeline-paths
gabrielvidal:multi-account
gabrielvidal:feature-flags
gabrielvidal:qwen38-support
gabrielvidal:url-prompt
gabrielvidal:running-pages
gabrielvidal:homelab-tag
gabrielvidal:root-project
gabrielvidal:or-models
gabrielvidal:deploying-loader
gabrielvidal:worktree-diff
gabrielvidal:conv-tags
gabrielvidal:tags-page
gabrielvidal:agents-page
gabrielvidal:icon-picker-shortcuts
gabrielvidal:conv-cta
gabrielvidal:stamp-refine
gabrielvidal:post-task-cache
gabrielvidal:post-tidy-completed
gabrielvidal:form-badge
gabrielvidal:hooks-delay-seconds
gabrielvidal:cost-dashboard
gabrielvidal:plan-forms
gabrielvidal:form-mobile
gabrielvidal:guidelines-dag
gabrielvidal:skills-view
gabrielvidal:navbar-hold
gabrielvidal:spawnbox-status
gabrielvidal:hold-editable-expand
gabrielvidal:drawer-transparent
gabrielvidal:hold-fix
gabrielvidal:hold-editable
gabrielvidal:charroll-bump
No Reviewers
Labels
No items
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Assignees
gabrielvidal (Gabriel Vidal)
Clear assignees
No Assignees
gabrielvidal
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gabrielvidal/ai-agent#50
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
A preset is a named ladder of routes (a model, a harness and an effort each). A run sent on one goes to the first route with quota left for its profile's login, and a follow-up steps down when its route fills, so every run still gets done, sometimes on a lesser model. This is the core half of the design approved on 2026-11-29 (mockups A–E): the store and resolver, the send path, the run queue's quota hold, the subagent model, the API, and the UI in Settings → Models, the composer and the conversation page.
Merge together with ai-agent-plugins#44 (provider-google 1.1.0, provider-anthropic 1.1.0, harness-agy 1.2.0, hub-mcp 1.2.0, cron-jobs 1.1.0). Core works without it, but the Antigravity Claude / GPT-OSS routes read "not in the catalogue" and the Google plan's two quota groups aren't told apart until it lands.
Nothing is deployed from the EVOX2: deploy from the Homelab after review, the host sidecar before the backend (
subagentModelis a new launch field; an older sidecar ignores it, so the order only matters for the subagent switch to take effect).Key changes
backend/models/ladders.py(new):LadderStore(/data/model-ladders.json, seeded with Best / Everyday / Background / Free and their defaults, all editable and deletable), a route's status against the usage readings,resolve,step_for_turn,subagent_model, the API views.backend/runs/service.py:preset:<id>is resolved beforeroute_new_runin the new-run branch; a new owner run that names no model, harness or account gets its source's default preset; a continue of a routed conversation steps down on the same harness and login; every owner Claude launch (spawn, resume, fork) carriessubagentModel.backend/runs/queue.py: a second reason to wait,hold(a preset set to wait whose routes are all full), replayed at the earliest reset.sidecar/launch.py,routes_runs.py,fork.py:subagentModel→CLAUDE_CODE_SUBAGENT_MODEL,CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1,CLAUDE_CODE_WORKFLOW_SUBAGENT_MODEL.backend/plugins/typed_manifest.py,providers.py: the optional provider keyquotaWindows; a Claude id another vendor serves folds into the family key (Opus is one model on two harnesses);context_windowno longer takes Antigravity's entry for Claude Code's model.backend/models/routes.py:GET/POST /api/model-ladders,PUT/DELETE /api/model-ladders/{id},PUT /api/model-ladders/defaults(owner; authz rows + golden matrix);laddersin/api/modelsand themodels.readbridge;hub/runs/resolveanswers where a preset lands.cli/ai_agent.py:--model preset:<id>;ai-agent modelslists the presets.lib/ladders.tsx,business/models/components/Presets.tsx(A and D),business/models/pages/Preset.tsx(B),ModelPicker+SpawnComposer(C),PresetBadge,RoutingCard.tsxand the step-down divider (E), two visibility switches, the mock backend, i18n keys, a telemetry event.backend/conversations/cards.py: cards now carryroute/routeSteps/preset, andqueued, which the agent-limits badge read but the card never sent.Key decisions
preset:<id>can refuse a send.preset:<id>on a continue re-attaches it.Deviations from the mockups
Left / known gaps
preset:<id>).Changelog
ai-agent new --model preset:<id>Test notes
test_model_ladders.py(43 tests: the manifest key, keys and vendors, windows, room / full / missing data, resolution andwhenFull, the store and defaults by source, a new run on a preset and on a default, the quota hold and its replay, follow-up step-down, the subagent model and the sidecar env, the routes). Every backend module run one sandbox each: all pass excepttest_typed_plugins::test_records_carry_kind, which fails the same way on main. Sidecar suite: the same 9 failures as main (test_host_only_routesand friends); CLI suite passes.tscclean; vitest 1165 pass.FreshContext(CacheExpiredNotice) fails as on main;reachabilityfailed once under the full run's load and passes alone, here and on main.preset:best→ agyclaude-opus-5-5on google-personal; no model from a browser → the composer's default (same route);preset:background→ agygpt-oss-120b; a plainopuson Claude Code → unchanged, withsubagentModel.haiku: the main turn ran onclaude-fable-5-2, its subagent onclaude-haiku-5-5($0.38 at list price).Screenshots
Merged into
mainas7b1ad56349by the auto-ship batch https://ai-agent.lab.gabvdl.xyz/conversation/6dc229d3-ba8d-4b73-8ef7-dcb3135fdd68.Pull request closed