Commit Graph
62 Commits
Author SHA1 Message Date
yetone aec58aec33 workbuddy 0.2.10: "Free models only" in magpie's languages, and says it filters the list (#590)
anewuser6937 (Discord, #590) saw one model in WorkBuddy's editor and took
the plugin for broken: they had turned on "Free models only" themselves,
but its label and description read in English inside magpie's Chinese
window, and nothing by the models said the list was filtered.

The switch now gives its label and description in Chinese, Traditional
Chinese, Japanese and German (labels, descriptions, by magpie's window
language) and says filtersModels: true, so a magpie that knows these
fields says under the models that the list is filtered while it is on.
Both are magpie's own fields inside auth.options, which OpenCode
(AuthHook: provider, loader, methods) never reads; an older magpie's host
copies only key/label/description/default/confirm, so it shows the English
words as before. Nothing else changes: what the switch does is the same.

Run on mote: HOME=$(mktemp -d) bun test packages/workbuddy: 303 pass,
0 fail; bun scripts/check.mjs ok. The new freeonly test ("says its words
in magpie's languages, and that it filters the list", both sites) fails
2 of 2 with index.mjs put back. Loaded into magpie's real plugin host
(the magpie change beside it), plugin.Providers lists both sites' free_only
with all four languages and filtersModels true.
2026-11-01 13:15:09 +08:00
yetone 6727a1e68c workbuddy 0.2.9: a model declared before the account's list is read takes images (#572)
kongbai01203 found WorkBuddy AI's kimi-k3 listed as image: false and
reasoning: false. That is the list the plugin declares (configModels): what
magpie has before an account's own list is read, for an API key whose CLI
reads no config, or when /v3/config can't be read. It declared every model
text-only. The live list already says kimi-k3 takes images.

Read on 2026-11-01 with the owner's real accounts: both sites' /v3/config
mark every model supportsImages (WorkBuddy AI's glm-5.3 aside, which
textOnly already turns off, measured 10-13). Through this plugin's own
loader fetch, a chat to www.workbuddy.ai's kimi-k3 with a 32x16 PNG, blue
left and yellow right, answered "Blue yellow" (HTTP 200). kimi-k3-1, the
id in the report, is a copilot.tencent.com model: www.workbuddy.ai answers
it 400 11102 "service info not found".

A declared model now takes images unless textOnly says its site drops them.

Run (mote-run, bun 1.4.2, HOME=$(mktemp -d)): packages/workbuddy bun test,
301 pass 0 fail.
Broken by hand: with index.mjs at origin/main, declared-images.test.mjs is
0 pass 2 fail.
Not tried: the static list's models the live config no longer lists
(gpt-5.5, kimi-k2.6, ...) with an image; they are declared as the config
said of every model.
2026-11-01 00:09:58 +08:00
yetone 42a5055fe0 workbuddy 0.2.8: deepseek-v4.1-flash takes the config's million on copilot.tencent.com again (#561)
0.2.7 capped deepseek-v4.1-flash's context at 100000 on the China build
(SITES.workbuddy.contextCap, contextOf) from one report's error text,
"prompt is too long: 100001 tokens > 100000 maximum", which I could not
check myself. It was wrong for every other account we have numbers for.
On 2026-10-31, on copilot.tencent.com with China Free-plan accounts
(#561):
- CNife: 110,041, 200,041, 500,041 and 900,041 prompt tokens, all 200;
  a 900,077-token prompt with needles at 5/40/75/99.5% recalled all four.
- 1529119384: 82,767 to 992,389 tokens, all 200 with a needle at
  position 0 recalled; 1,157,831 answered 400 "prompt is too long:
  1157831 tokens > 1048576 maximum", the vendor's own ceiling. After the
  0.2.7 update the cap hurt their compaction.
- UNscientific-9: 153,501 and 203,021 tokens, 200 on four accounts.
brickhao on Discord said 100k compacts far too often.

The cap and contextOf are gone: both sites list the config's
maxInputTokens (1000000) for it, as for every other model. #563's none
level from 0.2.7 stays.

No cap in its place: a prompt WorkBuddy does find too long is its own 400,
which the plugin already passes on as it came (explained leaves it alone,
X-Magpie-Sign-In kept). magpie's tooLongRe matches "prompt is too long",
so overflowed() makes it context_length_exceeded for the agent to compact,
and retryable() says false for it, so no account is rested or asked again.
The new tests hold that passthrough.

Run:
- deepseek-flash.test.mjs against 0.2.7's index.mjs on mote: 3 fail (the
  China million, a 1048576 config listed as given, no site caps), 5 pass;
  against this one: 8 pass.
- Broken by hand: explained() treating "too long" as credits exhausted
  turns both passthrough tests red (2 fail).
- The workbuddy package on mote, HOME=$(mktemp -d) bun test: 299 pass,
  0 fail.
- bun scripts/check.mjs on mote: ok.

Not tried: a real request on copilot.tencent.com (my CN sign-ins still
answer 401); the numbers above are the testers'. The passthrough test's
envelopes are WorkBuddy's {code, msg, extError} as it words other 400s
and the bare OpenAI shape; only the message text is the vendor's literal.
2026-10-31 22:04:38 +08:00
yetone fee318fed4 workbuddy 0.2.7: deepseek-v4.1-flash lists none (#563); copilot.tencent.com's takes 100000 tokens (#561)
#563: deepseek-v4.1-flash and deepseek-v4.1-flash-sg list a "none"
level. Both sites' /v3/config call them onlyReasoning, so WorkBuddy's
own client hides the off switch and the plugin listed none of it. They
take it anyway. On WorkBuddy AI on 2026-10-31, reasoning_effort "none"
answered 200 with 0 reasoning tokens (twice on -flash, once on -sg).
"low" spent 1221 and 1127 reasoning tokens, and no effort (the plugin's
default high) spent 1219. glm-5.3-flash still lists no none. The
default effort stays the config's high.

#561: on the China build (copilot.tencent.com), deepseek-v4.1-flash's
context is capped at 100000 (SITES.workbuddy.contextCap, contextOf). A
smaller config value is kept. The reporter's vendor error was "prompt is
too long: 100001 tokens > 100000 maximum", seen 11 times on 2 accounts,
while glm-5.3-flash on the same endpoint takes 1M. The config says
1000000 on both sites. WorkBuddy AI's deepseek-v4.1-flash took 148,793-
and 181,887-token prompts, so that site keeps the million.

Run:
- deepseek-flash.test.mjs (new, against testdata/config-561.json, the
  real configs cut to the models compared) and efforts.test.mjs,
  against the old index.mjs on mote: 5 fail, 3 pass. The ones that
  pass are the glm/no-none and unchanged-sibling checks.
- The workbuddy package on mote, HOME=$(mktemp -d) bun test: 297 pass,
  0 fail.
- bun scripts/check.mjs on mote: ok.
- Real WorkBuddy AI account in a sandbox HOME, through the plugin loader:
  the none/low/default and long-prompt numbers above.

Not tried: the China build itself. Both CN sign-ins I have (desktop on
this Mac and on the Windows box) answer 401 on chat, so the 100000 cap
rests on the reporter's literal error, not on a reply of my own.
2026-10-31 20:17:58 +08:00
yetone d0d07168ef workbuddy 0.2.6: an empty tool_calls list is no call, so the filter's refusal is still caught (#540)
itspig (#540, 2026-10-31) ran magpie v0.1.2283 with workbuddy 0.2.5 on
the live account, through a [workbuddy, volcengine] group: the refusal
still reached the client and routing.jsonl had the workbuddy try
done/200 with firstText 3208, no try of volcengine.

The cause: copilot.tencent.com puts "tool_calls": [] on every delta, text
too (magpie f2c7536d7 recorded it for Qoder). unsaid let the reply
through at the first delta whose tool_calls was truthy, and [] is truthy
in JS, so the gate opened at the reasoning chunk and nothing was held or
taken out. itspig's paste had no tool_calls because it was read off
magpie after chatTidy dropped the empty list and Go re-wrote the chunk
with its keys sorted; 0.2.5's fixture was built from that paste.

unsaid now counts a tool_calls list only when it holds a call.

Run (on mote, mote-run):
- HOME=$(mktemp -d) bun test packages/workbuddy: 291 pass, 0 fail.
- bun scripts/check.mjs: exit 0.
- filtered.test.mjs: the paste's chunks with WorkBuddy's own framing
  ("tool_calls": [], "finish_reason": "" until the last, an empty
  reasoning_content beside the line) cut every 1, 7 and 1MiB bytes; the
  line split over deltas that each carry the empty list; a real call
  still lets the reply through as it came.
- End to end, in magpie's plugin host (a magpie worktree's gateway test,
  not committed there): this file loaded by the host behind a fetch
  shim pointing copilot.tencent.com at a fake vendor, signed in with an
  API key, in a group [workbuddy-plugin/deepseek-v4.1-flash, b/m], asked
  as a streamed chat, a one-body chat, Messages (Claude Code's ask) and
  Responses (Codex's ask). With 0.2.6, 8 of 8 hand on to b and say no
  "Sorry", for the paste and for the wire framing.

Broken by hand:
- 0.2.5 (b5cc782): the 4 new wire-framing tests go red; end to end the
  wire framing goes red on chat, Messages and Responses (b never asked,
  "Sorry" in the reply), the paste stays green, as itspig saw.

Not tried: a live WorkBuddy account; the trigger prompt was not run.
2026-10-31 08:36:42 +08:00
yetone b5cc78266f workbuddy 0.2.5: the filter's line is taken out with the newlines around it (#540)
itspig (#540, 2026-10-30) ran 0.2.4 against copilot.tencent.com and the
refusal still reached the agent. The real chunk's content is
"\nSorry, I can't respond to this question.\n" with finish_reason
content_filter. filterSaid trimmed only the start, so the trailing "\n"
made the text longer than FILTER_SAYS, the prefix test failed, and the
chunk went out as an ordinary answer.

filterSaid now trims both sides, and text that is only white space so
far may still be the line (so a "\n" sent in a chunk of its own is held,
not passed on). The reporter's suggested `t.startsWith(s)` is not taken:
it would treat the line followed by real words as the filter's and drop
those words at content_filter. `without` already removes the whole
content field, so the newlines go with it.

Run (on mote, mote-run):
- HOME=$(mktemp -d) bun test packages/workbuddy: 286 pass, 0 fail.
- bun scripts/check.mjs: ok.
- filtered.test.mjs has itspig's literal last three SSE events (the
  " node" reasoning chunk, the refusal chunk, [DONE]), cut every 1, 7
  and 1MiB bytes, plus newline-in-its-own-chunk, line-then-more-words
  and newline-then-answer cases.

Broken by hand:
- 0.2.4's trimStart filterSaid: the 3 literal-bytes tests and the
  own-chunk newline test go red (4 of 15).
- The reporter's trim() + t.startsWith(s) with t !== "": the own-chunk
  newline and line-then-more-words tests go red (2 of 15).

Not tried: a live WorkBuddy account; the trigger prompt was not run.
2026-10-31 07:11:51 +08:00
yetone 4883f9437f workbuddy 0.2.4: the filter's canned line is taken out of a reply it ends content_filter (#540)
itspig (#540): deepseek-v4.1-flash on copilot.tencent.com, through a
group, reasoned, said "Sorry, I can't respond to this question.", and
ended finish_reason content_filter with 0 output tokens, all under a
200. magpie recorded the try done/200, never asked the group's next
member, and DeepSeek Harness failed "The model refused to complete the
request".

unsaid() now reads a streamed chat's events: text that is still the
filter's line (FILTER_SAYS, the issue's literal words) is held; when the
reply ends content_filter with nothing else said, that text is taken out,
so magpie sees reasoning then content_filter with nothing said, which it
hands on (magpie holds DeepSeek's reasoning for that from its next
release). Any other text goes as it comes, released at its first word that
isn't the filter's; the same words ending stop, and a reply the filter
cuts off after other words, go through byte for byte. Native (Messages)
requests are not touched.

Run on mote at this tree: HOME=$(mktemp -d) bun test: 3970 pass, 9 skip,
0 fail; bun scripts/check.mjs: every package ok. Broken by hand: without
unsaid() in the chat path, the 5 refusal cases of filtered.test.mjs go red
and the 4 pass-through cases stay green.

Not tried: a real WorkBuddy refusal (I have no prompt that reproduces
it); the stream's literal chunking is not in the issue, so the tests cut
the line into one delta, three deltas, the finish chunk itself, and 7-byte
writes. Only the English line from the issue is known; a Chinese variant
would pass through as before.
2026-10-31 05:56:05 +08:00
MYCF711andMYCF711 3968cdd75f workbuddy 0.2.3: a refused opening is said with a comma first, and remembered (#513)
A chat WorkBuddy refuses as an unapproved channel (11128) for an opening FLAGGED
doesn't know is sent once more with one more comma in the opening ("You are an
AI agent, powered by X.") before the system prompt is moved into the first user
message. The comma is set in system and assistant messages only; user messages
and tool results go out as written. A system prompt whose comma passed is
remembered (bounded at 256, like refusedSystems) and its next chats go with the
comma before the first send, so a tool loop is not refused on every step. A
refusal that stands names REFUSED.md (new) before the hint; that address is
only in the error returned to the client, nothing sent upstream names magpie.
Version 0.2.3.

Run at the reviewed head cb8a026 on mote (macOS), temp HOME, outbound network
denied by sandbox-exec (localhost allowed):
- packages/workbuddy `bun test`: 271 pass, 0 fail.
- repo root `bun test`: 3774 pass, 1 fail (layerfs import-limit, fixed on main
  by 3dd0f44). cb8a026 merged with origin/main 4d8d031: 3777 pass, 0 fail.
- `bun scripts/check.mjs`: only cloudflare-workers-ai fails, with the network
  refused (#519); workbuddy ✓.
Broken by hand: no commaSystems.add -> remembered-comma test red; no pre-send
commaPausedOn -> same test red; role filter removed -> 5 tests red.
Not covered: dropping the roles.has("system") guard leaves every test green
(an assistant-only comma would be remembered). Not tried against
copilot.tencent.com in this review.

Co-authored-by: MYCF711 <MYCF711@users.noreply.github.com>
2026-10-30 18:15:12 +08:00
MYCF711 79b02cc568 workbuddy 0.2.2: DeepSeek Harness's opener keeps the harness's name (#511)
WorkBuddy refuses DeepSeek Harness's opener "You are an AI agent powered by DeepSeek Harness." as 11128 (#279). The plugin used to reword it into "You are an AI agent that helps the user with programming tasks.", which dropped the harness's name from the line the rest of a DSH prompt refers back to. It now adds one comma ("You are an AI agent, powered by DeepSeek Harness."), which the author measured passing WorkBuddy's whole-line check (400 11128 without the comma, 200 with it, copilot.tencent.com, 2026-10-30).

Run at the reviewed head 4830b16, merged onto main 7673cd0 (a fast-forward), on mote (macOS, Bun 1.4.2) with HOME=$(mktemp -d):
- packages/workbuddy `bun test`: 257 pass, 0 fail
- `bun scripts/check.mjs workbuddy`: ok
- `npm pack --dry-run`: magpie-community-opencode-workbuddy-auth-0.2.2.tgz, 3 files
- Broken by hand: put the old rewording back in index.mjs, and both unflag tests went red (2 fail).
- Real request: the comma line sent to workbuddy-ai/deepseek-v4.1-flash through a live magpie gateway (0.2.1, which leaves the comma line as written) came back 200, and the model answered "I'm running in the DeepSeek Harness."
- Version: npm has 0.2.1 and this PR ships 0.2.2.

Not tried: the China WorkBuddy site, because the review account's desktop sign-in answers 401 there. That 400/200 pair is the author's measurement.
2026-10-30 14:30:38 +08:00
yetone b9cbb9dd01 workbuddy 0.2.1: an enterprise (教育公益版, team) sign-in is named with its enterprise, kept beside the personal one
A person's personal account and their enterprise account (a team, or
「WorkBuddy 教育公益版」, picked on WorkBuddy's sign-in page after the
phone sign-in) share the uid and the nickname. magpie's plugin host keeps
one account per name and uid (settle in host.js), so signing in to the
education account replaced the same person's personal account, and the
two could never sit in one pool.

A browser sign-in that WorkBuddy places in an enterprise is now named
"nickname · enterprise name": the name from /login/account, else from
the matching /v2/plugin/accounts entry, else "enterprise <last 6 of id>".
A personal account's name is unchanged. Old data: an enterprise account
signed in before keeps its old name until its Sign in again, which uses
the same key and renames it in place; its free-model window, read from
ledger rows under the old name, starts again (README says so).

Run (mote, HOME=$(mktemp -d)): bun test in packages/workbuddy, 256 pass
0 fail; bun scripts/check.mjs ok. Broken by hand: accountName returning
the nickname alone turns the 4 new enterprise.test.mjs tests red.
Not tried: a real education account (the owner has none; the live
/v2/plugin/accounts shows only a personal entry), so enterpriseName's
presence in WorkBuddy's replies for 教育公益版 is from the web client's
SelectAccount code, not a live reply; the id fallback covers its absence.
2026-10-30 11:01:20 +08:00
Euraxluo 3f73907aac workbuddy 0.2.0: WorkBuddy (China) daily check-in through the billing meter (#177)
WorkBuddy (China) claims its daily check-in credits through the billing meter's /v2 activity status and daily-checkin. Outcomes are done, ineligible, inactive, claimed and failed, all of which magpie's host accepts. A request that gets no answer is thrown, for magpie's 1-minute backoff. The AI build has no hook.

The review merged main (0.1.48) in, resolving the conflicts in meter, the hook list, _internal and README. It also made an API-key account ineligible without sending a request, and set the version to 0.2.0.

Run at d66f51c on mote, with a temp HOME:
- bun test packages/workbuddy: 253 pass, 0 fail
- the whole repo: 3521 pass, 0 fail (3529 tests)
- bun scripts/check.mjs workbuddy: ok

Broken by hand, each red:
- dropping the API-key line: its new test
- the hook on the AI build: "WorkBuddy AI's plugin has no check-in"
- an unreadable 200 not thrown: the usage test and the check-in test

Not covered: main's own invalidToken flag on a refused meter reply has no test that fails without it. That gap is on main and was kept as it is.
2026-10-29 21:46:35 +08:00
keeuuandkeeuu f0ed150573 workbuddy 0.1.48: WorkBuddy AI's card shows the free model's daily token window (#299)
WorkBuddy AI's free model (deepseek-v4.1-flash) has a daily token window of
its own (about 1e8 tokens per account per 24h) that the credit meter doesn't
show. The plugin rebuilds it from magpie's usage.jsonl and adds it to the
card as "Free model tokens" beside Credits. WorkBuddy AI only; the China build
is unchanged.

Review merge: main (0.1.47) merged into the branch, conflicts in index.mjs
(imports, _internal) and package.json resolved, version 0.1.48. Added a test
that the window reaches the WorkBuddy AI card from a ledger in the sandbox
HOME, and that the China build's card has none.

Run at 09718f5 on mote (HOME=$(mktemp -d)):
- bun test packages/workbuddy: 237 pass, 0 fail (before the new test).
- bun test (whole repo): 3499 pass, 0 fail; bun scripts/check.mjs: ok.
- Broken by hand, each reverted: the card no longer pushing the window ->
  the new usage test red; an unreadable row time ending the read ->
  "a row whose time cannot be read is passed over" red.
Not tried against the live service (no WorkBuddy AI free account).

Co-authored-by: keeuu <keeuu@users.noreply.github.com>
2026-10-29 21:39:45 +08:00
yetone 1e7122e161 workbuddy 0.1.47: a conversation's ids are one account's own
leaves5760 on Discord: every account of a group of WorkBuddy accounts gets
403 "request illegal", WorkBuddy saying the account is restricted for
abnormal behaviour.

X-Conversation-ID and X-Conversation-Request-ID were derived from the
session (or first user message) and the turn alone, with a salt per
process. One magpie session spread over several accounts therefore sent the
same conversation and turn ids under every account's X-User-Id. WorkBuddy's
own client (5.9.3, @genie/agent-cli 2.165.0) is signed in as one account,
so a conversation never shows up under two. The ids now also hash the
account (uid, enterpriseId, and for a key account the key), and a chat sent
again after a 401 as another account (a sign-in saved since) gets that
account's ids. The same account keeps stable ids as before.

This is a divergence from the official client found by reading its
bundle, not a verified cause of the restriction. Not changed, reported
only: no X-Private-Data, traceparent/baggage, reasoning_summary "auto",
or the client's /v2/report telemetry.

Run on mote at this tree: HOME=$(mktemp -d) bun test in packages/workbuddy,
209 pass 0 fail; bun scripts/check.mjs exit 0.
Broken by hand: with the account left out of the ids, both new tests
(conversation.test.mjs, unauthorized.test.mjs) fail; with reattend a no-op,
the 401 test fails.
Not tried: a real WorkBuddy account (none used, by the task's rule).
2026-10-29 15:37:53 +08:00
yetone b08a6c1bce workbuddy 0.1.46: WorkBuddy AI's chats carry its current 5.9.3 client's headers
Two Discord users report WorkBuddy AI accounts answering 403 11140
("account restricted due to unusual activity"). While looking into it,
the plugin was found sending WorkBuddy AI's chats as a client one release
behind: WorkBuddy/5.8.4 workbuddy-ai/5.8.4 CLI/2.161.0, X-IDE-Version
5.8.4, no X-Agent-Runtime. Not shown to be the cause of the restrictions
(no real account was used); it is a header that no longer matches the
official client.

Read (never run) on 2026-10-29, unauthenticated:
- www.workbuddy.ai/v2/update?platform=workbuddy-darwin-arm64 answers
  5.9.3.42398134 for every version asked from 5.3.0 to 5.8.4.41366630
  (the desktop's resolveUpdateClientTypePrefix maps workbuddy-ai to
  "workbuddy"), download.codebuddy.ai, last-modified 2026-10-27.
- That zip, range-read: "WorkBuddy AI.app" CFBundleShortVersionString
  5.9.3, bundle id com.workbuddy.workbuddy-ai, cli/package.json
  @genie/agent-cli 2.165.0, cli/product.json productName WorkBuddy AI,
  platform workbuddy-ai, Electron Framework 37.10.3.
- Every file under app.asar.unpacked/cli has the China 5.9.3 zip's CRC
  but product.json and sandbox-config.json, so the CLI's headers
  (UserAgentHttpInterceptor, axiosToFetchAdapter, X-Stainless-*, gzip)
  are the China build's.
- Its app.asar puts agentRuntime `local-agent` in the prompt meta, as
  the China build's does, so X-Agent-Runtime: local-agent goes on
  WorkBuddy AI too.

Now WorkBuddy AI sends WorkBuddy/5.9.3 workbuddy-ai/5.9.3 CLI/2.165.0,
X-IDE-Version 5.9.3 and X-Agent-Runtime local-agent; the China build is
unchanged.

Run (on mote, HOME=$(mktemp -d) bun test in packages/workbuddy): 207 pass,
0 fail. bun scripts/check.mjs: exit 0.
Broken by hand: conversation.test.mjs on origin/main's index.mjs (0.1.45):
2 of 13 red (the WorkBuddy AI User-Agent, and the per-build header test).
Not tried: a real WorkBuddy AI chat with the new headers. Still not sent:
X-Device-Token (Tencent's native device SDK). No text added names magpie
or WorkBuddy's limits.
2026-10-29 13:40:02 +08:00
yetone 880cd9319c workbuddy 0.1.45: only a chat completion goes gzipped; magpie's drawings go as plain JSON
iwinux on Discord (2026-10-28 ~22:30 UTC+8, magpie v0.1.1812): the Magpie
Image MCP through WorkBuddy AI failed from the minute 0.1.43 was published
(14:30Z) with
  400 Bad Request: Unmarshal create image params failed with error:
  invalid character '\x1f' looking for beginning of value (11101)
0.1.43 (f4d48ac) gzipped every body the loader's fetch sent that wasn't
Messages. magpie's drawWorkBuddy (internal/gateway/draw_workbuddy.go) sends
its JSON to <site>/v2/images/generations and /v2/images/edits through that
same fetch, and WorkBuddy's images API reads the raw bytes as JSON: '\x1f'
is gzip's first byte. magpie itself passes the JSON string through
unchanged (host.js bodyOf); the plugin set Content-Encoding: gzip and
compressed it.

Now only a chat completion (a path ending /chat/completions, or with no URL
to read, a body holding messages: isCompletion) goes gzipped, and only one
is given the model's default effort, which also ran on a drawing's body and
read /v3/config for it. Messages and everything else go as they came.
Sibling paths checked: /v3/config is a GET with no body; Messages and
count_tokens were already left alone; the plugin serves no embeddings.

Run (on mote, HOME=$(mktemp -d) bun test in packages/workbuddy): 207 pass,
0 fail. bun scripts/check.mjs: exit 0.
Broken by hand: the new images.test.mjs on origin/main's index.mjs (0.1.44):
4 of 6 red, the fake images API answering 400 with the reporter's own
"invalid character '\x1f' ... (11101)"; the 2 that pass guard that a chat
still goes gzipped on both builds.
Not tried: a real WorkBuddy drawing (no live account used here); whether
WorkBuddy's own CLI gzips its image requests (its images API doesn't take
gzip either way).
2026-10-29 00:33:30 +08:00
yetone 95fa76126d workbuddy 0.1.44: a huge chat's ids are hashed in pieces, and it is read once on every path (#461)
0.1.42 brought jihuayu's 45 MiB repro from 7 parses a request to 2, and
0.1.43 keeps that: one full parse and one full stringify a request. What
was left of the peak was attendChat: the conversation and turn ids were
made from template strings holding the whole user message (`first:${sig}`,
`u1:${sig}`, `${conv}|${turn}`, then `${SALT}|kind|${key}`), each a fresh
45 MB string, ~160 MiB of peak a request. The keys are now lists of
pieces fed to one sha256 each, whole (Bun hashes a one-byte string in
place; 1 MiB slices cost a copy and were worse), with a high surrogate
split between pieces held for the next one, so every id is the hash of
the same string as before.

Also read once on paths the repro doesn't take:
- "Free models only" parsed the body again for its model; it reads the
  chat prepared already parsed.
- A model known to want a reply after tools (11153) had the body parsed
  and stringified again on every request; the reply goes into the one
  parsed chat before the one stringify.
- The prepared result no longer holds the parsed tree past the send.

Every byte WorkBuddy sees is unchanged: sent.test.mjs runs 12 chats
(OpenCode tools, default effort, developer turn, after-tools refusal and
known, system refusal and known, both, Messages, bytes, not JSON),
switch off and on, and holds the gunzipped body's sha256, url, encoding
and which requests share an id to testdata/sent-0.1.43.json, made by
running the same harness on npm's 0.1.43 index.mjs (sha 9213db6d...).

Run on mote (Bun 1.4.2), the issue's benchmark.mjs as written but for
the import, 45.3 MiB body, 4 requests, concurrency 1, /usr/bin/time -l,
3 runs each:
  direct (no plugin)   336 MiB
  0.1.41               981-1117 MiB, 28 parses (1087.5 MiB), 24 stringifies
  0.1.43               717-760 MiB, 8 parses (181.3 MiB), 20 stringifies
  0.1.44               583 MiB all 3 runs, same counts, ~370-420 ms wall
                       (0.1.43 ~400-530 ms)
One request: direct 134, 0.1.41 569, 0.1.43 390, 0.1.44 275 MiB (with
id derivation stubbed out entirely: 229).
- HOME=$(mktemp -d) bun test in packages/workbuddy at this head:
  201 pass, 0 fail. bun scripts/check.mjs workbuddy: ok.
- Broken by hand, each red: free-only parsing again -> the free-only
  parse-count test; reply after tools put in by re-parsing -> the
  after-tools parse-count test; no surrogate hold -> the idFor pieces
  test; the reply put in before the system move -> sent.test.mjs.
gzip was measured too: Buffer.from before gzipSync made no difference
to the peak, so it is unchanged.

Not tried: a live WorkBuddy request; the reporter's Linux and Bun
1.4.4 (mote has 1.4.2); concurrency 4; a huge body that isn't ASCII
(Bun keeps it two-byte, so hashing it may copy); a huge Messages body
(its own path, not changed here).
2026-10-28 23:26:45 +08:00
yetone f4d48ac3ee workbuddy 0.1.43: a chat names the model's default effort as WorkBuddy's client does, and goes gzipped
troilus1011 on X: WorkBuddy's DeepSeek in OpenCode through magpie thought
at low and high, never at the default. OpenCode's default variant names
no reasoning_effort, and WorkBuddy doesn't think without one: measured on
www.workbuddy.ai with 0.1.42, deepseek-v4.1-flash gave 0 reasoning
tokens with no effort (2 of 2), 0 at none, 16/37 at low, 34/56 at high.
WorkBuddy's own client (CLI 2.165.0 in WorkBuddy 5.9.3,
configureThinkingSettings) sends the session's effort, else the
reasoningEffort setting, else the model's reasoning.defaultEffort from
/v3/config, which is "high" for this model on both builds. A chat that
names no effort now gets the model's own defaultEffort when its listed
levels hold it, read from the same cached /v3/config list (one read per
minute; a failed read leaves the chat as it came and is not retried on
every chat). An effort the client names, none included, is untouched and
the list isn't read for it. Models with no reasoning config get nothing.

runmiNeverstop on X: 2.89 GB up to copilot.tencent.com through magpie.
WorkBuddy's client gzips a model request's body (GzipRequestProcessor,
on with productFeatures.RequestBodyGzip, true in both builds'
product.json and not turned off by the remote config); the plugin sent
it as plain JSON. Agent chat JSON (the whole history each turn, tool
schemas) compresses several-fold, so the upload was several times what
the official client sends for the same turns. A chat-completions body
now goes gzipped with Content-Encoding: gzip on both builds;
unanswered() weighs the gzipped size against the front door's 2 MiB.
Claude's Messages route goes as it came (not tried gzipped live).

Run (on mote, HOME=$(mktemp -d) bun test in packages/workbuddy): 197
pass, 0 fail. bun scripts/check.mjs: exit 0. Fakes that parse the sent
body gunzip it (testdata/unz.mjs); reset.test.mjs's 2 MiB bodies are
random base64 so they stay over 2 MiB on the wire.
Live (www.workbuddy.ai, a real account in a sandbox HOME): with 0.1.43
the default sent reasoning_effort high gzipped and thought (34 and 51
reasoning tokens), none stayed 0, low and high as before, all 200. A
gzipped chat answered 200 the same as a plain one.
Broken by hand: origin/main's index.mjs with the new
default-effort.test.mjs: 5 of 8 red (default effort, failed-read reuse,
both gzip tests, defaultEffortOf); the 3 that pass guard what must not
change (named efforts, models without a default, Messages).
Not tried: a live chat on the China build (copilot.tencent.com answered
401 to every token available here, its /v3/config read fine); Messages
gzipped; the reporters' own OpenCode sessions end to end.
2026-10-28 22:23:20 +08:00
yetone f2b0dacdb7 workbuddy 0.1.42: a chat is parsed once on its way, and goes as it came when nothing changed (#461)
jihuayu measured a 45 MiB chat going through 0.1.41's fetch: each step
(withSystem, fitted, normalizeToolChoice, attend, the model, systemKey)
parsed the whole body again, 6 parses a request, and normalizeToolChoice
wrote it out whole even for an unchanged "auto". Bun's RSS reached 618-751
MiB for 4 serial requests where passing the body through took 270.

prepared parses a request once. Each step makes its own change to that one
object, in the same order (systemOn, fitTools, toolChoiceOn; unsignedOn
for Messages). attend, the model and the system key read the same object,
and a refused system prompt moves on it (systemAsUserOn). The body is
written out once, only when a step changed it. The parsed chat is let go
before the request is sent. A body a step throws on goes through the steps
one by one, as before. The string-level helpers stay as wrappers.

What was run, on this tree:
- mote, the reporter's benchmark (no network, fetch stubbed, 4 x 45.3 MiB,
  peak RSS sampled every 5ms): 0.1.41 7 parses/request, 1087.5 MiB parsed,
  peak RSS 1096 / 979 MiB. This change: 2 parses/request (the request and
  the stub's SSE reply), 181.3 MiB parsed, peak 682 / 680 MiB. The bodies
  sent have the same SHA-256 in both.
- HOME=$(mktemp -d) bun test packages/workbuddy on mote: 189 pass, 0 fail.
  bun scripts/check.mjs workbuddy: ok.
- oneparse.test.mjs (new): 17 chat shapes, invalid JSON and bytes come out
  the same as the steps one by one made them, with the same tool names; an
  unchanged chat goes byte for byte; the loader parses a 2 MiB chat once.
  Broken by hand: every request sent through the step-by-step fallback,
  the loader test FAILs (5 parses, want 1). An unchanged "auto" counted as
  a change, the byte-for-byte test FAILs.
- Real account (WorkBuddy AI, free-only on, sandbox HOME, this Mac):
  deepseek-v4.1-flash, a 373-byte chat and a 205,595-byte chat with a
  developer message, max_completion_tokens and a dotted tool name, through
  0.1.41 and this change: 200 "OK" on all four; no sign-in refreshed.

npm has 0.1.41, so 0.1.42 is free.

Reported-by: jihuayu
2026-10-28 18:46:03 +08:00
MYCF711andMYCF711 e460dae2f0 workbuddy 0.1.41: a package with no cycle total reads as a wallet balance (#450)
A WorkBuddy package with no CycleTotalCapacity is a prepaid wallet: it is sent as a balance window ("Prepaid credits", magpie#3950), beside the share of packages that have a total. A literal "0" total stays on the old path, so a lapsed package adds nothing; an account with no packages keeps its unknown allowance (no TotalCredits fallback).

Reviewed at 5bdfa9048d66095d35af5e7955d0945db02dc3b5 over four rounds. Run on mote at that head: HOME=$(mktemp -d) bun test packages/workbuddy, 185 pass / 0 fail; bun scripts/check.mjs workbuddy ok. npm had 0.1.40, so 0.1.41 is free.

Co-authored-by: MYCF711 <MYCF711@users.noreply.github.com>
2026-10-28 10:26:47 +08:00
yetone b2fe48ea2e workbuddy 0.1.40: chats carry the current desktop client's headers
WorkBuddy accounts are being restricted, and a report says WorkBuddy now
checks request-header fingerprints. Diffed the plugin's chat request
against each build's current desktop app, read (never run) from the
update feeds on 2026-10-28:
- China: WorkBuddy 5.9.3.42398134 (copilot.tencent.com/v2/update),
  bundled @genie/agent-cli 2.165.0.
- WorkBuddy AI: 5.8.4.41366630 (www.workbuddy.ai/v2/update), CLI 2.161.0.
The chat is the CLI's OpenAI client (openai 6.25.0) through
axiosToFetchAdapter, with UserAgentHttpInterceptor and the desktop's
CLIENT_INFO_* env (sidecar-manager getCachedBaseEnv).

What differed, and now matches:
- User-Agent: was WorkBuddy/5.5.6; the client sends
  "WorkBuddy/<app> <applicationName>/<app> CLI/<cli>":
  WorkBuddy/5.9.3 WorkBuddy/5.9.3 CLI/2.165.0 (China),
  WorkBuddy/5.8.4 workbuddy-ai/5.8.4 CLI/2.161.0 (AI). The /v3/config
  models call (was CLI/2.0.0 WorkBuddy/5.5.6) takes the same one, as the
  CLI's CloudProductProvider sends it through the same interceptor.
- X-IDE-Version: was 5.5.6; now the app's version.
- X-Agent-Type: main was sent on WorkBuddy AI only; the adapter sets it on
  every model call on both builds.
- X-Agent-Runtime: local-agent, new in 5.9 (the desktop's local transport
  puts agentRuntime local-agent in the prompt meta); China build only,
  5.8.4 has no such header.
- Accept: application/json and the OpenAI SDK's X-Stainless-* (Lang js,
  Package-Version 6.25.0, OS/Arch of this machine, Runtime node,
  Runtime-Version v22.21.1 = Electron 37.10.3's Node, Retry-Count 0,
  Timeout 1200); the adapter strips them only in its skip-auth mode.
- The desktop's own calls (billing, plugin API) send WorkBuddy/<app>;
  they now send the current app version instead of 5.5.6.

Not matched: X-Device-Token (TuringShield native SDK, sent since at
least 5.6.2), traceparent (only while server-side tracing is enabled),
and transport-level differences (Bun's fetch vs axios on Node: header
order, Accept-Encoding).

Run: HOME=$(mktemp -d) bun test packages/workbuddy: 184 pass, 0 fail.
With the old index.mjs the 4 changed tests fail (UA, IDE version,
config UA, the new per-build header test).
Not tried: a real account's chat or /v3/config with the new
User-Agent (unauthenticated /v3/config answers the same for old and new).
No text added names magpie or WorkBuddy's limits.
2026-10-28 03:20:46 +08:00
yetone 7f99447ed2 workbuddy 0.1.39: an earlier turn's reasoning_content goes as reasoning, as WorkBuddy's own client sends it
uk.jent on Discord: Grok Build's chat.completions history lost its
thinking on WorkBuddy. Grok Build 1.0.67 sends an earlier assistant
turn's thinking as reasoning_content; magpie and this plugin pass it
on byte for byte, and WorkBuddy drops it. WorkBuddy's own client
(CodeBuddy's agents converter, applyPendingReasoning) sets `reasoning`
on the assistant message and skips its reasoning_content backfill for
WorkBuddy's own hosts. The chat path now does the same: reasoning_content,
or reasoning_details' text, becomes `reasoning` (one the client set is
kept) and the original fields are left out. Nothing is folded into
content as <think>, since WorkBuddy's client doesn't send it that way.
The Messages route (Claude on the China build) is unchanged.

Run: packages/workbuddy `bun test` with a temp HOME (183 pass);
`bun scripts/check.mjs` all green. Live on www.workbuddy.ai (a real
WorkBuddy AI account, access token only, refresh left out), a codeword
in the earlier turn's thinking, asked for after the tool result:
before, reasoning_content reached no model (0 of ~15 across kimi-k2.6,
kimi-k3, glm-5.3, deepseek-v4.1-flash, minimax-m3) while `reasoning`
did on kimi-k2.6 and minimax-m3; through 0.1.39 a reasoning_content
history reached kimi-k2.6 2 of 8 and minimax-m3 4 of 9, with the
no-thinking control 0 every time. glm-5.3, kimi-k3 and
deepseek-v4.1-flash never quoted it in either spelling.
Broken by hand: index.mjs from origin/main: reasoning.test.mjs 4 of 4
red; with the asReasoning call commented out, its two end-to-end
tests red.
Not tried: the China build (copilot.tencent.com; its desktop sign-in
answered 401), and Grok Build end to end through WorkBuddy (its
request was captured against a fake server). The "thinking loop" the
report names wasn't reproduced; the plugin doesn't touch the reply
stream.
2026-10-27 23:36:41 +08:00
yetone 18268848d3 workbuddy 0.1.38: a "Free models only" switch that never spends credits (#430)
kongbai01203 asked for a hard stop on WorkBuddy credits: use only the free
models, and never let a paid one through by mistake.

Each site (workbuddy, workbuddy-ai) now declares a magpie plugin option,
free_only, "Free models only", off by default. With it on:
- models() lists only the models priced free now (priceOf: a model free only
  at night, or one with no price, is paid). A list that can't be read, or an
  API key WorkBuddy lists no prices for, is a failure, not the built-in list.
- fetch reads the model from the body and, unless /v3/config lists it as
  free, answers 404 model_not_found itself and sends nothing. The message
  has no quota words, so magpie's gateway rests that model only and falls
  through, not the account. A price list that can't be read answers 503 and
  sends nothing. The list is kept a minute per account for requests.
Off, nothing changes: the config isn't read on a request.

Run:
- HOME=$(mktemp -d) bun test packages/workbuddy: 179 pass (freeonly.test.mjs
  new, both sites); bun scripts/check.mjs: ok.
- Real accounts, sandbox magpie (HOME under the scratchpad, magpie
  wb-free-only branch, this package added by path): with the switch on for
  workbuddy-ai the list went 26 -> 2 (hy3, deepseek-v4.1-flash) within 2s,
  workbuddy (own switch) stayed at 19; gpt-5.4 got the 404 with nothing
  sent, hy3 and deepseek-v4.1-flash answered. Off: 26 again, gpt-6-luna and
  gpt-5.4 answered (no rest left on gpt-5.4).
Broken by hand: without the fetch check 4 tests fail; with onlyFree
returning every model 2 fail.
Not tried: the GUI switch itself (set through /api/settings/plugin-option);
the workbuddy (China) site's switch with a real request; Responses or
Anthropic bodies against the real API (the model is read the same way).
2026-10-27 17:26:51 +08:00
yetone 4bde462e21 workbuddy 0.1.37: sign in with an API key (#407)
Both builds offer "<build> API key" beside the browser and desktop
sign-ins, for a key made on the build's keys page
(www.workbuddy.cn/profile/keys, www.workbuddy.ai/profile/keys).

A key is sent as WorkBuddy's own CLI sends CODEBUDDY_API_KEY
(@tencent-ai/codebuddy-code 2.177.0, read as data): its API-key
session has the key as the access token, uid "anonymous_" + the key's
last 8 characters, personal, no domain, no enterprise; model requests
carry X-API-Key: <key> and Authorization: Bearer <key>
(getCustomHeaders). So a key's chat has those, X-User-Id
anonymous_<last8>, no X-Domain, and the client headers the other
sign-ins send, to the same host: copilot.tencent.com/v2 for workbuddy
(the CLI's endpoint for CODEBUDDY_INTERNET_ENVIRONMENT=internal; it
treats www.workbuddy.cn and copilot.tencent.com as front doors of one
API) and www.workbuddy.ai/v2 for workbuddy-ai.

The loader's apiKey "" and x-api-key delete stay: they keep the SDK's
own (empty) key headers off; sign() now sets X-API-Key itself for a
key account and never for an OAuth one.

- Models: /v3/config is asked with a key only for ck_/pt_ keys, as the
  CLI's shouldLoadRemoteConfig does; any other key keeps the built-in
  list.
- Usage: a key's card says the credits are unknown and asks nothing
  (the CLI reads no credits with a key; no endpoint guessed).
- A 401 on a key is never renewed or resent: it says the key was
  refused and where to check it, marked expired only on
  invalid_token. The >2 MiB reset probe doesn't ask the billing API
  with a key.

Run at this tree (base ac11dcb):
- apikey.test.mjs: 12 pass; against the old index.mjs 10 fail, the 2
  OAuth-unchanged tests pass.
- packages/workbuddy: HOME=<tmp> bun test, 167 pass 0 fail.
- repo: HOME=$(mktemp -d) bun test, 2760 pass 3 skip 0 fail;
  bun scripts/check.mjs exit 0.

Not tried: a real WorkBuddy API key.
2026-10-27 04:41:57 +08:00
MYCF711 213ef506c5 workbuddy 0.1.36: a free account's credits say when the plan refills (#415)
A free account's card says when the plan refills: with no subscription named, cycleOf reads the plan_base slice's cycle end (UTC+8). A summary that names a subscription still goes by it alone, and named-but-not-listed stays unknown.

By MYCF711. Reviewed at b8d600c9:
- `HOME=$(mktemp -d) bun test` in packages/workbuddy: 155 pass, 0 fail.
- The named-not-listed assertion fails on the PR's first head (b1ce408), which returned the slice's month end for a paid account; passes now.
- npm had 0.1.35; this is 0.1.36.
Not tried: a real WorkBuddy account (the fixture is the author's live CN reply).
2026-10-26 23:56:46 +08:00
yetone 9da5cd3426 workbuddy 0.1.35: used credits say when the plan's cycle starts again (windy on Discord)
windy's WorkBuddy card in magpie showed 46% of the credits used and,
beside it, "Not used yet". The Credits window had no resetsAt, and
magpie's card says "Not used yet" when no used window has a reset.
WorkBuddy's own client (5.5.6, getCurrentPlan) says the plan refreshes at
the cycle end of the package the summary names as the subscription
(SubscriptionPackageCode). cycleOf now gives the Credits window that
reset (CycleEndTime, UTC+8) and the cycle's span, from the paid and free
lists usage already reads for runsOutOf; none named, not listed or a
cycle already over leaves it unknown, as before.

Run: bun test in packages/workbuddy, sandbox HOME, fetch stubbed: 154
pass 0 fail. On the old index.mjs the two new tests fail (resetsAt
undefined; cycleOf's cases). bun scripts/check.mjs: workbuddy ok.
Real: the summary and paid list of a real WorkBuddy AI Pro account
(2026-10-26, read-only, no renewal) through the new code give Credits
89.2 / 2000, resetsAt 2026-10-28T16:40:52Z, span 30d-1s.
Not tried: a China-site (copilot.tencent.com) account: the desktop
sign-in on this machine is refused (401), so a CN free plan's
SubscriptionPackageCode wasn't seen; without one the card stays as it
was. magpie's card saying "Not used yet" beside a used window without a
reset is fixed in magpie itself.
2026-10-26 15:00:30 +08:00
yetone d248efa7a1 workbuddy 0.1.34: a free account's plan is "Free plan", not "Free" (#337)
Buger2008 read the "Free" beside their WorkBuddy account in Providers as
the model they picked (Deepseek-V4.1-Flash, 0.11x) being free, and as why
routing chose WorkBuddy first. It is the account's plan; routing doesn't
read it. The label now says it is a plan. Nothing in magpie or the plugins
compares a plan to "Free" (grepped internal/ and packages/).

Run: bun test in packages/workbuddy, sandbox HOME, network at a dead
proxy: 152 pass 0 fail; on the old index.mjs the 4 tests that say the
label fail. bun scripts/check.mjs: workbuddy ok.
Not tried: a real WorkBuddy account in the GUI.
Siblings: trae ("Free", d.plan || "Free") and mimo (plan "Free") say the
same; filed as their own issue.
2026-10-25 15:06:45 +08:00
yetone def6a83584 workbuddy 0.1.33: a oneOf of objects with no type reaches Kimi typed object (#378)
congee949 found that kimi-k3.1-pro on workbuddy and workbuddy-ai answers
400 "Invalid request parameters" to a tool whose parameters hold a oneOf
with no type. This happens even when every branch is an object, either as
a $ref's target or deeper in it (dsh's REA tools). The same request with
"type": "object" beside the oneOf gets 200, in three real dsh runs with
all 198 tools. fitTools now runs typeUnions after fitShape. typeUnions
gives such a oneOf type "object" when each branch is typed object, either
directly or through a chain of local $refs. A union of other or mixed
types, an anyOf, and a $ref that is missing, external or circular are left
as they came. Only schema keywords are walked, so examples and defaults are
not.

Tests use the issue's literal parameters: the minimal $ref → oneOf, the
nested oneOf that all three routes refused, and the REA $ref-branch case.
They also cover what is left alone.

Run: `bun test` in packages/workbuddy with a sandbox HOME/TMPDIR and a dead
HTTPS_PROXY: 152 pass, 0 fail. `bun scripts/check.mjs workbuddy`: ok.
scripts/try.sh with magpie origin/main 4dfd88206 lists workbuddy (15) and
workbuddy-ai (16). Broken by hand: with the typeUnions call taken out of
fitTools, tools.test.mjs goes 1 red; with $ref branches not followed, 1 red.
Not tried: a real WorkBuddy account. The rule is the one the reporter
verified on the live API.
2026-10-25 14:54:25 +08:00
7% ba343b84ea workbuddy 0.1.32: a Claude model is served on Messages, where effort (max included) is honored (#346)
WorkBuddy's China build serves its Claude models on Anthropic's Messages API (<endpoint>/v1/messages). A Claude model there is now `@ai-sdk/anthropic` and goes to Messages, where `output_config.effort` (max included) is honored. Every other model, and every WorkBuddy AI model, stays on chat. A Messages body goes as sent, minus thinking blocks with no signature, and goes once more without thinking when WorkBuddy refuses a signature it didn't make (11159). count_tokens goes on the Messages route too. One Claude Code send keeps one turn id (#48).

Reviewed at 9e0eb2b (rebased on main ba9801c; workbuddy unchanged from the 39f71a7 the author answered the last review with), by @waynesguan.

Run at 9e0eb2b, sandbox HOME and TMPDIR:
- packages/workbuddy `bun test`: 149 pass, 0 fail. Run again with HTTP(S)_PROXY pointing at a dead port: 149 pass, so no test reaches the network.
- `bun scripts/check.mjs workbuddy`: ok.
- Broken by hand: BAD_SIGNATURE that never matches turns "a signature WorkBuddy didn't make is refused once…" red; isMessages without count_tokens turns "count_tokens is a Messages request" red.
- Read: magpie's provider/plugins.go takes `firstOf(o.BaseURL, m.URL, …)`, so the loader's empty baseURL falls back to each model's api.url (/v1 for Claude, /v2 for chat).
- magpie origin/main 4dfd88206's plugin host, sandbox HOME (scripts/try.sh): the package adds, workbuddy lists 15 models and workbuddy-ai 16.

Not tried against the real API here: the sandbox has no WorkBuddy account that can reach a Claude model. The author's replays with a real account (empty text block 200, signature binding table) are what the 11159 handling rests on.
2026-10-25 14:22:40 +08:00
yetone f658842089 workbuddy 0.1.31: a 401 is renewed once and sent again; a refused sign-in says to sign in again
wenchen855443 on X: with WorkBuddy as the provider, requests return 401.
Until now a chat 401 was passed on as WorkBuddy's HTML APISIX page with
X-Magpie-Sign-In: kept. A token is renewed only near its end, and a
browser sign-in's token lasts about 340 days. So a token WorkBuddy
refused before then was sent again on every request, for months.
Nothing renewed it and nothing told the user what to do.

What changed (packages/workbuddy/index.mjs):
- A chat or usage summary answered 401 is renewed once, whatever the
  token's time, then sent once more. The request body is sent as it
  was, and only a body that can be resent is retried. The first 401's
  body is cancelled. A second 401 is never renewed.
- Before spending the refresh token, a newer token another process saved
  (getAuth) is taken first. This is also checked after a refused refresh,
  for the case where another process spent the refresh token at the same
  moment (part of plugins#332).
- A desktop sign-in never spends the app's refresh token here. The plugin
  drops the token it held, reads the app's file again, and retries only
  if the token there changed.
- When there is no new token, or the retry is refused too, the plugin
  answers 401 with authentication_error. The message names why ("it
  refused the refresh token too (…)", "there is no refresh token to renew
  it with", "it refused the token renewed for it too") and says where to
  sign in again: Providers → WorkBuddy [AI] → this account's Sign in again,
  or WorkBuddy desktop for a desktop sign-in. The >2 MiB ECONNRESET note
  stays in that message.
- readDesktop marks its result source: "desktop". Before this,
  unanswered's desktop wording could never show.

Marking the account expired:
- The plugin sends X-Magpie-Sign-In: expired (usage: signIn) only when
  WorkBuddy itself says the sign-in is gone:
  - the refresh token was refused (HTTP 401 / invalid_grant);
  - the access token was refused with WWW-Authenticate error=
    "invalid_token" and no refresh token was left, or one had ended;
  - a just-renewed token was refused with invalid_token.
- Why mark it at all: a marked account leaves routing, so the user's
  other accounts serve; the row says to sign in again; and a dead
  account stops spending a refresh on every request.
- Why not on every 401: WorkBuddy answers some paths with a bare 401
  even for a good sign-in (magpie's workbuddy_checkin_test). A refresh
  that fails for another reason (5xx, network) also leaves the account
  as it is.
- A desktop sign-in is never marked: the app's file is read on every
  request, so signing in to the app again fixes it.
- A success after a renewal sends "renewed", which clears a mark.
- auth.refresh (refreshed()) still never marks the account, because a
  refresh token spent by another process there could read as refused.

What WorkBuddy does (www.workbuddy.ai, 2026-10-23, the owner's real
workbuddy-ai sign-in copied into a sandbox HOME):
- Chat with a wrong or garbage token: 401, HTML APISIX page,
  WWW-Authenticate: Bearer realm="copilot", error="invalid_token".
- Chat with an empty token: 401, no WWW-Authenticate.
- The meter: the same 401. /v3/config: 200 to a bad token.
- Refresh with a wrong refresh token: HTTP 401 {"code":12153,"msg":"12153:
  refresh token failed:400 Bad Request: invalid_grant: Invalid refresh
  token"}. With garbage: 401, code 12153 "token format error".
- A real refresh: 200; both tokens rotate, and both expiries are about
  340 days out.
- The old access token still answered 200 after the refresh.
- The rotated tokens were written back to the live plugin-auth.json under
  its lock (temp + rename, only workbuddy-ai's entry changed). The live
  gateway answered workbuddy-ai/deepseek-v4.1-flash with 200 afterwards.

Run at this tree (652f06d + this change):
- HOME=$(mktemp -d) bun test: 2329 pass, 0 fail, 197 files.
- bun scripts/check.mjs: ok.
- New unauthorized.test.mjs (12 tests): renew then 200 (renewed, saved,
  new Bearer); refresh refused → sign in again, expired; transient refresh
  failure → kept; no second renew or retry; no refresh token
  (expired with invalid_token, kept on a bare 401); a token another
  process saved is taken; desktop re-read and never marked; usage renew;
  usage refused → expired.
- Existing tests that pinned the old pass-through were updated:
  signin.test.mjs, usage.test.mjs, reset.test.mjs.

Broken by hand:
- With origin/main's index.mjs, all 12 new tests are red.
- Without the renewed guard: the "isn't renewed twice" test goes red.
- With gone() always false: the 3 marking tests go red.
- Without the newer() check: the 2 "another process saved" tests go red.

Not tried:
- Reusing an old refresh token after rotation, which risks revoking the
  owner's session. Whether WorkBuddy refuses it, or revokes the session,
  is unknown.
- The China build (www.codebuddy.cn) was not probed for a real 401.
- A desktop sign-in with real accounts.
- The reporter's case is unknown: their site, their sign-in kind, and the
  401's body. So is what revokes a WorkBuddy access token before its end;
  a refresh by another process does not.
2026-10-23 22:13:05 +08:00
yetone 575f1e23e7 workbuddy 0.1.30: a refused line quoted back into an assistant message is reworded there too (#291)
tearslee measured on 0.1.29 that the "Web GUI whose URL the runtime
context names. When the user refers" line is refused as 11128 in an
assistant message, where the system-prompt move can't reach it, so a
long DeepSeek Harness chat stays refused for good. Its wording "...
names. The interface, when the user refers" went 400 -> 200 for them.
It joins FLAGGED, which unflag applies to every message, assistant
ones included. The README now says the move doesn't cover an assistant
message and that only a new chat clears words not in the list.

Run: bun test in packages/workbuddy (sandbox HOME), 112 pass; the new
test covers a string and a parts assistant message and a line break
between the sentences.
Not tried: the 400 itself. A short probe with the line through magpie
got 200, so the refusal needs more of the chat than I have; the 400 ->
200 is tearslee's measurement.
2026-10-23 09:31:24 +08:00
yetone af360a529d workbuddy 0.1.29: a system prompt refused as an unapproved channel goes again as the user's instructions
Wing on Discord (10-21) got 400 11128 "Illegal API invocation from an
unapproved channel" from an agent we couldn't name, and so did others
(miaopasi; itsuki with dsh). FLAGGED rewords the lines we've met, so any
agent with a line not met yet is refused.

What WorkBuddy checks (real accounts on both builds, 2026-10-21, CN
glm-5.3 / deepseek-v4.1-flash, AI gpt-5.5 / glm-5.3):
- Only system and assistant messages are checked. Each refused line
  (Claude Code's identity line, "Main branch (you will usually use this
  for PRs): main", DeepSeek Harness's opening) was served as a user
  message, as a user message's parts and as a tool result, and refused
  again in the system message or an assistant message.
- An identity line is refused only at the start of a message (a leading
  space or "Hi.\n" passes; the line at the end of omp's 10.5K prompt
  passes). It is matched case-insensitively. "Main branch ..." is refused
  anywhere. Whitespace must match exactly: a double space or a ZWSP
  passes.
- With no system message, the AI build answers 11128 "first message is
  not system prompt".

The change: on that refusal, the chat is sent once more with its system
prompt moved into the first user message, inside <instructions> tags,
and "You are a helpful assistant." as the system message. A later system
message becomes a user message where it stands. The refused system prompt
is remembered (up to 256), so that agent's next chats go moved without a
refusal first. FLAGGED stays, so lines we know still go as system. A
refusal that stands after the move still ends in REFUSED_HINT with
X-Magpie-Sign-In: kept, so no account is rested. The added text names no
one.

Run, with FLAGGED emptied in a copy so that only the move could pass:
- probe, the plugin's fetch with real accounts: the CC, Main-branch and
  DeepSeek Harness lines each went 400 then 200 on CN glm-5.3, CN
  deepseek-v4.1-flash, AI gpt-5.5 and AI glm-5.3. The second chat with
  the same prompt was 200 at once.
- OpenCode 2.0.25 on workbuddy-ai glm-5.3 with an agent prompt opening
  with Claude Code's line. Bridge log:
    upstream 400 sys: "You are Claude Code, Anthropic's offici
    upstream 200 sys: "You are a helpful assistant." next: user <instructions>...
  It added power() to calc.py with tool calls.
- omp 18.9.1 on workbuddy deepseek-v4.1-flash with --system-prompt
  opening "You are an AI agent powered by DeepSeek Harness" and holding
  the Main-branch line: one 400, then four 200s moved. It added divide()
  with a zero guard and ran it.
- HOME=$(mktemp -d) bun test in packages/workbuddy: 111 pass, 0 fail.
  bun scripts/check.mjs: ok.
- systemasuser.test.mjs uses WorkBuddy's literal 11128 body. Run against
  the 0.1.28 index.mjs, 7 of its 9 tests fail; the other two are guards
  that nothing is sent again.

Not tried: Wing's own agent (unknown; "omp" by the name is a Discord
server tag), dsh on the CN build through the move, and how well each
model follows instructions from the user turn over a long session. They
followed them in the runs above.
2026-10-21 18:28:06 +08:00
yetone 3fd9625ae3 workbuddy 0.1.28: the "unapproved channel" hint names no one client, not only Codex and Claude Code (#279)
WorkBuddy's 11128 "Illegal API invocation from an unapproved channel"
ended in "WorkBuddy refuses chats from Codex and Claude Code (their system
prompt); ...". DeepSeek Harness's and Claude Desktop's chats are refused
the same way (#279, #170), and Codex's and Claude Code's words are already
reworded by FLAGGED, so the hint blamed the wrong clients. It now reads:

  WorkBuddy refused words in this client's prompt (most often its system
  prompt); use it from Hermes, OpenCode or Pi, or add another provider to
  this group

"Prompt" rather than only "system prompt", as WorkBuddy reads every
message (Claude Code's main-branch line was in its first user message).
magpie's Routing page (WB_REFUSED in its routing client.js) has the same
text word for word in the same change, so it still says the hint apart
from WorkBuddy's own words.

Run: HOME=$(mktemp -d) bun test from the repo root: 2012 pass, 0 fail.
bun scripts/check.mjs: exit 0. With index.mjs put back to HEAD's,
refused.test.mjs's "the hint is magpie's word for word, and blames no one
client" fails (Expected the new text, received the old); restored, 14 pass.
2026-10-21 08:20:02 +08:00
yetone 6fd976abae workbuddy 0.1.27: DeepSeek Harness's identity line is reworded, not refused as 11128 (#279, #280)
Run on origin/main 82452c5: HOME=$(mktemp -d) bun test in packages/workbuddy
101 pass 0 fail; bun scripts/check.mjs workbuddy ok.
2026-10-21 00:42:18 +08:00
yetone 68170b3ebe workbuddy 0.1.26: a model that says only supportsReasoning and a default effort lists low, high, max and that default (#255)
kylesean (#255): fast-model, balanced-model, primary-model,
deepseek-v4.1-flash(-sg), gemini-3.5-flash, kimi-k3 and kimi-k2.6 carry
supportsReasoning: true and reasoning.effort in /v3/config, but no
reasoning.supportedEfforts, so they were listed with no levels and as not
reasoning. effortsOf gives such a model low, high and max plus its own
default, in order. All eight are onlyReasoning, so none gets "none".
Models that list their efforts are unchanged.

The fixture is WorkBuddy AI's own /v3/config read today (descriptions
left out). Under a real WorkBuddy AI account, low, high and max were
answered 200 with reasoning on fast-model, deepseek-v4.1-flash-sg, kimi-k3
and gemini-3.5-flash; the other four weren't tried.

Run (sandbox HOME):
- HOME=$(mktemp -d) bun test packages/workbuddy: 101 pass, 0 fail
- bun scripts/check.mjs workbuddy: ok; git diff --check clean
- Broken by hand (effortsOf back to supportedEfforts only): efforts.test
  goes red.
2026-10-20 18:15:22 +08:00
yetone ab38da681a workbuddy 0.1.25: WorkBuddy AI's "x0.34 credits" rates are read, not unknown (#216)
WorkBuddy AI's /v3/config gives fast-model, balanced-model and
primary-model their credits as "x0.34 credits", "x0.59 credits" and
"x3.31 credits". 0.1.24 read those as unknown, so the three had no rate.
0.1.25 carries c89cee5 (#216).

Run on c89cee5 + this bump: packages/workbuddy HOME=<tmp> bun test 99 pass
0 fail; bun scripts/check.mjs ok. The full repo run is in c89cee5's body.
2026-10-19 06:33:37 +08:00
yetone 9a4ec8600c workbuddy 0.1.24: a refused sign-in on a request over 2 MiB says the 401 and to sign in again, not ECONNRESET (wyp on Discord)
wyp's WorkBuddy AI requests worked for a while, then every turn failed as
"502 WorkBuddy AI: ECONNRESET: The socket connection was closed
unexpectedly". Measured on www.workbuddy.ai and copilot.tencent.com: the
front door answers a token it refuses with 401 only for a body up to
2097152 bytes. At 2097153 bytes and above it resets the connection with no
reply. With an accepted token, 20 MB bodies go through, and app errors
(400 11128) still come back on big bodies. So once a long Claude Code
session is past 2 MiB and the account's sign-in is refused, every turn is a
reset, and nothing about it is temporary.

Keep-alive reuse was ruled out: the server closes an idle connection with
a FIN at 60s, and Bun opens a new connection for requests at 59.99s and
59.995s.

When a chat over 2 MiB fails before any reply, the loader now asks the meter
(POST /billing/meter/get-user-resource-summary, 401 for a refused token) once.
On a 401 it returns that 401 with the reason and the remedy (sign in again,
in magpie or in the desktop app), marked kept like the plugin's other 401s.
Any other answer, a failed meter read, or an abort leaves the original
error. The chat is never sent again.

Run: HOME=<temp> bun test in packages/workbuddy: 97 pass (reset.test.mjs is
a socket fake of the front door that resets past 2 MiB). Broke it by hand
(unanswered rethrows at once): 3 of the 5 new tests go red. bun
scripts/check.mjs workbuddy: ok. Against the real endpoint in a sandbox
HOME: refused token + 2.2 MB body gives 401 with the message (0.1.23:
ECONNRESET); refused short chat gives the front door's HTML 401; good
token + 2.2 MB body gives 200. Not run: magpie's gateway end to end with
this version. Why wyp's token was refused is not yet confirmed.
2026-10-15 17:25:38 +08:00
yetone ec8ae09cc8 workbuddy 0.1.23: credits used up leave the free models counted out, so magpie doesn't put the account last for deepseek-v4.1-flash (#138, hheei)
WorkBuddy serves a model at x0.00 (deepseek-v4.1-flash) with the account's
credits used up: hheei's account at 560 / 560 was still served it. The
usage read gave one Credits window over every model, so at 100% magpie's
routing ranked the account spent for its free models too: put behind every
other account, and moved off by conversation affinity.

The Credits window (personal and enterprise) now carries notModels: the
ids the account's live list (/v3/config) prices at x0.00. A model free only
some hours (a night promotion) still counts, as the list never says it is
free. A list that can't be read leaves the window as before. magpie reads
notModels as it does for Devin's and Cursor's windows (Limit.applies), so
For(free model) no longer sees the full window, and a 14018 on a paid model
rests only that model (Pooled), as PaidBesideFree already did.

Run: HOME=<temp> bun test in packages/workbuddy: 92 pass. Broke it by hand
(no notModels set): the two new usage tests go red. bun scripts/check.mjs
workbuddy: ok. Not tried against a real account at 100% credits; the
behaviour that free models are still served there is the reporter's.
2026-10-15 13:11:46 +08:00
yetone a6bed5ec54 workbuddy 0.1.22: an MCP server's tool schemas reach Kimi and DeepSeek, not 400 11133 "Invalid request parameters" (#122, clearmann)
Cause: Kimi's tool-schema check (kimi-k3-1, also kimi-k2.7) turns away
schemas that MCP servers and plugins commonly send, with 400 11133
"the request parameters were rejected by the model provider". It is
the request's content, not the account: on the owner's China account
each shape alone in an otherwise plain chat failed every time, and the
same chat with it mended passed. Shapes refused: an enum with no type
(all strings too, under items, anyOf, an unused $defs), an empty enum,
an enum whose type lists two types besides null, true/false where a
schema goes (properties.x, items), a required that isn't a list, and an
unknown type ("any", "String"). Claude Code's own 24 tools have none of
these, which is why tool-less side requests passed for the reporter.

fitShape walks schema positions only (a property named enum or type is a
name) and gives each the shape Kimi takes, meaning the same: an untyped
enum takes its values' type, or [T, "null"]; several types become an
anyOf of typed enums; true is {}, false is {"not": {}};
additionalProperties booleans are left. An empty enum (which nothing
fits) is left out. It runs for every model, as fitTools already does.

WorkBuddy 5.5.6's own CLI (codebuddy.js, read-only) only cleans schemas
for Gemini and only drops temperature for kimi-k3, so it would hit the
same 400 with such an MCP tool.

Ran, real account (China build, plugin loader fetch, old vs new):
- 14 refused shapes on kimi-k3-1: each 400 11133 before, 200 after.
- one MCP-like tool holding all of them: kimi-k3-1 and kimi-k2.7 400
  11133 -> 200; deepseek-v4.1-flash and deepseek-v4-pro 400 11129 ->
  200; glm-5.3 400 11133 -> 200; minimax-m3 and hy3 200 both.
- HOME=$(mktemp -d) bun test in packages/workbuddy: 89 pass; the new
  tests go red (4 fail) with the fitShape call taken out.
- bun scripts/check.mjs: ok.
Not tried: WorkBuddy AI (international) models, and a real MCP server
through Claude Code end to end. glm-5.1 answers 11150 to every chat on
this account (unrelated, also before).
2026-10-14 21:15:24 +08:00
yetone 15d16f5ff0 workbuddy 0.1.21: a model free only at night is never said free; a whole-day discount shows the price before it (#121)
WorkBuddy's /v3/config prices a model by its "credits" and by a
modelPromotions list the picker reads for its badges: Hy3 限时免费 (whole
days to 10-31), Step-5-Preview 独家限免 (10-12..10-25), Hy4 preview 夜间免费
(free 23:00–8:00 only), GLM-5.2 and DeepSeek 夜间折扣. The plugin read only
"credits", and magpie keeps a plugin's model list until it next asks, so a
list read at night said Hy4 preview was free all day (#121's screenshot:
免费 in magpie, 0.29x and 夜间免费 in WorkBuddy).

priceOf now reads both. A model under a promotion with daily hours is given
at its full price and never as free (unpriced when the credits read 0 under
a night discount). A running whole-day discount is the price now, with the
credits before it as rateWas, which magpie already shows struck through.

Run:
- bun test across the repo (TMPDIR+HOME in the scratchpad): 1219 pass. The
  new price.test.mjs, built from the promotions copilot.tencent.com gave on
  2026-10-14, fails 3 on the old code.
- The owner's real WorkBuddy and WorkBuddy AI accounts through liveModels
  (17:10 CST): Hy4 preview 0.29, Hy3 and Step-5-Preview free, the rest at
  their credits, matching WorkBuddy's picker.

Not tried: the config as served at night (whether "credits" itself reads
x0.00 then); the unpriced branch covers that case.
2026-10-14 17:16:39 +08:00
yetone a4f81786a7 workbuddy 0.1.20: tool results followed by the user's message reach WorkBuddy AI's gemini-3.8-flash (#113)
WorkBuddy AI's gemini-3.8-flash answers 400 code 11153 "the conversation
must end with a user message" to a chat whose tool results are followed by
a user message. magpie sends exactly that for Claude Code's tool_result
plus reminder text, a user's words typed mid-task, and a tool's images, so
Claude Code on that model failed on its first tool result (wuasakura).

The loader now sends such a chat again with an empty assistant message
between the results and the user's message, and does so up front for a
model that refused it once in this run. Any other refusal, and a chat
ending with the assistant's message (a prefill), passes on as before.

Verified with the owner's real WorkBuddy AI account (direct to
www.workbuddy.ai through the plugin's loader):
- 17 models with tool results then a user message: only gemini-3.8-flash
  refuses (11153); the rest serve it.
- On gemini-3.8-flash: tool->user, tool->user(parts), two tools->user,
  tool->user->user and tool->user(image) are refused before, served after.
  With the empty assistant message the model follows the user's ask ("Red
  PINEAPPLE"); folded into the tool result instead, it ignored the ask, so
  folding was not used.
- Through magpie's gateway (main eb0d5750f, nogui build, sandbox HOME, the
  local package added): a Claude Code-shaped /v1/messages request
  (tool_result + system-reminder text) gave "WorkBuddy AI: the conversation
  must end with a user message" with 0.1.19's index.mjs, and "3 PINEAPPLE"
  with this one.

Tests: HOME=$(mktemp -d) bun test in packages/workbuddy, 80 pass; bun
scripts/check.mjs workbuddy passes. aftertools.test.mjs: with 0.1.19's
index.mjs the retry and up-front tests fail (Expected 200, Received 400);
with the remembering removed, the up-front test fails.

Not tried: WorkBuddy (China), whose model list has no Gemini.
A prefill to gemini-3.8-flash is still refused with the same 11153.
2026-10-14 13:14:32 +08:00
yetone 169e4e607c workbuddy 0.1.19: an enterprise account's card shows its credits, from the enterprise meter WorkBuddy's usage page reads (magpie #1904, CnsMaple)
An enterprise (team) account's /billing/meter/get-user-resource-summary
answers with an empty Packages list, so the card had no window and no
error ("暂无额度数据"). WorkBuddy's own usage page reads
/billing/meter/get-enterprise-user-usage for such an account, which
answers credit / limitNum and the cycle's start and reset (UTC+8).

auth.usage now asks the enterprise meter when the summary gives no
credits, and shows a Credits window of credit used of limitNum, resetting
at cycleResetTime, with span from cycleStartTime; plan "Enterprise" when
the sign-in has none. A personal account's refusal of that meter (400
10001 "uid or enterpriseID is empty", seen on a real WorkBuddy AI account)
leaves the card as the summary said. An account with packages never asks
it.

Run: HOME=$(mktemp -d) bun test (1172 pass), bun scripts/check.mjs.
The new enterprise test uses the reporter's two answers byte for byte;
with the fallback turned off it fails (no window, plan Free). A real
personal WorkBuddy AI account's usage read through this index.mjs is
unchanged (same window, no enterprise request). Not tried with a real
enterprise account: none here.
2026-10-13 11:39:45 +08:00
yetone 9814cca34d workbuddy 0.1.18: a desktop sign-in WorkBuddy 5.6+ keeps encrypted says so and points to the browser sign-in, not "isn't signed in" (#18)
seavenlin on #18: on WorkBuddy desktop 5.8.1 the tokens in
workbuddy-desktop[-ai].info are sealed ({$wbEncrypted: 1, envelope}), so
the desktop sign-in failed as "isn't signed in" while the app was signed
in, and one made before the app sealed it fell back to the built-in list
and its chats failed.

The sealed tokens are not opened (only the app opens them; #18's way of
running the app's binary to take its key is declined). Sign-in, usage and
chats now say the app keeps its sign-in encrypted and to use the browser
sign-in. The app's file is still only read.

Run: the new test fails on the old index.mjs and passes here; HOME=$(mktemp
-d) bun test for the repo, 1155 pass 0 fail; bun scripts/check.mjs green.
Not tried with a real WorkBuddy 5.8.1 install; the file shape is the one
in #18 and seavenlin's comment.
2026-10-13 04:46:47 +08:00
yetone caf3908eff workbuddy 0.1.17: a restricted account's 403 11140 says it is restricted, so magpie rests it for hours (magpie #1849)
WorkBuddy answers an account it restricted for "unusual activity" with
403 {"code":11140,"msg":"request illegal","displayMsg":{...}}. explained()
let it through as it came, so magpie saw "request illegal" and retried
the account every few minutes.

explained() now knows the restriction by its code 11140 (top level, under
data or error, number or string, matched whole so 111400 isn't it) or by
its displayMsg words, and ends the message with RESTRICTED_HINT, word for
word magpie's provider.WBRestrictedHint. magpie's routing rests an account
whose error carries that hint for 2h and tells it as restricted, with the
appeal as the way back. type permission_error, code 11140; the sign-in is
kept.

Run: HOME=$(mktemp -d) bun test (1148 pass, 0 fail), bun scripts/check.mjs.
refused.test.mjs uses the reporter's literal body. With detection removed
by hand, 2 of the new tests went red. Not tried against a real restricted
account.
2026-10-13 02:32:10 +08:00
yetone cb9093181d workbuddy 0.1.16: WorkBuddy AI's GLM models are text-only, so magpie's image-describing model reads their images (Yirasumi on Discord)
What: for the workbuddy-ai provider only, a model whose id starts with
glm- is listed without image input (capabilities.input.image and
attachment false), whatever /v3/config's supportsImages says.

Why: checked on 2026-10-13 with a real WorkBuddy AI account. Its
www.workbuddy.ai/v3/config marks every model supportsImages: true, but
an image sent to glm-5.3-flash, glm-5.3 or glm-5.2 is taken out by the
server and replaced with "[System reminder: the current model does not
support images. Content filtered. ...]". Its other models
(deepseek-v4.1-flash, kimi, gemini, grok, gpt) read images, and WorkBuddy
(China, copilot.tencent.com)'s glm-5.3-flash does too. Listed as taking
images, magpie sent them straight through and the model never saw them;
listed text-only, magpie's image-describing model reads them first. A
user who set the model's image support by hand in magpie keeps it
(magpie's ModelImages setting is applied over the provider's list).

Scoped by site (SITES["workbuddy-ai"].noImages = /^glm-/) and family,
not a list of three ids, so a later GLM on WorkBuddy AI is covered.

Run: TMPDIR=<scratch> HOME=<scratch>/home bun test in packages/workbuddy:
68 pass. The new test fails on the old index.mjs (glm-5.3-flash listed
with images). bun scripts/check.mjs green. Not run: a live chat through
the plugin with an image (the account check above was done before this
change).
2026-10-13 01:48:32 +08:00
YuCreate 80bd2d9241 workbuddy 0.1.15: normalize chat request fields (#96) 2026-10-12 20:26:02 +08:00
yetone f0274d69f7 workbuddy 0.1.14: the Credits window says when the soonest credits left run out (runsOutAt, runsOut), for magpie's smart routing to spend those first (cdredfox on X)
cdredfox: with several WorkBuddy accounts in one smart routing group, the
account whose credits expire soonest should be used first. WorkBuddy's own
client lists each package with its end (the billing page's paid and free
package lists); the plugin now reads them too.

- /billing/meter/get-user-resource-paid-packages and -free-packages, asked
  as the client asks: PageSize 200 up to 10 pages, Status [0,3], its
  COMMODITY_CODES (without them the API answers 10001 "PackageCodes
  required"), NeedRenewInfo / today's SlicePeriod (UTC+8).
- A package's end is DeductionEndTime, else ExpiredTime, else CycleEndTime
  read as UTC+8 (the API's own DeductionEndTime for the same package says
  so). Only packages the summary counts, with credits left; the daily Free
  Plan slice (CapacityType 4, code 001) is left out, since it ends at the
  same midnight on every account.
- The soonest end goes on the Credits window as runsOutAt (RFC 3339) and
  the credits lost then as runsOut. A list that can't be read leaves both
  out; the card stands as before.

Run: HOME=<tmp> bun test in packages/workbuddy, 63 pass (3 new); with
index.mjs back at 0.1.13, 2 of the 3 new go red. Tried live on a real
WorkBuddy AI account: packagesOf + runsOutOf gave the Bonus Pack's 232.4
credits ending 2026-10-12T16:39:27Z, before Pro's 10-28T16:40:52Z, with
the Free Plan slice left out. Not tried on a CN workbuddy account (its
stored token here is stale); the paths and body are the same on both.
2026-10-11 19:39:13 +08:00
yetone 00b06db784 workbuddy 0.1.13: an enterprise account lists and uses the enterprise's models, not the personal plan's (#75, seavenlin)
WorkBuddy answers as the personal account unless a request names the
enterprise. Its own client (codebuddy.js in WorkBuddy.app: the auth
interceptor and buildAuthHeaders) sends X-Enterprise-Id and X-Tenant-Id,
both the account's enterpriseId, on every request; the plugin sent
neither, so /v3/config gave the personal plan's list.

- A browser sign-in keeps the enterpriseId /login/account names. When it
  names a non-personal type without one, the id is taken from
  /v2/plugin/accounts the way the client's mergeCurrentAccountDetails
  picks (same uid and type, else the one last signed in to).
- Desktop's sign-in reads account.enterpriseId from the app's file.
- sign() (chats, /v3/config), the usage meter and the token refresh carry
  the two headers; a personal account sends none.

Run: HOME=<tmp> bun test in packages/workbuddy, 60 pass (6 new). With the header
loop and the sign-in lookup removed by hand, 4 of the 6 new tests go red.
Not tried against a real enterprise account (none here); the field names
are the ones WorkBuddy's own client reads.
2026-10-10 17:53:36 +08:00
yetone 17e75329b1 workbuddy 0.1.12: a chat's tools get shapes WorkBuddy AI's models take, so ZCode's and DeepSeek Harness's chats on deepseek-v4.1-flash aren't 400 "Invalid request parameters" (wyh on Discord)
WorkBuddy AI answers 11133 "Invalid request parameters" (the model
provider rejected them) when a tool's parameters or name are of a shape
its model turns away. Tried on the owner's account through magpie:
deepseek-v4.1-flash and -sg refuse each of a pattern's \0, a root anyOf,
parameters with no type, empty parameters, a tuple's items, and a name
holding . : / a space or CJK; Kimi, GPT, Gemini and GLM refuse some;
MiniMax none. Every client protocol reached the same error, so it is the
tools, not the protocol.

fitTools now gives each the shape that passes: an object root (unions
merged as magpie's provider.ObjectRoot does), \0 as \u0000, a tuple's
items as one anyOf, and a safe name, with the model's calls named back in
JSON and streamed answers and the history's calls named as sent. A clean
chat goes as the same bytes.

Run: HOME=$(mktemp -d) bun test packages/workbuddy (54 pass), bun
scripts/check.mjs workbuddy; through a sandbox magpie gateway with this
package, deepseek-v4.1-flash, -sg, glm-5.3, gpt-5.4, gemini-3.5-flash and
kimi-k3 answer 200 to every shape above (400 before), and an Anthropic
Messages call of a tool named fs.read, streamed and not, comes back as
fs.read. wyh's own ZCode/DeepSeek Harness tool set was not seen.
2026-10-08 17:39:00 +08:00
tearsleeandtearslee 5d1beb37e0 workbuddy: one user send, one X-Conversation-Request-ID (#48)
WorkBuddy's backend counts a user send as one request by
X-Conversation-Request-ID. The China build was sent no conversation headers
at all, and the international build a new pair on every request, so one send
that takes several steps — a tool result sent back, a retry, another account
answering — was counted as a request of its own: one conversation showed up
in the usage detail as many requests.

The ids are now made as workbuddy2api's fix makes them: the turn's from the
body's last user message (its place and its signature, a tool result's part
left out), the conversation's from the session magpie or OpenCode names —
the chat.headers hook now carries it — else from the chat's first user
message; nothing is made up when neither names one. The message and request
ids stay each request's own, and both builds carry the ids now.

Co-authored-by: tearslee <16331052+tearslee@users.noreply.github.com>
2026-10-08 16:41:53 +08:00
midasandyetone ac3b697e5b workbuddy 0.1.10: explain credits exhausted (code 14018) errors with hint and extract nested error message (#25)
* workbuddy 0.1.10: explain credits exhausted (code 14018) errors with hint and extract nested error message

When calling WorkBuddy / WorkBuddy AI models (including 0-rate / free models), accounts with no active packages or depleted credits receive 429 code 14018 ('Credits exhausted...').

- Extract nested error message from v?.error?.data?.msg and v?.data?.msg
- Match code 14018 on parsed fields (error.data.code, code, error.code) or 'code':14018 to avoid false positives on requestId/timestamps
- Append EXHAUSTED_HINT explaining that WorkBuddy requires an active credit package even for 0-rate free models
- Return standard OpenAI-shaped { error: { message, type: 'insufficient_quota', code: 14018 } }
- Add tests in refused.test.mjs covering code 14018, error.data.msg extraction, and untouched pass-through of unrelated errors with 14018 in requestId

* workbuddy 0.1.10: match code 14018 whole, so a code that only begins with it (140185) passes through instead of resting the account as out of credit

---------

Co-authored-by: yetone <yetoneful@gmail.com>
2026-10-07 18:47:32 +08:00