Repository navigation
Conversation
Supplemental fork CI: passed / Fork CI 补充验证:全部通过The original, unmodified
Environment: GitHub-hosted 中文已在自己的 fork 中创建测试 PR #1,使用与本 PR 相同的上述完整 head/base SHA,运行未经修改的原始工作流。云端运行记录已全部通过:2158 项测试通过、0 失败、21 项插件接口检查通过,npm 包状态查询任务也成功。CI 实际检出的合并提交文件树与本 PR 的 head 完全一致。 没有为跑通检查而修改源代码或工作流;没有使用真实 Kimi 凭证,也未改动本机 Magpie 配置或现有会话。结果作为 fork 的补充验证,上游工作流仍需维护者批准;本测试 PR 保持未合并。 |
yetone
left a comment
There was a problem hiding this comment.
感谢这么完整的验证记录和 fork CI。我在 PR head 9c5fdb90 上看过了这次的全部改动(index.mjs、README、COMPATIBILITY、四个测试文件),在一个沙箱 HOME 里跑了 bun test packages/kimi-work:50 pass / 0 fail。宿主这边我也对照了 magpie 的 host.js:auth.refresh / refreshLead,以及在锁里核对 secretOf(was) 和 access 之后才提交,都和 README 写的一致。设计本身我没有异议。
现在还不能合并,原因有下面几条。
1. 需要 rebase 到当前 main,版本改成 0.1.9。 这个 PR 的 base 还是 1b06308。之后 main 上的 kimi-work 已经发到 0.1.8:
663ce130.1.6:某个模型的 effort 列表读不出来时,整个目录不再一起丢掉0a9415f0.1.7:用DescribeKimiWorkConfig(CONFIG、workConfigRows)补充模型8310fd20.1.8(#353):UA改成kimi-code-cli/0.36.0,并加上workHeaders(deviceId)/readDeviceId
所以本 PR 的 "0.1.6" 和已发布的 0.1.6 撞号了。合并 main 后,index.mjs、package.json 和 tests/provider.test.mjs 会冲突(index.mjs 有 7 处)。解决冲突时请注意下面几点:
jsonRequest在 main 上的签名是(url, token, body, signal, deviceId),而且无条件发送Authorization:'Bearer '+token。本 PR 的jsonRequest(REFRESH, undefined, …)依赖...(token?{Authorization:…}:{})这个条件分支。合并时要保留这个分支,不然发给 auth.kimi.com 的会是Bearer undefined。请加一个测试,断言 REFRESH 请求里没有 Authorization。readDesktop的返回值要同时带上deviceId: readDeviceId(file)和webRefresh。- 登录 callback 里探测
/models时要传s.deviceId(main 是jsonRequest(BASE+'/models',s.workToken,undefined,undefined,s.deviceId))。 _internal要同时导出两边的成员(workConfigRows, CONFIG, workHeaders, readDeviceId和REFRESH, REFRESH_LEAD, expiry)。- README 和 COMPATIBILITY 里所有 "0.1.6"、"upstream 0.1.5" 的说法都要按 0.1.9 重写。
2. 续期请求的请求头。 0.1.8 已经把发给 agent-gw 的请求改成 Kimi 自己客户端的样子了。按本 PR 的写法,发往 auth.kimi.com/.../RefreshToken 的请求走的是非 BASE 分支,只带 User-Agent: kimi-code-cli/0.36.0。这个组合是 Kimi Code CLI 的 UA 去调网页端的 auth 接口,官方客户端里不会出现。请把官方网页端(或桌面端)一次真实 RefreshToken 请求的全部请求头抓下来,和插件发出的逐项对比,然后按官方的发,并把对比结果写进 COMPATIBILITY。对第 1、2 点的修改,也请再跑一次真实续期(换出新的 access 和 refresh,GetSubscriptionStats 返回 200)。
3. 桌面端和插件共用同一条 refresh token 链。 这一点最关键,记录里没有回答。插件导入的是桌面 config.json 里 kimiWeb 的同一对 access/refresh。如果 Kimi 的 RefreshToken 会轮换并作废旧 refresh token(COMPATIBILITY 里观察到 refresh token 确实变了),那会出现两种情况:
- magpie 续期之后,桌面端手里的旧 refresh token 失效,桌面 Work 被登出;
- 反过来,桌面端先续期,magpie 存的那份失效,于是续期返回 401,用户又要重连。
0.1.5 之前的代码明确写了 "Never consume its refresh token",就是为了避开这个问题。之前的 live probe 只确认了桌面的 config.json 内容没变,没有确认之后桌面端是否还能正常续期、保持登录。请补一次真实记录:
- magpie 续期之后,等桌面端自己的 access token 过期,确认桌面 Work 仍然在线;
- 再在桌面端续期之后,确认 magpie 下一次续期是成功还是 401。
如果结果是两边只能活一个,就需要换方案,比如每次从桌面文件重新读取、只在桌面的 token 过期时才提示用户。还有一种情况:桌面端 token 已经更新,而 magpie 存的那份失效了。这时应该提示用户"重新连接",或者自动重新导入。README 要把这种行为写清楚。
4. 小问题,不阻塞合并。
- 0.1.5 以前的老用户在 usage 里会直接看到
kimi_work_login_expired,必须手动重连。请确认 magpie 卡片上显示的提示文字能让用户明白要去重新连接,并在 PR 正文里写明这一点对所有已登录用户的影响(参见 LESSONS 里的 "a fix that holds only for new data says what happens to the old")。 - COMPATIBILITY.md 现在主要是过程记录(独立 review、VM 用例数等),篇幅越来越长。建议只保留当前版本已验证的事实和局限。
rebase 之后,请在 PR 里写明:在新的 head sha 上跑了什么(bun test packages/kimi-work、完整的 bun test、bun scripts/check.mjs kimi-work),以及第 2、3 点真实测试的结果。我会在那个 head 上重新 review。
English summary. At 9c5fdb90, bun test packages/kimi-work passes 50/50, and magpie's host does commit auth.refresh under its lock as the README says. Not mergeable yet:
- Rebase onto main (kimi-work is at 0.1.8 there) and ship as 0.1.9. Keep 0.1.6's effort-list fix, 0.1.7's
DescribeKimiWorkConfigmodels and 0.1.8'sworkHeaders/deviceId. Keep the conditional Authorization header for REFRESH, and add a test that REFRESH sends none. - Diff the RefreshToken request's headers against the official web or desktop client's, and send what it sends.
kimi-code-cliUA on auth.kimi.com isn't a real client combination. - Show with a real run whether magpie and the desktop app can both keep renewing from one refresh lineage. If rotation revokes the old refresh token, one side gets signed out. That is why main avoided consuming it.
- Minor: say what existing signed-in users see, and trim COMPATIBILITY.md to the facts that are current.
|
谢谢 fork CI 的记录。我核对了一下:这次 fork 运行测的 head 是 另外,main 刚刚又发了一个版本,rebase 的时候请注意:
rebase 之后,请在新的 head 上把 review 里列的命令跑一遍,再加上第 2、3 点的真实测试记录,我会在那个 head 上重新 review。 English: the fork run is at |
|
已在新 head
本地最终 head: 同一 head 的原始 fork CI:测试 PR #2 / 运行 40108410843,全部成功。 Bun 1.4.4:2482 pass / 0 fail,215 个文件; 公开记录仅含版本、提交、时间、HTTP 状态及脱敏头字段;未附 Kimi 账号名、手机号、用户 ID 或凭证。此次临时登录资料已清理,未部署本机插件或改写日常配置/会话。 English: all four review points are addressed at A fresh isolated login tested both branches through natural access expiry: plugin rotation at 15:21 → native desktop renewal at 15:29:53–54 → plugin renewal with its original stored expiry and retained refresh branch at 15:36:50, all 200 with changed access/refresh. Monthly reads and the temporary desktop's Work Final-head local validation: 76 focused tests, 2482 full tests, 0 failures, 25 hook checks; independent code/document re-review CLEAR. The unchanged original fork workflow also passed 2482/0 on Bun 1.4.4, with both original jobs successful. Its pinned head/base and identical checkout/head trees are verified. Supplemental fork CI does not replace upstream approval. No Kimi account identifiers or credential values are included; temporary credential profiles were removed and everyday configuration/sessions were not operated on. |
Expired desktop membership access currently makes Kimi Work quota unavailable. This adds host-managed membership renewal and a single monthly shared-pool meter in 0.1.11, incorporating main through
28f9cbb3b26ccc3a7739c8e21ebee0cda3d929d4(official kimi-work 0.1.10).packages/kimi-work.amountUsedRatioin one 本月 meter. Code's monthly share remains a text annotation, not a second allowance. Preserve schema conversion and cancellation during body reads.Existing accounts: every official reference-only sign-in through 0.1.10 must reconnect once (
magpie plugin login kimi-work). The card now recognizes the expired-sign-in marker and displays Magpie's localized re-add-account prompt. Earlier PR builds' saved pairs keep their format. If a saved refresh branch is rejected later, reconnect explicitly; usage never silently imports another desktop login.At
f67d742c73baf60ee7b493d22faa2771465b2e9e, local validation passed: 76 plugin tests, 2482 full-repository tests, the focused hook check and 25 total hook checks. An independent code/document re-review is CLEAR. Fork test PR #2 passed the unchanged original workflow on this head/base: Actions run. Its merge tree equals the head tree; this is supplemental CI evidence and does not replace upstream approval.A fresh isolated login on 2026-10-24 tested both directions: plugin rotation → desktop's natural access expiry and native renewal (200) → plugin's natural access expiry and renewal from its retained branch (200), with monthly stats and desktop Work
/modelsalso 200. The record distinguishes the initially forced hook expiry from the later unmodified natural expiry. These are production plugin hooks in an isolated harness plus original native desktop methods, not a new Magpie credential-file commit/UI conversation test or a guarantee of indefinite coexistence.中文
本次将会员续期和单个月度共享额度窗口合入上游 0.1.10,版本为 0.1.11;保留全部模型目录、K3.1 Pro 菜单、deviceId、请求头及无认证菜单回退修复。相对 main 仅修改
kimi-work。