Repository navigation
fix(oauth): ignore field order when detecting refreshed model changes - #4532
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
🦋 Changeset detectedLatest commit: a8e0cb9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
The behaviour of MoonshotAI#4421 has been in the requester since 94397aa, but its suite still asserted only that the lowered system message lost its `tools` field, which a message kept in place would also satisfy. Assert instead that no system message survives and the history keeps its length, and rename the case after what it protects. Also settle ten ledger rows that were already implemented here: MoonshotAI#3733, MoonshotAI#4413, MoonshotAI#4418, MoonshotAI#4421, MoonshotAI#4435, MoonshotAI#4460, MoonshotAI#4465, MoonshotAI#4516, MoonshotAI#4523, MoonshotAI#4532 and the MoonshotAI#4558 test calibration, each with a probe over the suite that pins it. Two rows carried a probe without a test-name selector (MoonshotAI#4557, MoonshotAI#4558), which aborted `--verify` for every other row; MoonshotAI#4557 is a changelog sync and now carries a manual probe.
Requirement or Bug
#3733 合入后,main 的 CI 在
refreshProviderModels.test.ts的一个用例上稳定失败,所有 PR 的test (2)都被卡住。查下来不只是测试数据的问题:刷新判断"模型有没有变"时连字段顺序一起比较,导致部分自定义注册表用户每次刷新都被报告为"模型元数据已更新"。Bug Reproduction Steps
apiJson来源)的 provider,注册表里的模型同时声明limit.output和support_efforts(或default_effort、upgrade)。/provider refresh:第一次报告元数据更新,补上max_output_size,这是预期的。/provider refresh:注册表没有任何变化,仍然显示<provider>: model metadata updated.,之后每次都一样。Root Cause
刷新前后,
refreshProviderModels把模型和 provider 配置JSON.stringify后比较字符串,所以字段顺序不同也算变化。而配置里的字段顺序和刷新构造的顺序本来就可能不一致:写回配置时,已有字段留在原位、新字段追加到末尾;刷新则按固定顺序构造别名。#3733 把maxOutputSize排在displayName之后、supportEfforts之前,于是升级后追加到末尾的max_output_size,和刷新结果的顺序永远对不上:CI 失败是同一个原因的另一面:那个用例预存的别名没有
maxOutputSize,而注册表返回了limit.output,所以它本来就不满足"元数据没变"的前提。这是根本修复:比较前先把字段排序,顺序不再影响判断。
Code Changes
capabilities原本就会先排序,其他数组(比如supportEfforts)顺序变了依然算变化。maxOutputSize,让它重新符合"元数据没变"的前提;新增一个用例,把模型字段和 provider 字段的顺序都打乱,断言既不报告变化,也不重写配置。Behavior Changes and Affected Users
/provider refresh显示 model metadata updated,发布ModelCatalogChanged,重写配置max_output_size、数组顺序变化)受影响模块:
packages/oauth的刷新比较逻辑。模型比较被 Kimi 托管、Open Platform、Kimi Code API key 端点和自定义注册表四条刷新路径共用,provider 配置比较只在自定义注册表路径上;经模型发现服务影响 TUI、print、server 定时刷新和 desktop / web。对这四条路径来说,唯一的变化都是不再把顺序差异当成变化。验证:
discovery.test.ts,以及 kap-servermodelCatalog、modelCatalogRefreshScheduler测试通过;oauth typecheck 和 oxlint 通过。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.