codearts 0.3.22: OfficeAce's first rates read is tried again, and its fallback lists only callable ids (#1197)

yukinomon measured it (#1197): when the billable list's first read after
a start failed, the listing fell back to OA_FALLBACK_MODELS, and 7 of its
10 ids are no longer in OfficeAce's catalog while 6 of the 9 callable ids
were missing from it. The in-process cache holds no table at start, so
one blip put the old list in front of the user until the next listing.

- fetchOfficeAceTokenRates reads once more (after 400ms) when it has no
  table to keep; a network error, a non-2xx, an unparseable or an empty
  answer each count as a failed read. With a table held it reads once,
  as before.
- OA_FALLBACK_MODELS is the 9 ids the reporter measured as callable
  (catalog ∩ rates on 2026-11-16).
- With no rates table at all, the listing is the account's catalog cut
  to those known ids, so an id the catalog has dropped is not listed;
  the static table only when that leaves nothing.

Run (mote, HOME=$(mktemp -d)):
- bun test packages/codearts/index.test.mjs: 215 pass, 0 fail.
- bun scripts/check.mjs codearts: ok.

Broken by hand: origin/main's index.mjs with the new tests: 3 fail (the
retry, the dropped ids, the catalog-cut fallback).

Not tried: a real OfficeAce account (none here); the ids come from the
reporter's measurement.
This commit is contained in:
yetone
2026-11-16 11:25:10 +08:00
parent 175dfd2555
commit 4e0cdabbba
3 changed files with 78 additions and 21 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/opencode-codearts-auth",
"version": "0.3.21",
"version": "0.3.22",
"description": "Huawei Cloud in OpenCode and magpie: CodeArts (码道) and OfficeAce (AgentArts), each from its own Huawei Cloud OAuth sign-in — models, credit rates, credit usage and the daily check-in (unofficial)",
"type": "module",
"main": "./opencode.mjs",