A WorkBuddy AI 429 that magpie routed past to another member was never in the usage ledger, so the free window's estimate never learned the vendor's reset (#910). The plugin now reads magpie's routing trace (routing/YYYY-MM-DD.jsonl and .jsonl.gz, three days, both files when a day has both) for WorkBuddy 429 tries and pins the window at the reset they name.
- A gateway rest pins the window only when rest.by is "resets" (the vendor named it). cooldown, backoff, quota, window and retry-after leave it alone.
- The rest key's account (lowercased by magpie's restKey) is compared case-insensitively. order[].who's spelling is kept, and a who/key conflict drops the try.
- The parse cache is one entry per path, provider and model, with the file's fingerprint inside it. Paths outside the current three days are dropped.
- Lines without "status":429 are skipped before JSON.parse.
What was run at b48fd3fcc494a708aba65e47643738dfd6a34e80 (temp HOME, fake data only, nothing reached WorkBuddy):
- mote (macOS): bun test packages/workbuddy, 360 pass, 0 fail, under TZ=UTC, Asia/Shanghai, America/Los_Angeles, Pacific/Pago_Pago and Pacific/Kiritimati. bun scripts/check.mjs passes.
- Windows 11 (xiaomi-gpu): 360 pass, 0 fail.
- Broken by hand, one at a time, each turned at least one test red: any rest kind pins (1), exact-case account match (2), no stale-path drop (1), fingerprint back in the cache key (1), no who/key conflict check (1), no provider prefix check (1).
- Merges cleanly onto main 201bd277 (the two commits since touch chat and agy-cli only).
Not covered by a test: removing the oldest/now filter in routingRefusalRows turns nothing red. magpie's trace has no try later than now, and an older edge closes no counted window, so it is a guard only. Not tried: a real WorkBuddy account or a real magpie session.
Co-authored-by: yetihan <yetihan@users.noreply.github.com>
27 lines
669 B
JSON
27 lines
669 B
JSON
{
|
|
"name": "@magpie-community/opencode-workbuddy-auth",
|
|
"version": "0.2.29",
|
|
"description": "OpenCode provider plugins for WorkBuddy's plans: WorkBuddy (CodeBuddy, copilot.tencent.com) and WorkBuddy AI (www.workbuddy.ai)",
|
|
"type": "module",
|
|
"main": "./opencode.mjs",
|
|
"exports": { ".": "./opencode2.mjs" },
|
|
"files": [
|
|
"index.mjs",
|
|
"opencode.mjs",
|
|
"opencode2.mjs",
|
|
"README.md"
|
|
],
|
|
"keywords": [
|
|
"opencode",
|
|
"opencode-plugin",
|
|
"workbuddy",
|
|
"codebuddy"
|
|
],
|
|
"license": "MIT",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/magpie-community/plugins.git",
|
|
"directory": "packages/workbuddy"
|
|
}
|
|
}
|