SlouchyQuill507 (Discord, qoder-cn) reported Qoder failures of the model's
own vendor, "Error in upstream response", reaching magpie as a 400 invalid
request: the client's fault, never asked again or of another account.
failure() now maps a message saying "Error in upstream response" to a 502
(no X-Magpie-Sign-In, the account untouched), after the queue, quota and
request codes, so a 400 with one of Qoder's request codes (406, 416, ...)
and any other 400 stay 400. It covers an HTTP 400 and a 400 in the
stream's statusCodeValue envelope, JSON or plain text. magpie still tells
an overflow that fails this way apart by its size (tooLongUnsaid takes 502
as well as 400).
Test: usage.test.mjs "Qoder's 400 \"Error in upstream response\" is a
502" - fixtures from the reported literal text, four shapes through the
loader's fetch, plus genuine 400s kept. Red on the old index.mjs (400 for
each), green with the change.
Run on origin/main 6fd976a: TMPDIR=<scratch> HOME=<scratch>/home bun test
(whole repo) 1919 pass 0 fail across 173 files; bun scripts/check.mjs ok.
DeepSeek Harness (dsh) opens every system prompt with "You are an AI agent powered by DeepSeek Harness." WorkBuddy refuses such chats as 11128, "Illegal API invocation from an unapproved channel". A FLAGGED rule now rewords that line to "You are an AI agent that helps the user with programming tasks." The new wording names neither magpie nor WorkBuddy.
Fixes#279. The issue stays open until the reporter confirms.
Verified at the reviewed head 3d275794edfccaf4fdafa75729c61cdb7015b5a5:
- The fixture is DSH's own line. The installed @deepseek-ai/dsh 0.2.0-rc.2 package dsh-system-prompt documents it as the fixed first-party opener at order -1000 (includeHarnessIdentity, default true), and its text is exactly "You are an AI agent powered by DeepSeek Harness."
- The new unflag.test.mjs lines fail against main e2c3a35's index.mjs (Received: "You are an AI agent powered by DeepSeek Harness. Be brief.") and pass with the change.
- packages/workbuddy `HOME=$(mktemp -d) bun test` with the change on main: 101 pass, 0 fail.
- Not tried: a live WorkBuddy request from DSH. The reporter's account and smart-open/TraeWorkAssistant#125 tie the refusal to this line.
Cosy-ClientType 10 says the desktop app, so Cosy-Version (and the signature's cosyVersion and the session's business.version, which share the constant) now carry the version that app's worker runtime sends: 1.1.69, not the CLI's 1.1.49.
Verified at the reviewed head 62c3f162ba06100383f765c601044cbcbc725364:
- Qoder's update feed (download.qoder.com.cn/qoder-app/releases/latest-mac.yml) names 0.4.8, build 79743374, released 2026-10-14. Range-read app.asar out of that release's Qoder-mac-arm64.zip: its transport config says "qoderCliVersion": "1.1.69", "sdkVersion": "1.0.52". The locally installed 0.4.3 says 1.1.64, so the number does follow the app.
- The 1.1.69 worker runtime (download.qoder.com/qodercli/releases/1.1.69/qodercli-worker-runtime-darwin-arm64.tgz, runtime-info.json version 1.1.69) sets "Cosy-Version" from its own version constant ("1.1.69") in its header middleware, so the desktop app's requests carry 1.1.69.
- packages/qoder `bun test` at the PR head: 157 pass, 0 fail; with the change applied on main e2c3a35: 166 pass, 0 fail.
- Not tried: a live chat request with 1.1.69 against a real Qoder account.
Devin's nginx turns a GetChatMessage body past 10 MiB away with 413, so a
long turn failed. A Connect frame's message is now gzipped (flag 1,
Connect-Content-Encoding: gzip) past 8 KiB, as the devin CLI sends it.
Review commit da6c664 on top of 05d8a65, from the official client: the
devin CLI 3000.11.92, run in a sandbox through a logging proxy, sends 8,083
bytes plain and 8,333 gzipped, names the encoding only on a gzipped frame,
and sends no Connect-Accept-Encoding. The PR's 64 KiB threshold, header on
every request and Connect-Accept-Encoding were changed to match.
Run at da6c664fa917ee995a10a457a10fb94ad743e8ab: bun test in packages/devin,
98 pass 0 fail; bun scripts/check.mjs devin ok. The new tests are red on
main f906a22 (3 fail) and on 05d8a65 (3 fail). Live, owner's account,
swe-1-6: a 12 MiB plain frame gets 413, gzipped it passes nginx (the model
then refuses the size); complete() with a short and a >64 KiB message both
200.
Qoder refuses a whole request when a tool turn answers no call of the turn
before it ("Messages with role 'tool' must be a response to a preceding
message with 'tool_calls'"). qoderMessages gave an id-less call a fresh id
while its result kept the client's, so the pair never matched (#277).
Now a call without an id gets one, a result naming a call of its turn
answers it, a result whose id was lost answers the earliest open call that
no other result of the turn names, and a result with no call left (or one
after the assistant's own words) is carried as text in the user's turn.
A well-formed history is unchanged.
Review commit d2a8652 on top of 76bb20b: a lost id no longer takes a call
another result names (calls a, b; results "lost", "a" swapped the outputs),
and a result after an assistant text turn is text, not a tool turn.
Run at d2a865272c6cd01c9bd9cf54d2b399d5b08102fc: bun test in packages/qoder,
166 pass 0 fail; bun scripts/check.mjs qoder ok. The PR's four pairing tests
are red on main f906a22 (4 fail, 2 pass); the review's two are red on
76bb20b. #277's row 2 (call without id, result names c1, "myhost") is a
test. Not sent to Qoder live; the reporter ran 76bb20b against qoder/dfmodel.
The CN managed gateway answers an exhausted free quota with
403 {"code":810000,"message":"GLM-5.3 免费额度已用完,开通连续包月会员继续使用"};
the reporter's same token got as far as "400 非法模型" with an unknown model,
so the sign-in is good. Both chat paths read every 401/403 as a dead
sign-in, so magpie showed 登录已失效 and sent the user to sign in again.
A 403 whose JSON body carries code 810000, or a message saying the quota or
balance is spent (额度, 余额不足, 用完, 用尽, quota, exhausted), now goes on as
a 429 with "AutoClaw: <the gateway's message>" and X-Magpie-Sign-In: kept. On
the overseas path such a 403 isn't asked of the second host. A 401, and any
other 403 (no body, another code), is still the sign-in, as before.
Run at this commit on origin/main 5ec8377: bun test in packages/autoclaw 28
pass 0 fail; bun scripts/check.mjs autoclaw ok. Broken by hand: with
0.2.3's index.mjs both new tests fail. The fixture is the reporter's body;
not tried against a live AutoClaw account (none here).
Releases #257 (WuJian1421), #260 and #273 (moxuanchen), with three fixes on
top of #257's native tool turns:
- A tool result with no text went out as an empty text part. wangjianjq
measured on live Trae CN (#251) that Trae then refuses the whole request
with 4027 ("insufficient tool messages following tool_calls message"),
for either of two parallel results; " " or "0" passes. An empty result
now goes as "(no output)", or "(the result's image follows)" when its
image rides the user turn after the run. Credit wangjianjq (#251).
- A request whose body names no tools (none sent, or tool_choice "none",
such as a summary) still sends past calls and results as text, as 0.2.17
did: every live run of the native turns carried the tools in the body.
- A tool result answering no call the history sends goes back as a user
text turn ("Result of ... (call id)"), not as a tool turn naming no call.
- A Windows APPDATA spelled with other case, separators or a trailing
separator is the same root as the home's AppData\Roaming (test for #273's
fix; it fails on 0.2.17's clientStoragePaths).
Run at this commit on origin/main c7a7379: bun test in packages/trae 175
pass 0 fail; bun scripts/check.mjs trae ok. Broken by hand: with the
merged #257 index.mjs, the three new request tests and the image placeholder
test fail (4 of 28 in request+images); with 0.2.17's index.mjs the new
APPDATA case fails. Not tried against a live Trae account (none here); the
live evidence is the PR authors'.
clientStoragePaths compares its two Windows roots (APPDATA and the home's
AppData\Roaming) ignoring separator, trailing separator and case, so the same
storage.json isn't read twice; the path test compares with this system's
separator, so it passes on Windows.
Run at the reviewed head 08b52ad, merged with #257 and #260 on main 68170b3:
bun test in packages/trae 173 pass 0 fail; check.mjs trae ok. Not run on
Windows here. A case/separator test that fails on main follows on main.
A check-in claim answering extra_credits alone is credited (NaN before); an
empty reasoning_content no longer hides the event's reasoning; a native call's
name snapshot that grows takes the place of its first piece; a Global reply's
error names Trae Global.
Run at the reviewed head 2a0a835, merged with #257 and #273 on main 68170b3:
bun test in packages/trae 173 pass 0 fail; check.mjs trae ok. The new tests
fail on main's index.mjs. Not tried against a live Trae account.
Trae accepts an assistant tool_calls turn and a role:"tool" result turn on
llm_utils_chat, and answers such a history with native calls; the text-form
bridge prompt is dropped. Assistant text folds into the calls turn after it,
consecutive calls turns join one list, a nameless call is dropped with its
result, and a tool result's images ride a user turn after the run of results
(Doubao-Seed doesn't read an image_url in a tool turn). Refs #38.
Run at the reviewed head d5d755a, merged with #260 and #273 on main 68170b3:
bun test in packages/trae 173 pass 0 fail; bun scripts/check.mjs trae ok.
Not tried live here (no Trae account); the live runs are the author's (CN and
Global, multi-turn, parallel calls) and wangjianjq's on #251. Follow-up on main:
an empty result's 4027, a request without tools, and a result answering no call.
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.
doubl4door (Discord, factory 0.1.34): Claude Code on Factory's Opus got
403 "This request was blocked by Factory's usage policy check" (code
content_policy_rejected), and the plugin's hint pointed at the org's model
policy and plan. droid 0.245.0 tells this refusal apart by that code, only
when Factory sent no x-factory-upstream-error header, and says the check
covers the whole conversation. contentRefused does the same: explain()
says to start a new session or remove the quoted text, and mendOrg's
whoami-and-resend is skipped, since the same conversation is refused
again under any org. Other 403s are handled as before.
Run (sandbox HOME):
- HOME=$(mktemp -d) bun test packages/factory: 171 pass, 0 fail
- bun scripts/check.mjs factory: ok; git diff --check clean
- Broken by hand: without the mendOrg skip 2 of content-policy's 4 tests
fail; without explain's branch 3 fail.
Not tried against Factory's server (no Factory account here); the body
shapes tested are code at the top level and under error.
Factory's proxy gate refuses a request whose body carries certain client
phrases (pi's opening and compaction sentence anywhere; Claude Code's
identity, env line, billing header, compaction opening and
GLOBAL_INSTRUCTIONS inside tool output). The phrases now live in
client-phrases.json; sanitizeBody escapes each phrase's first character as
\uXXXX in every request body (only re-stringified when something changed),
and the Gemini path escapes them too. Version 0.1.35.
Run at the reviewed head f0e78b4 (sandbox HOME):
- HOME=$(mktemp -d) bun test packages/factory: 167 pass, 0 fail
- bun scripts/check.mjs factory: ok; git diff --check clean
- npm pack lists client-phrases.json
- Broken by hand: without sanitizeBody 5 new tests fail; without the
Gemini escapeDeep 1 fails.
Not tried against Factory's server (no Factory account here); the author's
real-account A/B is in the PR.
With signinOnUsage on, maybeSignin remembered a day's success under the
provider id, so after the first AutoClaw account signed in, every other
account of that provider was skipped until the next day. #254's reporter
has four sign-ins under two default display names and saw exactly one
extra account signed this way. The key is now the sign-in's uid, or a
hash of its refresh token for an old account that has none, for both the
refresh and the usage path.
magpie's own daily check-in (the native checkin hook) skipping same-name
accounts is the main part of #254 and is fixed in magpie itself.
Run:
- bun test packages/autoclaw: 26 pass, 0 fail. The new test drives usage()
for four accounts sharing one display name (two with uid, two without);
on the old index.mjs it fails at the second account ("今日未签(+400)").
- HOME=$(mktemp -d) bun test (whole repo): 1865 pass, 1 fail + errors in
packages/devin's CLI tests (30s timeouts) and a trae stream connection
reset, at load average ~168; neither package is touched here. Rerun of
devin+trae alone: 252 pass, 1 devin timeout.
- bun scripts/check.mjs: all packages ok.
#262's check-in tests went through the loader's campaigns fetch; the daily
check-in magpie presses is auth.checkin, whose PAT change nothing covered.
One test claims on qoder and qoder-cn with a PAT account (job token, no
deviceToken refresh); one checks a 403 is "failed", not rotated.
Run on 0a8e5ab + this: bun test packages/qoder 157 pass, 0 fail; bun
scripts/check.mjs passes. With the checkin hook's PAT lines reverted by
hand both new tests fail. Test only, no version bump.
Qoder CN offers the PAT sign-in too (its /api/v1/jobToken/exchange takes a
personal_token as qoder.com's does; the prompt names qoder.cn's console),
and a PAT account, which has no device token, signs the campaigns pages and
the daily check-in with its job token instead of rotating a device token it
doesn't have. The account keeps the name its browser sign-in takes
(email || uid), so a renewed PAT sign-in replaces its lapsed row.
Run at d7db9f2b987c46cbf100cda9d89a8a546e374fb6:
- bun test packages/qoder: 155 pass, 0 fail; bun scripts/check.mjs passes.
- The PR's check-in tests go through the loader's campaigns fetch, not
auth.checkin. Two local tests calling auth.checkin with a PAT account
(qoder and qoder-cn: claimed on the job token, no deviceToken refresh;
a 403 is "failed", not rotated) pass on this head and both fail with the
checkin hook's change reverted by hand. They follow on main.
- Probe: POST openapi.qoder.com.cn/api/v1/jobToken/exchange with an
invalid pt- token answers 400 BadRequest, as openapi.qoder.sh does (an
unknown path answers 401), so the endpoint exists on CN and a bad PAT
maps to "refused the PAT". qoder.cn/account/integrations redirects to
sign-in, as qoder.com's does.
- Not tried: a live qoder.cn PAT exchange, chat or claim; that rests on
the author's live run.
Releases ec884d0 (#259). Only the version changes here.
Run on origin/main 915f143 plus this bump: bun scripts/check.mjs passed;
packages/zen-free bun test (temp HOME): 195 pass, 0 fail. #188's literal
repro script (node) prints call_0/call_1 for both null and "" and exits 0.
A Qoder reply's native tool-call deltas no longer become a tool with an empty name. An empty or null placeholder is skipped; an id or arguments that arrive before the name are held until it comes; each upstream index keeps its own output index, so interleaved parallel calls get their own arguments (streamed and non-streamed). A native call that ends without a name ends the turn as a 502 instead of being sent on, since clients persist the empty name and Responses providers then reject the history. Qoder and Qoder CN share this parser.
Run at the reviewed head 9c755fd62cfd11cb80a9d960862aad25c32fb97d:
- bun test packages/qoder: 150 pass, 0 fail
- bun scripts/check.mjs qoder: ok
- native-tools.test.mjs on origin/main 5b68df0 (old parser): 0 pass, 11 fail
- PR CI (test, on-npm): green
Not tried against a live Qoder account; the frames are synthetic.
When a Chat Completions stream sends a call's id first and then id: null or
id: "" in a later delta for the same index, the buffered call kept the later
value, so the client got null/"" ids and a later request failed with
"Duplicate value for 'tool_call_id'" (#188). A later null or empty id now
keeps the id already buffered; an id that first arrives in a later delta is
still taken.
Run at the reviewed head 8f19ba1e6bf09f105a47e4fb2f7233de22a99b06 (base 5b68df0, main):
- packages/zen-free: bun test (bun 1.4.2, temp HOME): 195 pass, 0 fail.
- bun scripts/check.mjs: passes.
- #188's literal repro script (node 22.22.0): prints call_0/call_1 for both
null and "" and exits 0; on main's tool-response.mjs it prints [null,null]
and ["",""] and fails its assert.
- The PR's new test with main's tool-response.mjs: red (null, '' instead of
call_0, call_1); green with the fix.
Claude Code 2.1.30x opens its system prompt with "You are a Claude agent, built on Anthropic's Claude Agent SDK.". AutoClaw's gateways answer 406 to "Claude Agent SDK" anywhere in a system prompt. The author confirmed it on both CN (managed) and overseas (autoglm-api.autoglm.ai). FLAGGED now rewrites the identity line to "You are a coding assistant.", and any other mention, along with the "the " or "Anthropic's " before it, to "the agent framework". Only system and developer messages are rewritten. User, tool and assistant text, and identifiers like @anthropic-ai/claude-agent-sdk, ClaudeAgentSDK and claude_agent_sdk, are left as they are. The CN path's refusals other than 401/403 now go through explained(), so a 406 there carries REFUSED_HINT, which now lists Claude Agent SDK.
Run at the reviewed head a9bd38b1451b745d91019bf168e72f7d3c724779:
- bun test packages/autoclaw: 25 pass.
- index.mjs reverted to main: both new tests fail. index.mjs at 4ca51de: the exact-output test fails (it catches the "assistant.." double period). Restored: green.
- Probe of unflagged()/unflag() on the identity line, "running on" and "the" variants, upper and lower case, code identifiers, and every message role: output as described above.
- Full bun test in a temp HOME under $TMPDIR: 1855 pass, 0 fail. bun scripts/check.mjs: ok.
Releases 2ef6d6b (#252). Only the version changes here.
Run on 2ef6d6b plus this bump: bun scripts/check.mjs passed;
node --test packages/zen-free/ all pass. The PR's head was run in full
before the merge (HOME=$(mktemp -d) bun test: 1853 pass, 0 fail).
A Chat Completions stream whose tool_calls or function_call delta carries
`"name": null` or `"arguments": null` (some OpenAI-compatible vendors send
these) failed the whole turn with "Invalid upstream function delta".
appendFunction now treats a null/undefined name or arguments as no new
bytes and keeps the fragments already buffered. Other non-string types
still fail. The name is still checked on the whole concatenated value when
the choice finishes, so a call whose name stays null is still left out with
its note; skipping null can't let a call past the policy.
Siblings: no other package vendors tool-response.mjs (grep for "Invalid
upstream function delta" finds only zen-free); zed's tool-call merge
already appends only truthy arguments.
Run at the reviewed head 48a266070ed1ad3e63fa864e438af8163110f5f6:
- Fix removed by hand: 4 new tests red (tool_calls / function_call
"ignores null fields..." and "still drops calls whose name remains null",
failing on `!values.some(value => value.error)`), 104 pass. Restored:
node --test packages/zen-free/tool-response.test.mjs 108 pass, 0 fail.
- HOME=$(mktemp -d) bun test: 1853 pass, 0 fail across 168 files.
- bun scripts/check.mjs: passed.
Version bump to zen-free 0.1.12 follows in its own commit.
The bills endpoint ignores paging.offset and always reports total 0, so
it can only be asked for the newest N rows. 200 rows covered under a day
of an active account and left out the large grants a balance is made
of, so the usage card's limit was far too small. queryUsage now asks
for 1000 rows, then 5000 if the first page came back full.
Run: bun test packages/raccoon (30 pass); the new test fails on the old
index.mjs (1 fail); bun scripts/check.mjs raccoon ok; full bun test
1833 pass, 0 fail. Not tried against a real Raccoon account.
A failed read of Qoder's model list during a chat (DNS, timeout, an HTTP
refusal) now answers 502 instead of 400, so magpie retries and falls back to
the next member of a group instead of ending the request. A lapsed sign-in
met on that read answers 401 with the sign-in mark, as the chat path does.
Run at the reviewed head fcdf173e1 (on origin/main ff13aac):
- bun test packages/qoder: 139 pass, 0 fail
- bun scripts/check.mjs qoder: ok
- with index.mjs put back to main, the two changed tests go red (2 fail)
- magpie's passing() retries 502 and falls back (internal/gateway/fallback.go);
no magpie parity test pins the old 400
sdytman (#feedback, 10-19): "clinepass供应商现在可以勾选deepseek模型只走deepseek官方上游,建议glm也加一个勾选选项,只走z.ai上游".
With pinUpstream on, a request for a GLM model (cline-pass/glm-5.3,
cline-pass/glm-5.3-flash, any non-free id whose name starts with glm)
now carries "providerOptions":{"gateway":{"only":["zai"]}}, as a
DeepSeek one carries ["deepseek"]. cline-free/ models, other makers'
models and a body with providerOptions of its own go as sent. One
option covers both: it means "the maker's own API" for each.
The slug: Cline's gateway is Vercel's AI Gateway (the ProviderPin
author on linux.do/t/topic/2918145: "锁在Vercel的DeepSeek官转上";
providerOptions.gateway.only is that gateway's option).
ai-gateway.vercel.sh/v1/models/zai/glm-5.3/endpoints and
.../zai/glm-5.3-flash/endpoints list provider_name "zai" (and
deepseek/deepseek-v4-pro lists "deepseek", the slug already pinned).
Not tried with a real ClinePass key (none on this machine).
Run: bun test packages/cline/index.test.mjs, 75 pass; the whole suite
(TMPDIR and HOME under a scratch dir) 1825 pass, 0 fail; bun
scripts/check.mjs ok. Broken by hand, each goes red: no glm entry (3
tests), cline-free/ not skipped (1), every maker pinned to zai (3), the
client's providerOptions overwritten (1).
moonshardx (#246): Command Code keeps request content up to 30 days
unless Zero Data Retention is asked for (commandcode.ai/docs/resources/
zdr): CMD_ZDR=1 for the CLI, x-cmd-zdr: 1 on the Provider API. The
plugin had no way to send it.
- The plugin declares a "Zero Data Retention" switch (auth.options,
magpie #2038, off by default, with a cost note to confirm). magpie
shows it in the provider's editor; the plugin reads it through
input.magpie.option at each request, so no restart is needed.
CMD_ZDR=1 in the plugin process's environment also turns it on, as for
the CLI; only "1" does, as the CLI's isCmdZdrEnabled reads it.
- While on, the Provider API request and Go's /alpha/generate request
each carry x-cmd-zdr: 1. For /alpha/generate this mirrors the CLI: its
1.84.0 bundle (npm pack, read, not run) adds [CMD_ZDR]:"1" in
buildCommandAuthHeaders, and the installed CLI 1.74.1, run with
CMD_ZDR=1 in a sandbox HOME through a logging pass-through proxy
(COMMANDCODE_SANDBOX=true, COMMANDCODE_API_URL), sent x-cmd-zdr=1 on
/alpha/generate and on every other request.
- A model with no ZDR upstream: the Provider API's 422 cmd_zdr_no_providers
goes on as it came. On /alpha/generate Command Code answers 200 with an
error line ({"type":"cmd_zdr_no_providers","code":
"CMD_ZDR_NO_PROVIDERS","statusCode":400}); the agent gets that 400 and
message as before, and now the error's type cmd_zdr_no_providers
instead of commandcode_error.
Run: zdr.test.mjs is new (6 tests, fixtures are Command Code's literal
bodies from today). Broke each by hand and watched red: no option, no
Provider header, no generate header, CMD_ZDR read as truthy, the switch
read once, the 422 rewritten, the type dropped: 1 to 3 fail each.
bun test packages/commandcode: 55 pass, 1 skip, 0 fail.
bun scripts/check.mjs commandcode: ok. HOME=$(mktemp -d under $TMPDIR)
bun test: 1822 pass, 0 fail.
Live, with the owner's GOAT key, the plugin's fetch with the switch on:
Provider API deepseek-v4-flash 200 with x-cmd-zdr: 1; Provider API
poolside/laguna-s-2.1-free 422 cmd_zdr_no_providers, body as it came;
/alpha/generate (plan forced to Go) deepseek-v4-flash 200 with the header,
laguna 400 cmd_zdr_no_providers; with the switch off neither had the
header. Not tried: a real Go account (none here), the switch in magpie's
editor itself (driven by a stand-in for input.magpie), OpenCode.
On Windows, with no office-raccoon:// handler registered, confirming the
browser authorization never finished the sign-in: the method was "code" and
asked for a callback URL the browser never reached. The browser method now
uses the authorize page's desktop_callback=loopback contract (checked
against the live page's validator: login_source=desktop, 64-hex state,
http://127.0.0.1:<port>/auth/callback, port >= 1024). A listener on
127.0.0.1 and a random port takes one GET with the exact Host, path and
state, and exchanges the code once. It closes on success, denial, exchange
failure or the 10-minute timeout. The authorize URL is built before
listening, so a bad RACCOON_MAIN_SITE_URL leaves no listener. The pasted
callback/token way stays as method 3; the desktop session stays method 1.
Run at the reviewed head f84c6d0 (merged with origin/main cdf4513), bun 1.4.2, macOS:
- bun test packages/raccoon/: 29 pass, 0 fail; bun scripts/check.mjs: all ok
- HOME=$TMPDIR/pr242home bun test: 1823 pass, 0 fail (1824 tests, 167 files)
- broken by hand, each turns a test red: replay guard (409), Host check,
state check, URL built after listen. Removing clearTimeout turns nothing
red; the timer is unref'd and finish() is idempotent, so it has no
observable effect.
- RACCOON_MAIN_SITE_URL="not a URL" and "http://[bad": browserSignIn
rejects, lsof shows no listener in the process
- magpie 0.1.1290 plugin host, sandbox HOME, fake `open`: `magpie plugin
login raccoon` method 1 gives the loopback URL and offers the paste
fallback. The listener is on 127.0.0.1 only. Wrong Host gives 404, wrong
state 400, POST 405. A correct-state callback with a made-up code reached
the real vendor (200035). The CLI failed with "授权码已失效" and the
listener closed.
- Not tried: a full real sign-in with an account (needs the owner's login).
The author reports a live Windows round trip in the PR.
zygs1083-dotcom (#243): after compaction, a long Claude Code session went
403 Forbidden on all three Factory accounts. Claude Code renders its
instructions attachment two ways (n_t in 2.1.292 to 2.1.303):
- first copy: "Codebase and user instructions are shown below. …"
- changed copy (changed: true, reason compaction and others):
"Instruction files were re-read after the conversation was compacted;
these differ from their earlier copies — each replaces its earlier copy,
and the instructions preamble above still applies:" (or "These
instruction files changed — …" without a reason)
Both list "Contents of ~/.claude/CLAUDE.md (user's private global
instructions for all projects):", the phrase Factory refuses (magpie#634).
Only the first opening was matched, so the changed copy went out as it was.
- INSTRUCTIONS_REMINDER matches both openings, requiring the changed
copy's full sentence and the "Contents of " that follows it. The rename
is limited to the reminder itself: text joined after its close (chat
completions' joined user text) stays as written. String user turns on
/llm/a get it too; before, only text blocks did.
- quotedToolText encodes tool output that quotes the phrase (the
reporter's session read Claude Code's renderer source and went 403
from then on), losslessly, as for the other phrases.
- A 403 the plugin rebuilds keeps Factory's request id (x-request-id,
request-id, x-amzn-requestid, cf-ray, or the body's request_id) and the
error's code and type in the message, and request_id on the Anthropic
body. Headers already went back as they came.
The fixtures are the literal texts the 2.1.303 bundle's n_t/Mje/bMr build
and id() wraps; 2.1.301 and 2.1.302 have the same strings, and the
2.1.292 darwin-arm64 npm package has the same sentence pieces.
What was run at this commit:
- bun test packages/factory/: 161 pass, 0 fail.
- bun scripts/check.mjs factory: ok. git diff --check: clean.
- Broken by hand: with the old startsWith-only opening, the 4 changed-
wrapper tests fail; without the phrase in quotedToolText, the tool-result
test fails too; with upstreamIds returning nothing, the 403 test fails.
- Not tried: a real Factory request with the changed reminder (no live
account was used), so that Factory accepts the renamed copy is inferred
from the first copy's fix in 0.1.12, not seen.
autoclaw-cn's managed gateway (autoglm-acceleration-api.zhipuai.cn) answers
406 when the system text carries an agent identity line FLAGGED doesn't
cover. Two more entries, in the table's own style:
- "You are ZCode" (any case, anywhere; #245's probes) -> "You are the ZCode
agent". #245 found "You are an interactive ZCode agent ..." answered 200,
so the gateway reads the literal run, which the rewrite breaks.
- "operating inside pi, a coding agent harness" -> "operating inside the pi
coding agent harness" (#236). pi's line wasn't probed, so the rewrite
breaks both "inside pi" and "pi, a coding agent harness" and keeps pi's
name for the model.
Both rewrites are fixed strings, so the same prompt always leaves the same
way and a cached prefix stays put. Only system and developer messages are
rewritten, as before. Claude Code's entry is unchanged. REFUSED_HINT names
ZCode and pi.
No general fallback: agents such as opencode put the user's own AGENTS.md
into the system text, so a pattern like "You are X, a ... agent" would
rewrite the user's words, and nothing shows the gateway matches that shape.
Tests use each reporter's literal line: unflagged, unflag's role scoping
(ZCode in a system part rewritten, the same line in a user message and pi's
in a tool message untouched), and the CN managed path end to end.
Run (worktree at origin/main 47fbf63):
- bun test packages/autoclaw/: 23 pass, 0 fail
- bun scripts/check.mjs autoclaw: ok
- HOME=$(mktemp -d) bun test: 1808 pass, 1 fail, the trae stream.test
"connection reset" under the full suite (#124, open); packages/trae/
alone 160/160 three times
- broken by hand: ZCode entry removed -> 3 red; pi entry removed -> 2 red;
unflag's role check removed -> 2 red
- not tried against the real gateway: no autoclaw-cn account is signed in
here
"magpie里的grok 登录验证 在mac下 似乎每次都会弹两次验证, 在浏览器窗口里":
`grok login --device-auth` (Grok Build 1.0.50, the webbrowser crate)
opens the device page itself, and magpie opened the same URL again.
Reproduced in a sandbox HOME/GROK_HOME on macOS: grok's own device-code
tab appeared in Chrome with magpie not involved, with and without
SSH_CONNECTION set. What decides grok's own open, from the binary's
strings and webbrowser 1.2.4's source:
- macOS: NSWorkspace, $BROWSER never read (the macOS binary has no
"BROWSER" string);
- Windows: ShellExecuteW, no $BROWSER either;
- Linux and the rest: $BROWSER, else xdg-open, skipped with no display.
So the sign-in now says `opened: true` on darwin and win32 (magpie then
opens nothing; magpie >= the commit that raises the grok mover min reads
it), and elsewhere gives grok BROWSER=true, a no-op, so the opener stays
the only one to open the page. OpenCode ignores the extra field.
Tests: login.test.mjs runs the sign-in as darwin/win32 (opened, $BROWSER
untouched) and linux/freebsd (not opened, BROWSER=true reaches grok).
Both fail on 0.1.16's index.mjs (10 pass, 2 fail).
Run: HOME=<scratch> bun test packages/grok: 49 pass, 0 fail;
bun scripts/check.mjs: exit 0.
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.
WorkBuddy AI's /v3/config gives some models' credits with a unit:
"x0.34 credits", "x0.59 credits", "x3.31 credits" (fast-model,
balanced-model, primary-model). creditsOf passed "0.34 credits" to Number,
got NaN, and so treated a known rate as unknown. It now strips a trailing
whitespace-separated "credit"/"credits" before the same strict conversion.
Any other trailing text ("x0.34 bananas"), "credits" alone, "x-1 credits",
"xNaN credits", "xInfinity credits" and "" stay unknown, never free.
Reviewed at head 2dda6eb5d42e271e948e4fb5aef6d3e5db7627b5, merged with
origin/main 5a83674 (clean):
- Real catalog: read www.workbuddy.ai/v3/config with the owner's WorkBuddy
AI sign-in (config read only, no inference). Its cli models carry exactly
"x0.34 credits", "x0.59 credits", "x3.31 credits", default-model "" and
the rest "x0.77"-style. main's creditsOf parses the three as unknown;
this one as 0.34 / 0.59 / 3.31, default-model unknown. CN WorkBuddy's
config has no unit strings and parses the same on both.
- packages/workbuddy: HOME=<tmp> bun test, 99 pass 0 fail.
- Full repo: HOME=<tmp> bun test, 1802 pass 2 fail; bun scripts/check.mjs ok.
The 2 reds are packages/cursor, untouched here, under load average ~400:
latency.test "events never show in time" (#210) and stepusage.test
"finds the Run's event ... once" (null at line 88: three polls at 10ms
don't fit its 200ms window under load). Both pass in reruns of the
cursor package.
- Broke it by hand: without the strip, both new tests red; with the strip
widened to any trailing word, the unknown-values test red.
ReneXiong's account has two organizations: the personal one on
zed_student and a non-personal default with no plan. orgOf() always took
default_organization_id, minted the model token for it, and /models and
/completions answered 402 "Organization does not have an active
subscription". planOf() fell back to the account's plan_v3, so the card
said Student over an organization with none.
What Zed's editor does (zed-industries/zed 56934ec): user.rs
update_authenticated_user starts in the default organization, else the
first; the title bar's organization menu calls set_current_organization,
which the LLM token's auth context (language_models cloud.rs
ClientTokenProvider) follows; plan() is plans_by_organization[current],
none when it has no entry (current_organization_has_no_active_subscription
treats a missing entry as no subscription; an unknown plan as Free). The
plugin has no switcher, so it now picks as a user switching would:
- the organization the sign-in saved, while it still has a plan that
calls models (any but Free) and models aren't turned off for it;
- else the default, if it has one; else the personal one with one; else
any with one;
- none with one: what Zed picks (saved, else default, else first).
planOf names the picked organization's own plan ("" without an entry);
only a reply with no organizations falls back to plan_v3.
A sign-in saved before this under the unsubscribed default is moved on
the first 402 (llm_tokens, /models, /completions) or empty list: the
account is read again, moved if another organization has a plan, the
move saved through client.auth.set (and kept in memory in case the save
doesn't land), and the request asked once more. The usage hook re-picks
the same way. The model-token cache and the model list are keyed by
organization now, so a move mints and lists anew. There is no explicit
organization choice in the plugin or in magpie to respect; the saved
organization is the sticky one.
Run (bun 1.4.2, macOS, worktree at origin/main 8cdf2d2 + this):
- packages/zed/org.test.mjs (new, no network: fetch stubbed): 11 pass.
With the old index.mjs and the new tests: 10 fail, 1 pass (the
no-plan fallback the old code also did).
- HOME=$(mktemp -d) bun test (whole repo): 1802 pass, 0 fail.
- bun scripts/check.mjs: every package ok.
Not tried against a real Zed account; the reporter's /users/me shape is
from the issue's sanitized read.
llllleo9 couldn't add Grok: grok login --device-auth exited 0, and the
sign-in failed with "grok login finished without an account".
Grok Build 1.0.62 was run in a sandbox HOME. The stand-in auth.x.ai sat
behind an HTTPS_PROXY MITM, with its CA passed through
GROK_EXTRA_CA_BUNDLE, and sandbox-exec denied opening a browser. The CLI
takes email and user_id from the id_token's claims alone. With no email
claim (an xAI account signed in through X), it writes "email": null and
still prints "✓ Signed in". When Grok Build's own home is already signed
in, the plugin signs in beside it and demanded an email, so that sign-in
failed.
- An account is now told apart by its email, else its user_id, else the
token's sub. saved() and the refresh path's remember() use the same
account id.
- GROK_AUTH_PATH is now left out of the CLI's run. With it set, 1.0.62
keeps the sign-in at that file, and the home the plugin reads stays
empty (seen in the same sandbox). The login always runs with envFor(home)
now, not process.env.
- A login that finishes with nothing readable now says what grok said,
which file it read and what was there (no file, not JSON, no token,
or no account). It also points to "Use Grok Build's current sign-in".
Run:
- TMPDIR and HOME set to a scratch dir, bun test packages/grok: 47 pass,
0 fail. The six new login tests FAIL with 0.1.15's index.mjs.
- bun scripts/check.mjs grok: ✓.
- node --check and git diff --check are clean.
- The plugin was run against the real grok 1.0.62 and the stand-in x.ai,
with the CLI home already signed in:
- id_token without email: 0.1.16 returns success with accountId
"user-1". 0.1.15 returns "grok login finished without an account",
the reporter's message.
- GROK_AUTH_PATH set: 0.1.16 returns success, 0.1.15 fails the same way.
- login.test's "a login's link is still handed on" timed out at 5s in 2 of
10 runs alone, on 0.1.15's code too. That is #160, which another session
has taken; the data point was added there.
Not tried with a real xAI account: whether xAI's token for llllleo9's
account lacks the email claim, and whether their Grok Build was already
signed in.
ReneXiong's Zed Student account (an organization without an active
subscription) showed "zed (Zed, 6 models)" with no error: the six
models the config hook declares before sign-in, with their hard-coded
limits. provider.models handed those back whenever /models failed and no
list had been read for the account. The likely path for this account is
a 200 whose models are all disabled: parseModels throws "Zed lists no
models for this account", the hook returned the declared list, and
magpie's host, seeing the last fetch answer 200, didn't mark the list as
fallen back, so nothing said it wasn't the account's.
Now, with no list ever read for the account, the hook throws the reason
(Zed's own "Zed: ... (status)", "Zed lists no models for this account
...", or "Zed: this account's models couldn't be read: <cause>"). magpie's
host takes a thrown models error as fellBack with that message as
listError, and the editor and `magpie providers` show "couldn't list its
models: <reason>". A list read before is still kept on a later failure,
as it was. A 401 for the model token still marks the sign-in expired.
Tests (bun 1.4.2, packages/zed): models.test.mjs 7 pass. With the old
index.mjs and the new tests, 3 fail: "the list refused with the token
just minted", "Zed down before any list", "a 200 listing nothing
callable" (each got the declared models back). Whole package: 33 pass,
0 fail.
Siblings: minimax, qoder, trae, raccoon, workbuddy and opendesign also
return provider.models on a failed list. Each of those checks a
response status magpie's host sees, so a failed read is marked as
fallen back with its HTTP status; not changed here. Not tried against a
real Zed account.
Antigravity answers a system prompt that reads as Claude Code's or the
Claude Agent SDK's with a 429 "Resource has been exhausted", whatever
quota is left (xzplzpl on X). Tried with a real account, it matches
"x-anthropic-billing-header:" and "You are a Claude agent, built on
Anthropic's Claude Agent SDK", and lets the same prompt through with a
U+200B inside each. This middleware puts one after the first letter of
both words, in system text only (Anthropic system, Chat/Responses system
and developer messages, Responses instructions, Gemini
systemInstruction), and only in what an Antigravity account is sent: it
uses magpie's new onProvider hook (v0.1.1283), so a Claude subscription
or any other provider in the same routing group gets the prompt as the
agent wrote it. Options: extraWords, accounts, off. The README says the
ban risk and what happens if Google changes its match. After hexiaolv's
magpie-antigravity-cloak (MIT), which changes every request.
scripts/middleware.mjs: a case's "provider" runs the request on through
onProvider with ctx.provider, and expect_request is that try's body.
Run:
- HOME=$(mktemp -d) bun test: 1783 pass, 0 fail (the package's 12 cases
among them). bun scripts/check.mjs: every package ok.
- Real use: magpie built from e44b9aef3 in a sandbox HOME, a real
Antigravity account, this package added from its folder. Claude Code
2.1.302 `claude -p` on antigravity/gemini-3-flash answered; with
{"off": true} the same run got the 400. /v1/messages with the billing
line, the SDK line and Claude Code's three system blocks: 200 each on,
400 each off.
#209: since 0.1.3 (#76) a call whose name the agent has no spelling of
(DSH with pwsh declared: psh, pash, ppwsh, pshh, bash, shell_command) was
left out with a text note, and a reply of only such calls was rewritten
to a plain stop. DSH read that as a finished answer: 16 of xiotbox's 19
cases ended an autonomous turn, and the model never saw an error it
could correct.
Now nameGuard answers the model's own name when no declared tool folds
to it, so every protocol (Chat JSON/SSE, Responses, Messages) hands the
call on with its id, arguments and tool-call finish, as every other
provider in magpie does. The agent answers an unknown name itself (DSH's
ToolRuntime, Claude Code's "No such tool available", Codex's
"unsupported call", OpenCode's invalid tool) and the model corrects it.
Case and separator folding (todowrite -> todo_write, bash -> Bash) is
unchanged, and an ambiguous fold is still never guessed: it goes on as
called. Only a call with no name is still left out with the note. Any
correction budget is the agent's, as with any provider; the plugin keeps
no per-turn state.
Tests: the #76/#209 names (bedit, bcp, ash, mcp__netcatcatty__unused,
psh, pash, ppwsh, pshh, shell_command) alone and beside a declared call,
JSON and streamed, in all three protocols: the call arrives with its id,
no note, no error, a tool-call finish; a Responses or Messages stream
comes through frame for frame. index.test's plugin-level case (loader
fetch against a local fake Zen) now expects an undeclared `edit` handed
on as a tool call. The leave-out machinery tests use a nameless call.
Run:
- packages/zen-free `bun test`: 174 pass, 0 fail. With nameGuard put
back to `|| null`: 28 fail.
- `node --test` (Node 25.8.2 and 22.22.0): 171 pass, 3 fail, the
"sends OpenCode's own headers" tests, red the same on origin/main
0b58032: Node's fetch adds accept-language and sec-fetch-mode. magpie
and OpenCode run the plugin in Bun. Filed as #212.
- Whole repo, TMPDIR and HOME in a scratch dir, `bun test`: 1771 pass,
0 fail. `bun scripts/check.mjs zen-free`: ok.
- Not tried live against Zen or with DSH: the fix is in what the plugin
hands on, shown against a fake upstream.
A Cursor native Run whose step lists two different tool counts (a Codex-to-Cursor failover hit "inconsistent native tool count") now retires the owner instead of throwing. When no native result was submitted to that Run and no Chat output was exposed, the request is rebuilt once from Chat history (the same stateless rebuild the missing-count case uses), with reason=inconsistent-batch-count in X-Magpie-Cursor-Continuity. A Run that had a result submitted, or a stream that already sent output, still returns the error. The decoder stops reading the failed Run at once. Cursor 0.2.19.
Reviewed at c43b93c (on main 0b58032, clean). Run there, HOME and XDG in a sandbox dir:
- packages/cursor `bun test`: 275 pass, 1 fail. The fail is latency.test "events never show in time", red 6 of 6 on untouched main 0b58032 under load average ~270; filed as #210.
- `bun scripts/check.mjs cursor`: ok.
- native-e2e -t "conflicting count": 4 pass. With index.mjs and native-session.mjs from main: 3 of 4 red (JSON and stream rebuild, submitted-result guard). With retentionIneligible forced true: the submitted-result test goes red.
- The fake Cursor is the test's HTTP/2 server on 127.0.0.1; no real account used. The conflict is injected; why Cursor sent two counts is still unknown.
README sections for WorkBuddy and Qoder on why a request can be refused
while the account still shows credits. They cover:
- the exact model id versus the display name;
- WorkBuddy 5.6+'s encrypted desktop sign-in and the browser route around it;
- 11140, the restricted account (magpie#1849);
- Qoder's 10605, a queue answer, not a lapsed sign-in (#185, 0.2.18);
- a CLAIMED check-in that is not a new grant (magpie#2696).
This is docs only. Reviewed at 76cfb6d: two README files, +66 lines,
no code. Checked each claim against the source:
- packages/qoder/busy.test.mjs exists;
- workbuddy usage.test.mjs covers sign-in, usage and chat against a sealed
desktop file, and asserts the file is unchanged;
- magpie's `plugin use` and `plugin list` exist (internal/cli/plugins_cli.go);
- magpie#2696 is the open native-check-in cache issue.
bun scripts/check.mjs qoder and workbuddy both pass. No version bump.
#178's README called 9095 done and 9074 failed. The code answers both as
ineligible, the same as magpie's built-in check-in, so that 9074 isn't
asked again that day. The test asserting ineligible was named "is failed".
Docs and a test name only, so no version bump. bun test
packages/trae/native-checkin.test.mjs gives 9 pass, and check.mjs trae is ok.
Trae CN's daily check-in moves into the plugin as auth.checkin. It asks
/trae/api/v2/ug/checkin_credits/status and then /claim through ownRequest,
so it carries the same JWT renewal, IDE headers, {req_source: 1} body and
16-digit ugDevice (#194) as every other ug page. Trae Global answers
inactive. 9095 on the claim is ineligible, the same as magpie's built-in
traeRefused. 9074 on the claim is an answer for the day: ineligible, with a
hint to check in in the Trae CN app. The built-in calls that own-app, which
the plugin protocol doesn't have. trae 0.2.17.
Run at the reviewed head 4e9bb87 (on top of origin/main 63a3d2a..c397e96):
- bun test packages/trae: 160 pass, 0 fail. The global.test.mjs and
stream.test.mjs failures the author saw did not reproduce.
- bun scripts/check.mjs trae: ok.
- Broken by hand, one at a time, and each turned native-checkin.test.mjs red:
9074 mapped to failed; the ugDevice line in ownRequest removed; the
unreadable-claim guard removed.
- magpie's plugin host (yetone/magpie 85eef5d87 build, sandbox HOME, a copy
of the package pointed at a fake Trae on 127.0.0.1:18764), via
`magpie accounts checkin --json`. The results were claimed 100, 9074
ineligible with the app hint, 9095 ineligible, and checked_in done 100
with no claim sent. Status and claim both went out with
x-device-id 2866487253502651 and {"req_source":1}.
#185 trims a chunk's body before parsing it in events(), and nothing tested it. The envelope carries the BOM JSON-escaped, so the response's own decoding doesn't strip it.
Run: bun test packages/qoder: 138 pass, 0 fail. With JSON.parse(inner) back, the new test goes red (1 pass, 1 fail in stream.test.mjs).
`failure` parses the trimmed body, so a BOM-prefixed 10605 (the SSE envelope carries it as a JSON-escaped U+FEFF that `res.text()` doesn't strip) keeps its 503/Retry-After instead of reading as a lapsed sign-in. An outer body with no code, or code 401/403, whose message is a 10605 body is unwrapped to it; explicit 105/110/406 codes stay authoritative, and malformed or array messages are not unwrapped. Refs #167, #181.
What was run at c9e39e0 (reviewer, bun 1.4.2, macOS):
- bun test packages/qoder: 137 pass, 0 fail. bun scripts/check.mjs qoder: ok.
- Broken by hand: without the unwrap, the 8 wrapper tests go red; parsing `text` instead of the trimmed `msg`, the BOM test goes red; unwrapping regardless of the outer code, the explicit-code test goes red. The `inner.trim()` in events() had no test; a follow-up commit adds one.
- magpie (yetone/magpie main 85eef5d87) in a sandbox HOME, a copy of this package with api3/openapi pointed at a local fake, a planted plugin-auth.json, `magpie provider test qoder`: a 403 `{"code":403,"message":<10605 body>}`, the SSE `{"message":<10605 body>}` envelope and a BOM-prefixed 403 each gave 503 "Qoder is busy for efficient (this plan's queue: p3); try again in 30s"; a 105 still gave 401 lapsed. main's package gave 401 lapsed for the first two.
- Not tried: real Qoder accounts.
Historical native `web_search_call` items become a labeled assistant text message (recorded status, action, queries and sources; no item id, no internal turn metadata) once the filter has removed the reasoning they depend on. Other native tools keep their ids; tool call/result pairs, unsafe-reference rejection and passthrough for providers without the rule are unchanged. Split out of #168 as asked in its review. codex-history 0.1.0 -> 0.1.1.
What was run at 61b6f0b (reviewer, bun 1.4.2, macOS):
- bun test packages/codex-history: 29 pass, 0 fail. node --test packages/codex-history/web-search.test.mjs: 6 pass. bun scripts/check.mjs codex-history: exit 0.
- Broken by hand: with the web_search_call branch disabled, 5 bun tests and 4 node tests go red.
- magpie (built from yetone/magpie main 85eef5d87) in a sandbox HOME, middleware added from the PR's package, a custom Responses provider `demo` pointing at a local fake, options {"providers":{"magpie:demo":{"historyFilter":true}}}, gateway on 127.0.0.1:18763 (moejs). A Codex-shaped request with reasoning + web_search_call + function_call pair: the fake received the search as the labeled assistant text, no rs_/ws_ ids, no PRIVATE_TURN, the call pair intact, store false. With main's 0.1.0 file swapped in, the fake received the bare web_search_call.
- Not tried: a real Codex session or real vendors.
Brings together #191 (CN managed gateway), #196 (request shaping and identity lines) and the #183 sign-in fix.
- autoclaw-cn chat goes to AutoClaw 2.1.0's managed gateway (autoglm-acceleration-api.zhipuai.cn/autoclaw-proxy/proxy/autoclaw/chat/completions, on Zhipu's domain) with 2.1.0's headers and its four-model catalog. A 401/403 there marks the sign-in expired.
- Both providers get the same request shaping:
- the official one-sentence system prefix, merged into the caller's system message (string or array);
- max_tokens and max_completion_tokens dropped;
- other agents' identity lines in system/developer messages rewritten (FLAGGED/unflag, from #196);
- no X-Harness-Type.
- On the overseas path, a 406 explains itself and keeps the sign-in. Overseas chat now sends AutoClaw's own User-Agent instead of the host's. Its catalog drops zai_glm-5-turbo and the tdpsk models (400 upstream) and keeps the old limits.
- Overseas OAuth: authorize returns the loopback guide URL once the listener is up, and the host opens it, so there is no shell spawn any more. Navigating to the authorization page no longer aborts the session.
- autoclaw 0.2.0 -> 0.2.1.
What was run at 1fe91be (reviewer):
- bun test packages/autoclaw: 21 pass, 0 fail. bun scripts/check.mjs autoclaw: ok. git diff --check: clean. Merges cleanly onto main.
- magpie plugin host (magpie main cb05dc2d1), sandbox HOME, with a copy whose three hosts point at a local fake:
- overseas: authorize gave http://127.0.0.1:18432/, the guide returned 200, and /open-auth plus /auth/callback-google finished the sign-in;
- CN: SMS sign-in worked;
- streamed chat on both providers returned 200;
- the fake received the prefix with "You are Claude Code" rewritten and no max_tokens on both paths; User-Agent AutoClaw/2.1.0 on CN and AutoClaw/1.18.1 overseas; no X-Harness-Type.
- Not tried: real accounts or the live gateways (no credentials used).
Co-authored-by: HuHong_Tao <3596843010@qq.com>