Skip to content

fix(web): pick an agent's models from its strategy's catalog - #2510

Merged
zfy0701 merged 2 commits into
mainfrom
claude/vm-strategy-model-picker
Sep 25, 2026
Merged

zfy0701 merged 2 commits into
mainfrom
claude/vm-strategy-model-picker

Conversation

@zfy0701

@zfy0701 zfy0701 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The agent model picker (RuntimeModelSelect) and the Decision rule editor (decisions/ModelSelectionField) build their options from each runtime's runtimeModels[].models. That is the host probe's list, whatever strategy the agent runs in. The daemon checks a target against the entry for the session's strategy, so a VM agent was configured, and its rules validated, against the host install's catalog.

Change

  • strategyModelSource(daemon, strategy) in lib/execution-strategy.ts takes each runtime's models from its strategies[strategy] entry. The runtime list, versions and warnings stay as reported. An older daemon that reports no entries keeps its single list, and no strategy (a pool agent) leaves everything as reported.
  • Fed to every place an agent's model is picked:
    • agent create and edit forms: the Fixed picker, each By decision rule and the fallback, their validity check, and the preselected model;
    • the home composer;
    • the session composer before the session's first turn (after it, the session's own live list already wins).
  • host and srt read the host install's list; microsandbox reads the VM entry's.
  • Changing only an existing agent's strategy:
    • If the new catalog lacks the stored model, Save persists the model the picker shows in its place. An empty catalog keeps the stored model, since the daemon's check is permissive then.
    • The change also validates the By decision rules, so a rule naming a model the new strategy does not offer holds Save.
  • No new display, per the decision on this change. With the daemon change in feat(daemon): probe the VM image's models in the background and carry them across upgrades #2508, a VM entry carries the previous image's list as cached across an upgrade and the background probe refreshes it, so the lists are present.

Docs: §10 of session-executors.md and the picker description in decisions.md.

This PR does not depend on #2508 and leaves main working on its own. Without #2508, a VM agent sees the VM entry's list, which is empty until a VM session runs.

Verification

  • lib/execution-strategy.test.ts covers:
    • each strategy's list, with every runtime still listed;
    • an unprobed VM entry offering nothing rather than the host list;
    • an older daemon's single list and the pool left as reported.
  • ModelSelectionField.test.tsx covers the same agent and Decision under host and microsandbox. The fallback picker offers only that strategy's models, and a rule naming the host install's model is invalid for the VM agent.
  • EditAgentModal.strategy.test.tsx switches a saved host agent to the VM:
    • a stored host model is saved as the image's model;
    • a Decision rule naming a host-only model holds Save.
    • Both cases fail against the form before this fix.
  • Ran with --maxWorkers=2: those files plus RuntimeModelSelect, HomeView, every SessionDetailView.*, DaemonDetailView.runtimes, AgentDetailView.placement and ExecutionStrategyField (206 tests, all passing). Web tsc --noEmit and eslint on the changed files also pass.
  • No visual change: no styles, layout or mobile branches are touched. The console's mock data carries no per-strategy entries, so a preview would look the same before and after; the component tests are the evidence.

🤖 Generated with Claude Code . Claude Opus 5.5

The agent model picker and the Decision rule editor read each runtime's
runtime-level model list, which is the host probe's, whatever strategy the
agent runs in, while the daemon checks a target against the entry for the
session's strategy. A VM agent was configured from the host install's
catalog.

Add `strategyModelSource`, which takes each runtime's models from its entry
for a strategy and keeps an older daemon's single list, and feed it to the
agent create and edit forms (Fixed picker, By decision rules and fallback,
and their validity), the home composer, and the session composer before the
session's first turn. Host and srt read the host install's list, a VM the
image's; a pool agent's list stays as reported. No new display.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zfy0701
zfy0701 enabled auto-merge (squash) September 25, 2026 13:03

@agentconnect-md-test agentconnect-md-test Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changing an existing agent from host to microsandbox can save a model configuration that the strategy-aware picker does not show. The Fixed model stays at its old stored ID, and By decision rules can become invalid without blocking Save. Please make strategy changes reconcile the persisted Fixed model and revalidate decision targets before saving.

sent by review-bot (Codex · gpt-6-sol) · open in session

Comment thread packages/web/src/components/console/modals/EditAgentModal.tsx
Comment thread packages/web/src/components/console/modals/EditAgentModal.tsx
Changing an existing agent's strategy alone left a stored model the new
strategy's catalog does not offer, and skipped validating By decision rules.
Save now keeps the model the picker shows in place of a stored one the new
catalog lacks (an empty catalog keeps the stored model, as the daemon's
check is permissive then), and a strategy change validates the rules, so a
rule naming a model the new strategy does not offer holds Save.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@agentconnect-md-test agentconnect-md-test Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new revision addresses both findings from my previous review. Switching an existing Fixed agent to a strategy with a different advertised model now persists the model shown by the picker, and changing strategy now activates the validity gate for By decision rules. The added component tests cover both save paths; static review and git diff --check passed. I could not run the focused test locally because dependencies were absent in this checkout.

sent by review-bot (Codex · gpt-6-sol) · open in session

@zfy0701
zfy0701 merged commit c0afb5b into main Sep 25, 2026
14 checks passed
@zfy0701
zfy0701 deleted the claude/vm-strategy-model-picker branch September 25, 2026 13:25
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