Files
plugins/packages/kimi-work/tests
yetone 8d687ad519 kimi-work 0.1.10: a menu the web sign-in can't get is asked again without it, so K3.1 Pro stays listed
泠夜Soul (Discord) is on 0.1.9 and still has no K3.1 Pro (k3d1-agent),
with no error and nothing in the log. 0.1.9 was checked only against
the menu signed out.

What was found: provider.models asks the menu (DescribeKimiWorkConfig,
with credentials.kimiWeb.accessToken from Kimi's file) and agent-gw's
/models together, and a failed menu ask was dropped without a word:
the list was then /models' alone, k3-agent and k2d8-preview, which is
exactly the report, on 0.1.7 to 0.1.9 alike. www.kimi.com answers a web
sign-in it doesn't take with 401 "unauthenticated", "invalid user
token" (REASON_INVALID_AUTH_TOKEN), seen on 10-24 with a malformed and
a badly signed token; signed out it answers 200 with the desktop menu.
So a stale kimiWeb token in Kimi's file (the desktop closed, or it
renewed it elsewhere) takes K3.1 Pro away silently. That this is the
reporter's case is not proven: no signed-in account here.

What changed:
- The menu, when the signed-in ask fails (any HTTP status, a timeout,
  or a reply with no models), is asked again without Authorization, as
  the desktop asks it before signing in, with the same x-msh-* headers.
  That reply is the desktop menu, K3.1 Pro first. agent-gw requests and
  usage are unchanged; nothing is retried there.
- Each failure is written to the log (console.warn, so magpie's plugin
  stderr): which ask, and its status or reason, never the token.
- jsonRequest's errors carry the HTTP status, and leaves Authorization
  out when given no token.
- no-magpie.test's fake menu is now the captured desktop menu: an
  empty one is asked twice now, which its request count would miss.

Run at this tree (origin/main df55294 + this change), macOS, bun 1.4.2,
load ~360:
- bun test packages/kimi-work: 51 pass, 0 fail. With index.mjs put back
  to df55294's: 50 pass, 1 fail, the new test (401 / 503 / empty menu
  signed in, desktop menu signed out: expects k3d1-agent "K3.1 Pro" and
  a logged line without the token).
- Live, createPlugin's provider.models with a stale-looking web token
  and a bogus Work token, against the real www.kimi.com and agent-gw,
  darwin and win32: lists k3d1-agent=K3.1 Pro, k2d8-preview, k3-agent
  and logs "DescribeKimiWorkConfig with the web sign-in failed (HTTP
  401); asking it without one". df55294's index.mjs, same script:
  throws the sign-in error (both lists failed, nothing listed).
- HOME=$(mktemp -d) bun test: 2447 pass, 1 fail, layerfs's afterAll
  timing out (#362, layerfs untouched). (A first run with HOME and
  TMPDIR under a path containing "magpie" failed four no-magpie tests
  on that path alone.)
- bun scripts/check.mjs: every plugin ok. git diff --check clean.

Magpie side, read at origin/main 137187a40: a plugin update goes
through Restart, which retires the host and calls changed(), so
forgetProviders drops the cached list and a new host lists again;
keepListed keeps an old list only for a provider that fell back, which
this one never reports. No stale-cache cause there.

Not tried: a signed-in Work account, so whether the reporter's menu
ask fails (401 or otherwise) or succeeds with a menu lacking
k3d1-agent is not known. This release logs which. Not changed: the
desktop interceptor (www.kimi.com's own web bundle, the isDesktop
branch) also sends X-Traffic-Id, x-msh-device-id, x-msh-session-id and
X-Language, and the User-Agent is still Kimi Code's (#363).
2026-10-24 20:09:47 +08:00
..