Repository navigation
feat(models): manage team and local model profiles - #675
Conversation
|
Findings
Testing
|
|
The model configuration file is somewhat difficult to work with. too many config item |
bfcc1fa to
60c88c3
Compare
|
Addressed all five automated P1 findings in the current single commit:
Validation: |
60c88c3 to
9c24ddf
Compare
|
Findings
The PR description includes a concrete test plan and real-CLI/end-to-end verification, so it satisfies the review requirement for testing notes. |
| 在团队仓库中创建 `models/models.yaml`: | ||
|
|
||
| ```yaml | ||
| version: 1 |
| protocol: anthropic | ||
| base_url: ${COMPANY_GATEWAY_URL} | ||
| api_key: ${API_KEY} | ||
| agents: |
There was a problem hiding this comment.
不用区分 agents , 统一下发所有 agents,先支持: claude , codex, codebuddy ,workbuddy, opencode
| profiles: | ||
| - id: company-anthropic | ||
| name: Company Anthropic gateway | ||
| inputs: |
There was a problem hiding this comment.
配置放到 teamai.yaml 顶层,参考 packages , 没有项目级,模型下发只有 user 级别。
models:
- name1
url
api key, 可从环境变量读取
protocol - name2 ....
|
|
This PR currently has merge conflicts with |
ee68ea0 to
fdd6ae5
Compare
|
Findings
Resolved Earlier Findings
The PR description includes a test plan and explicit real-CLI/end-to-end verification records, so the review-description testing requirement is satisfied. |
3767b9d to
aebac8d
Compare
|
Findings
Review Status
|
4f3233f to
e68acb3
Compare
|
Follow-up on the latest automated review: all six findings were reproducible against the previous revision and are addressed in e68acb3. Claude now distinguishes re-injected settings env from independent shell overrides, owns/restores server-delivered custom-model fields, and pauses local-agent model sync while an explicit profile is active. Codex quoted top-level keys and inline comments survive switch/restore. Project-scope uninstall leaves machine-global model state alone; user-scope model restoration gates MCP cleanup. Public docs and test fixtures no longer contain the internal gateway URL. Verification after rebase onto origin/main: npm run build, npx tsc --noEmit, 290 Vitest files (4317 passed, 1 skipped), and built-CLI isolated E2E for git/gitlab/github across Claude, Codex, OpenCode, CodeBuddy, and WorkBuddy, including Claude env injection and quoted Codex keys. No live gateway calls or real credentials were used in these tests. |
|
Findings
Review Status
|
|
Follow-up on the latest automated review: I reproduced all six findings against the previous revision and addressed them in 940b55b. Claude now skips an active Bedrock/Vertex/Foundry selection; explicit Buddy mappings prefer environment references; TeamAI local-agent-owned Buddy IDs can be replaced by an explicit switch; resolved URLs reject query/fragment injection; Codex provider edits preserve unrelated blank lines; and failed configure validation leaves models.yaml unchanged. Regression tests cover each case. Public documentation examples now use the officially documented DeepSeek models deepseek-flash and deepseek-v4-pro. DeepSeek uses a separate /anthropic base URL, so the shared-root example intentionally covers OpenAI-compatible agents and shows an explicit Claude mapping. Internal TokenHub model IDs and endpoints were removed from the current documentation and E2E examples. Verification: npm run build; npx tsc --noEmit; npx vitest run --silent --reporter=dot (290 files, 4329 passed, 1 skipped); node scripts/model-routes-e2e.mjs (git, gitlab, github, built CLI); git diff --check. All passed. The CLI E2E uses isolated temporary homes and does not touch real Agent settings. |
|
Findings
Review Status
|
|
Findings
Review Status
|
940b55b to
8f66b8a
Compare
|
Squashed into one commit (8f66b8a), rebased onto Simplification
Bugs fixed in this revision
Latest review findings
Known limits
Test report
No live gateway calls or real credentials were used. |
|
Findings
Resolved Earlier Findings
Review Status
|
8f66b8a to
2bf91cc
Compare
|
Follow-up on the latest automated review. I checked each finding against the code. Three were reproducible and are fixed in 2bf91cc, still a single commit, rebased onto Fixed
Each fix has a regression test, and the usage and design docs are updated in both languages. Not changed
Test report
|
|
Findings
Review Status
|
2bf91cc to
ef52d84
Compare
|
Follow-up on the latest automated review. ef52d84 is still a single commit on current Fixed: historical Buddy IDs during restoreReproduced: switch to model A, then to model B, then add your own model A. When a switch drops a model from the catalog, TeamAI now puts that ID's original entry and allowlist state back right away (or removes the entry if there was none) and stops tracking the ID. Restore only touches IDs TeamAI still writes, so a user entry that reuses a dropped ID is left alone. As a side effect, an entry owned by local-agent delivery comes back as soon as the catalog stops using its ID. Regression tests cover both cases for CodeBuddy and WorkBuddy. Not changed: symlink retargetingThe recorded path is lexical by design. For the reported scenario to do harm, the new target must hold exactly the fields TeamAI last wrote, including the token, so it is effectively a copy of the same config. The common real case is a dotfiles checkout that moved: the symlink now points at the user's same config, and continuing to manage it is expected. Pinning the resolved path would instead refuse to switch or restore there. Repeated findingsThe uninstall lock window, the local-agent check outside the lock, unlocked Test report
|
|
Findings
Resolved Earlier Findings
Review Status
|
Add `teamai models` to point Claude Code, Codex, OpenCode, CodeBuddy, and
WorkBuddy at a team or personal model gateway.
- A team publishes `models/models.yaml` (id, name, base_url, api_key
placeholder, model_groups by protocol); each member keeps the API key
locally or as an environment-variable reference.
- `models switch` updates every installed, compatible agent (or `--agent`),
asks for a missing key once, and accepts `--model` for the default.
- `teamai pull` re-applies the team's latest catalog to agents already
switched to it; agents never switched are left alone.
- TeamAI records the managed fields before its first switch, skips agents
whose managed fields changed outside TeamAI, and `models restore` puts
the originals back. Claude's `/model` pick is not treated as a takeover.
- Claude family aliases map to matching gateway models or the default;
Buddy entries use `${VAR}` key references; Codex edits are parsed and
verified before writing.
- Push rejects an invalid catalog; user-scope uninstall restores model
settings first.
ef52d84 to
dbc2166
Compare
|
Findings
Review Status
|
Add `teamai models` to point Claude Code, Codex, OpenCode, CodeBuddy, and
WorkBuddy at a team or personal model gateway.
- A team publishes `models/models.yaml` (id, name, base_url, api_key
placeholder, model_groups by protocol); each member keeps the API key
locally or as an environment-variable reference.
- `models switch` updates every installed, compatible agent (or `--agent`),
asks for a missing key once, and accepts `--model` for the default.
- `teamai pull` re-applies the team's latest catalog to agents already
switched to it; agents never switched are left alone.
- TeamAI records the managed fields before its first switch, skips agents
whose managed fields changed outside TeamAI, and `models restore` puts
the originals back. Claude's `/model` pick is not treated as a takeover.
- Claude family aliases map to matching gateway models or the default;
Buddy entries use `${VAR}` key references; Codex edits are parsed and
verified before writing.
- Push rejects an invalid catalog; user-scope uninstall restores model
settings first.
Summary
teamai modelscommands for local and team model profiles; applying a profile always requiresmodels switch.model_groups, so each model ID appears once alongside the protocols it supports. Team and personal catalogs share the same format; API keys stay local.api_keyvalues are rejected.Type of Change
Test Plan
npm run buildandnpx tsc --noEmitpass after rebasing ontoorigin/main.npx vitest run --silentand Linux-styleXDG_CONFIG_HOME=/tmp/teamai-inherited-test npx vitest run --coverage --silent: 290 files, 4313 passed, 1 skipped in both runs.Built CLI model E2E: grouped team catalogs, all five Agent switch/restore paths, preservation of unrelated settings, and rejection of unknown catalog fields by
push.Regression tests: Buddy-added metadata and owned-field edits; Codex quoted, inline, and invalid parent TOML provider definitions; unknown fields at catalog/profile/group levels.
Final built-CLI E2E: 17/17 passed, including model switching/restoration for Claude, Codex, OpenCode, CodeBuddy and WorkBuddy; Git, GitLab and GitHub each exercised with Claude, Codex, CodeBuddy and OpenCode.
Full
npm run test:e2e -- --silenton macOS: 209 passed, 8 GitHub fixture tests failed because a login shell resolved the systemghinstead of the test's fakegh. Those exact 8 tests passed when rerun with a PATH-preserving test shim; the model E2E also passed again on the final build. Three live-provider tests were skipped because their credentials were not configured.Earlier manual acceptance exercised Claude Code CLI, Codex CLI, OpenCode, CodeBuddy CLI, and WorkBuddy IDE with real model services.
New regressions: incomplete uninstall retains managed.json; Claude auth/header conflicts; Buddy allowlists; URL query credentials; inline Codex parent table; post-refresh push validation; non-interactive secret prompt; concurrent switches; dry-run read-only behavior.
Related Issues
Closes #632
Supersedes the implicit-apply direction proposed in #403.
Notes for Reviewers
<root>/v1for OpenAI protocols. Explicit endpoint mappings use their configured URL exactly.${API_KEY}only; the actual secret is entered locally through a hidden prompt, environment reference, or stdin.temperaturefield.