Skip to content

Fix model picker alias/provider scoped options#75267

Closed
fancymatt wants to merge 1 commit into
openclaw:mainfrom
fancymatt:feature/ai-594-model-picker-validity
Closed

Fix model picker alias/provider scoped options#75267
fancymatt wants to merge 1 commit into
openclaw:mainfrom
fancymatt:feature/ai-594-model-picker-validity

Conversation

@fancymatt

Copy link
Copy Markdown

Summary

  • Hide current configured model supplements when they do not match the preferred provider scope
  • Fall back select initialValue to an actually displayed option so provider-scoped pickers cannot return hidden alias/provider pairs
  • Add regression coverage for Claude aliases leaking into OpenAI-scoped pickers and allowlist option validity

Tests

  • node scripts/test-projects.mjs src/commands/model-picker.test.ts
  • pnpm check:test-types

Linear: AI-594

Copilot AI review requested due to automatic review settings April 30, 2026 21:18
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S labels Apr 30, 2026
@clawsweeper

clawsweeper Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep open. The underlying provider-scoped model-picker bug still exists on current main and this PR is useful, but it is not merge-ready because the branch conflicts with main, lacks real behavior proof, and the proposed fix introduces source-visible edge cases around fallback scoping and invalid initial selection.

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

Do we have a high-confidence way to reproduce the issue?

Yes, by source inspection. Current main filters to the preferred provider only when matching rows exist, but then still appends the configured model supplement unconditionally when it was not seen.

Is this the best way to solve the issue?

No, not as currently written. The fix belongs in promptDefaultModel, but it should preserve the existing fallback-unscoped behavior and avoid action or empty-list initial fallbacks before it is the best solution.

Security review:

Security review cleared: The diff only changes TypeScript model-picker logic and tests; no dependency, workflow, secret, permission, package, or code-download surface was introduced.

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-04-30T21:18:55Z, is older than 30 days, and the latest review rated it F.
  • proof blocker: real behavior proof is missing and proof tier is F, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • Luckymingxuan: The provider-filter fallback and matcher commits define the hasPreferredProvider invariant that this PR needs to preserve. (role: preferred-provider filtering contributor; confidence: high; commits: 792558de01e0, 360fdaa4f29c, c4a903319e67; files: src/flows/model-picker.ts)
  • steipete: Moved the model picker into src/flows/model-picker.ts and made several provider/auth picker refactors in the same module. (role: model picker flow refactor and adjacent owner; confidence: high; commits: 4629ab3d8af5, 0c5e6037b03e, fc50e23262a8; files: src/flows/model-picker.ts, src/commands/model-picker.test.ts)
  • vincentkoc: Recent model-picker/test history and current release snapshot include this file area, making this a reasonable routing candidate for stale-main integration questions. (role: recent adjacent contributor; confidence: medium; commits: 4c4eea97e98c, 8c802aa68351; files: src/flows/model-picker.ts, src/commands/model-picker.test.ts)

Codex review notes: model internal, reasoning high; reviewed against 66880a5d736c.

Copilot AI 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.

Pull request overview

This PR tightens provider-scoped model picker behavior so that hidden/invalid alias+provider pairs can’t be returned as the default selection, and adds regression tests around provider scoping and allowlist option validity.

Changes:

  • Hide the “current (not in catalog)” configured model supplement when it doesn’t match the preferred provider scope.
  • Ensure initialValue always points at a displayed option (fallback to a visible entry).
  • Add regression coverage for cross-provider alias leakage and allowlist option validation in provider-scoped pickers.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/flows/model-picker.ts Adjusts option/supplement visibility and clamps initialValue to displayed options for provider-scoped default model selection.
src/commands/model-picker.test.ts Adds regression tests for provider-scoped default picker and allowlist picker behavior.

Comment thread src/flows/model-picker.ts
Comment on lines +801 to +811
if (
configuredKey &&
!seen.has(configuredKey) &&
(!preferredProvider || matchesPreferredProvider?.(resolved.provider))
) {
options.push({
value: configuredKey,
label: configuredLabel,
hint: "current (not in catalog)",
});
seen.add(configuredKey);

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

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

The configured “current (not in catalog)” supplement is now hidden whenever preferredProvider is set and the current resolved provider doesn’t match. This can also hide the supplement in cases where the picker isn’t actually scoped (i.e. hasPreferredProvider is false because no catalog entries match the preferred provider), which makes the current configured model unselectable when it’s not in the catalog (especially when allowKeep: false). Consider gating this hiding behavior on hasPreferredProvider (only enforce scope when there are in-scope options to pick).

Copilot uses AI. Check for mistakes.
Comment thread src/flows/model-picker.ts
Comment on lines +827 to +829
if (initialValue && !optionValues.has(initialValue)) {
initialValue = options[0]?.value;
}

Copilot AI Apr 30, 2026

Copy link

Choose a reason for hiding this comment

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

initialValue fallback currently uses options[0]?.value when the computed initialValue isn’t displayed. Since action options (e.g. “Enter model manually” / provider setup entries / “Keep current”) are prepended before model rows, this can default the selection to a non-model action even when model options exist later. Also, with provider-scoped hiding of the configured supplement plus auth-filtering, it’s possible for options to be empty here, which will pass an empty options list into the Clack select/autocomplete prompt (likely throwing). Suggestion: if initialValue is invalid, prefer the first model option (e.g. a value that parses via splitModelKey), and if there are no options at all, fall back to promptManualModel (or otherwise avoid calling prompter.select with options.length === 0).

Suggested change
if (initialValue && !optionValues.has(initialValue)) {
initialValue = options[0]?.value;
}
const firstModelOptionValue = options.find((option) => seen.has(option.value))?.value;
if (initialValue && !optionValues.has(initialValue)) {
initialValue = firstModelOptionValue;
}
if (options.length === 0) {
return promptManualModel({
prompter: params.prompter,
allowBlank: false,
initialValue: configuredRaw || resolvedKey || undefined,
});
}

Copilot uses AI. Check for mistakes.
@barnacle-openclaw

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@barnacle-openclaw barnacle-openclaw Bot added the stale Marked as stale due to inactivity label May 30, 2026
@clawsweeper clawsweeper Bot added the rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. label May 30, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. and removed stale Marked as stale due to inactivity labels May 31, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 14, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 14, 2026
@clawsweeper

clawsweeper Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants