Skip to content

fix(models): follow the recorded CodeBuddy configuration home - #1373

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
nateEc:fix/1221-codebuddy-relocated-models
Oct 25, 2026
Merged

jeff-r2026 merged 1 commit into
Tencent:mainfrom
nateEc:fix/1221-codebuddy-relocated-models

Conversation

@nateEc

@nateEc nateEc commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

teamai models switch --agent codebuddy always writes ~/.codebuddy/models.json, even when CodeBuddy's configuration home has moved. The command can report a successful switch while leaving the active catalog unchanged.

Resolve CodeBuddy's model catalog through toolHome('codebuddy'), matching recorded-home precedence and the existing resource paths. Reuse the ownership/restore path guard: personal models survive, an active configuration is not transplanted into a different home, and restoring works after selecting the original home again. Update the descriptor note and bilingual model reference.

Refs #1221 (B4 / model settings in moved homes). The independent hook path fix is #1371.

Validation:

  • Before the fix: all 3 new regressions failed for the directory behavior.
  • npx vitest run src/__tests__/codebuddy-relocated-models.test.ts src/__tests__/model-switch.test.ts — 81 passed. Covers environment and recorded homes, preservation of the default file and personal models, path-change refusal and restore.
  • npx tsc --noEmit, npm run lint, npm run build — passed.
  • Real built CLI: npx vitest run --config vitest.e2e.config.ts src/__tests__/e2e/codebuddy-relocated-models.test.ts — 2 passed. Both environment-selected and recorded-without-environment homes survive add → switch → restore; the inactive default catalog is never created.

Tool-side contracts: configuration/data environment override and models.json. No model endpoint or live CodeBuddy session was used.

- 使用统一 toolHome 解析 CodeBuddy models.json,使环境变量与机器记录的优先级和其他资源一致,避免模型配置写入无人读取的默认目录。
- 沿用模型所有权与还原机制,保留个人模型和默认目录文件;活动配置移动后拒绝迁移写入,恢复原目录记录后可安全还原。
- 补充环境变量与无变量记录的切换、还原、目录变更回归以及两个真实 CLI 场景;修复前 3 个目录用例失败。
- 81 个模型单测、两个真实 CLI 切换还原用例、构建、类型检查与 lint 通过,更新中英模型配置说明。
@github-actions

Copy link
Copy Markdown

No findings in the scoped PR diff.

The PR description includes sufficient testing: a built-CLI add → switch → restore record for both environment-selected and recorded CodeBuddy homes. This satisfies the real-CLI verification requirement.

Review was read-only; I did not run, build, or install PR code.

@jeff-r2026 jeff-r2026 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.

Reviewed and verified on latest main (f3cd042) stacked with the other PRs in this batch: tsc / lint / build pass, related unit and E2E tests pass.

@jeff-r2026
jeff-r2026 merged commit 8d13bc3 into Tencent:main Oct 25, 2026
18 checks passed
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
- 使用统一 toolHome 解析 CodeBuddy models.json,使环境变量与机器记录的优先级和其他资源一致,避免模型配置写入无人读取的默认目录。
- 沿用模型所有权与还原机制,保留个人模型和默认目录文件;活动配置移动后拒绝迁移写入,恢复原目录记录后可安全还原。
- 补充环境变量与无变量记录的切换、还原、目录变更回归以及两个真实 CLI 场景;修复前 3 个目录用例失败。
- 81 个模型单测、两个真实 CLI 切换还原用例、构建、类型检查与 lint 通过,更新中英模型配置说明。
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.

2 participants