Skip to content

fix(setup): restore sibling built-in entries when re-running setup wizard#4673

Merged
SivanCola merged 1 commit into
esengine:main-v2from
I-personal-account:fix/setup-model-selection-regression
Jun 17, 2026
Merged

fix(setup): restore sibling built-in entries when re-running setup wizard#4673
SivanCola merged 1 commit into
esengine:main-v2from
I-personal-account:fix/setup-model-selection-regression

Conversation

@I-personal-account

Copy link
Copy Markdown

Bug Description

After selecting a DeepSeek model using reasonix setup (e.g., selecting only deepseek-v4-flash),
running reasonix setup again causes the model selection list to display only the previously selected model;
other available models (such as deepseek-v4-pro) are not visible.

Root Cause

withBuiltinFamiliesForLanguage performs deduplication based on the family key: since the user already has deepseek-flash
(which belongs to the deepseek family), the entire family is considered "already present." Consequently, the built-in deepseek-pro
entry is not added, leaving the static model fallback list containing only the single previously selected model.

Fix

Change the deduplication logic from by family key to by entry name:

  • Existing user entries with the same name (e.g., a custom deepseek-flash) remain unchanged.
  • Missing built-in entries (e.g., deepseek-pro) are automatically added.

This ensures familyStaticModels returns the complete list of models.

Testing

  • Added a new regression test: TestWithBuiltinFamiliesRestoresSiblingEntries
  • Existing test behavior remains unchanged.

Bug 描述

使用 reasonix setup 选择了一个 DeepSeek 模型后(如只选了 deepseek-v4-flash),
再次运行 reasonix setup 时,模型选择列表只显示之前选过的模型,
无法看到其他可选模型(如 deepseek-v4-pro)。

根因

withBuiltinFamiliesForLanguagefamily key 去重:用户已有 deepseek-flash
(属于 deepseek family),整个 family 被认为"已存在",导致内置的 deepseek-pro
条目不会被补充,模型静态回退列表只有之前选过的一个模型。

修复

将去重逻辑从 按 family key 改为 按 entry name

  • 用户已有的同名条目(如自定义的 deepseek-flash)保持不变
  • 缺失的内置条目(如 deepseek-pro)会被自动补充

这样 familyStaticModels 就能返回完整的模型列表。

测试

  • 新增回归测试 TestWithBuiltinFamiliesRestoresSiblingEntries
  • 现有测试行为不变

…zard

withBuiltinFamiliesForLanguage previously deduplicated by family key,
so a user who had only deepseek-flash (with model deepseek-v4-flash)
in their config caused the entire deepseek family to be considered
'already present'. The sibling deepseek-pro entry was never appended,
making deepseek-v4-pro invisible in the model picker on re-run.

Change deduplication from family-key level to entry-name level so that
all built-in entries within an existing family are appended when missing,
while user-customized entries (same exact name) are preserved as-is.

Add regression test TestWithBuiltinFamiliesRestoresSiblingEntries.

@SivanCola SivanCola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved. This is a well-scoped fix. The PR corrects setup re-run model selection by changing built-in family supplementation from family-key dedupe to exact provider-name dedupe, so a saved deepseek-flash entry no longer hides deepseek-pro. Existing same-name user entries remain preserved, and buildFamilyEntries continues to keep per-SKU pricing/metadata after selection.

Reviewed:

  • Baseline: latest main-v2 and PR head diff; mergeability is clean.
  • Related PRs: #4518 touches the same file in chatREPL only; no conflict with setup provider logic.
  • Security/cache: no new I/O, network calls, dependencies, prompt/tool schema changes, or provider request serialization changes.
  • Tests: go test ./internal/cli -count=1 -run 'TestWithBuiltinFamilies'; go test ./internal/config -count=1 -run 'TestBackfillDeepSeekPro|TestNormalizeLegacyProviderModels|TestResetOfficialProviderPricingOnUpgradeRunsOnce'; git diff --check origin/main-v2...origin/pr/4673; CI is green.

@SivanCola SivanCola merged commit f944dfb into esengine:main-v2 Jun 17, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants