Eight auth hooks declare `rotating: true`: cline, codearts (and OfficeAce),
factory, minimax, nous, qoder, sensenova, workbuddy. Each package's own
code says the vendor refuses a spent refresh token. magpie then stops
carrying these sign-ins to another computer through Sync, a backup or a
Restore (internal/provider/signins_carry.go). Trae was dropped: its refresh
keeps the old token when the answer has none, and there is no evidence it
rotates. Each package's patch version is bumped (cline 0.1.15, codearts
0.3.13, factory 0.1.46, minimax 0.2.9, nous 0.1.3, qoder 0.2.66, sensenova
0.2.3, workbuddy 0.2.30). Each was checked against npm, or against
origin/dist for the dist-only packages, before the merge.
Fixes#884.
Run at cc2f9199 (a fast-forward of origin/main), on mica with a temp HOME:
bun test over the eight packages gave 1588 pass, 0 fail, and
scripts/check.mjs exited 0. CI's test and on-npm jobs pass. At 45c8fdb4,
mote gave 1834 pass with Trae included.
Not tried: a real refresh against each vendor.
Co-authored-by: yetihan <yetihan@users.noreply.github.com>
An opt-in switch, "Group models by company", orders Factory's models by maker: Claude (Fable, Opus, Sonnet, Haiku), GPT, Gemini, Grok, GLM, Kimi, then the rest. Within a family, newer versions come first, and each Fast Mode model sits right after its base. Off, which is the default, keeps main's order byte for byte. Only a strict `true` from magpie's option turns it on. factory 0.1.45.
Run at the reviewed head fe96f7eb67b308a31ce33492fd3c5d5f19a4f5b1:
- On mote at 9b19aa76: bun test packages/factory 196 pass (main 194). Main's and this index.mjs were compared as JSON of the config hook and provider.models: off is identical to main for absent, {}, false, "true", 1, null, a throwing option and `option: 5`; on, there are 59 models, the same set, with no duplicates.
- On the Windows box at fe96f7eb (mote's sshd was refusing connections): bun test packages/factory 196 pass, bun scripts/check.mjs exit 0.
- Broken by hand at fe96f7eb: grouping always on turns both order.test.mjs tests red. Before the review's fix, it stayed green.
- npm has 0.1.44.
Not tried: in a real magpie window.
The rate tests held one date, 2026-10-14, so a promotion starting after
it was never compared with PROMOTIONS. Dropping gemini-4-carbon's line
(#953, from 2026-11-10) left every test green. The new test checks each
promotion droid's registry lists, inline or named, a minute after it
starts, a minute before it ends and a minute after, against what
configModels gives then.
GPT-6 Astra's 60% off ended 2026-09-05, before PROMOTIONS was kept, and
is skipped by a fixed LISTED_SINCE (2026-10-01); with no cutoff the
test was red on it. 7 promotions are checked.
Run on mote with a sandbox HOME: bun test packages/factory, 194 pass.
Broken by hand: deleting Carbon's PROMOTIONS line turns the new test
red (the old ones stay green); Argon at 0.4 turns it and two more red;
the count bar at 99 shows 7 checked.
Not run: the root suite (test-only change in one package; CI runs it).
Registers gemini-4-carbon on Factory's Google Gemini route, with the same shape as gemini-4-argon: 1M context, 65536 output, low/medium/high, a 1.6x multiplier and 50% off from 2026-11-10T16:00Z to 2026-12-01T08:00Z. Factory 0.1.44.
Reviewed and run at fd9b634f41d7021715842f3db7bde28a9e8e6888:
- Downloaded Droid 1.7.1 (darwin/arm64) on mote: SHA-256 761730017d94…7bd4, as the testdata says. The Carbon entry in the binary is byte for byte the testdata line, and it differs from Argon's only in id, name, the feature flag, the pricing note and the dates.
- mote, sandbox HOME: `bun test packages/factory` 193 pass; `bun scripts/check.mjs factory` ok. PR CI (root suite under a temp HOME) green.
- Broken by hand: Carbon at 1.5x turns 3 rate tests red. Carbon sits at index 48 of 59, after the Fast Mode block's rule; the first 24 are unchanged.
- Not caught: dropping Carbon's promotion leaves every test green, since the promotion test reads only named promotion variables, not inline `promotions:[…]`. Argon has the same gap on main.
Not tried: a real request. Carbon is behind Factory's Gemini4Carbon flag, unreleased in Droid 1.7.1.
Co-authored-by: Mars-Sea <Mars-Sea@users.noreply.github.com>
droid 1.7.0's new models in the Factory plugin: Fable 5.2, Kimi K3.1 Pro,
MiniMax M3.1 Flash, Nemotron 3.5 Super, Inkling, Muse Spark 1.2, Beam 1.0,
and GPT-6 Sol/Luna, GPT-5.6 Sol and GLM-5.2 Fast. Each is at droid's
limits, efforts, images and token multiplier, with apiProviders[0] as the
upstream. gpt-6-sol/gpt-6-luna at service_tier "priority" now go to their
Fast Mode models. GLM-5.2 Fast is its own chat model and is not a tier of
GLM-5.2. GPT-5.6 Sol Fast Mode gets Sol's 20% promotion until 2026-11-22.
Muse Spark 1.2 is left out of CORE (no billingPool "core"). GPT-6.1 Terra,
Muse Spark Open, GPT-6.1 Sol Ultra Fast and Muse Spark 1.3 are left out,
each with a reason. The first 24 models are unchanged (#119).
Review at 9524dcfc6e45b7c2c15245bd1e200d72aeebe17f:
- droid 1.7.0 linux-x64 downloaded in WSL (magpie-desktop). SHA-256
4700746f52ec88e3758a18737be13bb74519276de97bc329054e8dae08f15f42
matches. All 24 excerpt lines of testdata/droid-1.7.0-models.txt are in
the binary byte for byte (grep -F). The base entries gpt-6-sol (0.8),
gpt-6-luna (0.04), gpt-5.6-sol (2) and glm-5.2 match the plugin's.
- Each new row was checked against its entry: id, context/output, efforts
(off dropped, or kept as none only for GLM-5.2 Fast), images,
multiplier, upstream and wire.
- First 24 ids are equal on main and the PR, and main's order is kept.
CORE gains exactly kimi-k3.1-pro, minimax-m3.1-flash,
nemotron-3.5-super, inkling, beam-1.0 and glm-5.2-fast.
- In WSL, bun 1.4.2, HOME a temp dir: `bun test packages/factory` gave
193 pass, 0 fail. `bun scripts/check.mjs` passes.
- Broken by hand. main's index.mjs with the new tests: 14 fail. Muse kept
in CORE: 7 fail. The Sol Fast promotion removed: 2 fail. Fable 5.2 moved
first: the first-24 test fails. Luna Fast at 0.04: 3 fail. Beam with
images: 1 fails.
Not tried: real requests to Factory. Kimi K3.1 Pro, Nemotron 3.5 Super,
MiniMax M3.1 Flash, Beam 1.0, GLM-5.2 Fast and Fable 5.2 are behind
statsig gates whose default is off in the binary. The author's account
listed them, but other accounts may not, as with Gemini 4 Argon.
Co-authored-by: garry569 <garry569@users.noreply.github.com>
inkstone 0.1.3 (#832, yunwang2442-creator):
- Image requests are prechecked before they leave: 8 images, 10MB each, 40MB in all.
- A request over a cap gets a local 400 shape refusal, so magpie asks the next account and rests none.
- The plan's invalid_media / media_fetch_failed / unsupported_media_type errors become the same kind of refusal.
- The body rewrite strips the reasoning fields and sets image detail to auto.
- A zero-prompt browser sign-in comes first, and a second browser method reuses a pasted key.
- Neither browser method is offered when no Chromium-family browser is found (#825).
- The /keys calls ride the session cookie, without the pagination query. Key creation retries the console's -15100 "refresh page and retry".
- The #826 metadata token read is kept, and its test is back.
- The fake browser is built once per user and source hash (#824), and the title wait reads only on Windows.
- maxConcurrency is 4.
- The doubled comment line is dropped from every opencode2.mjs copy, agy-cli's included.
Reviewed at 88e66bde, on mote (macOS, Bun 1.4.2) with a temp HOME:
- full bun test: 6853 pass / 0 fail; both checks exit 0
- bun scripts/check.mjs and bun scripts/check.mjs inkstone: exit 0
- 21 hand breaks: 20 red, 1 not caught (the /keys pagination test calls protocol.listKeys directly; follow-up filed)
Not tried: a real InkStone account or sign-in, Windows and Linux runs.
New package @magpie-community/opencode-inkstone-auth 0.1.0 for Intern
InkStone (书生·端砚, Shanghai AI Lab) Token Plan, provider id
`intern-inkstone`. Community package by yunwang2442-creator.
What it does:
- Browser sign-in (Edge/Chrome, its own profile under
$XDG_CONFIG_HOME or ~/.config/magpie/inkstone-browser, or
%LOCALAPPDATA%\magpie\inkstone-browser). The login window has no
debugging port. A headless CDP read takes the uaa-token cookie, and the
same read renews it silently later.
- Usage card: ink-credit balance, 5-hour and 7-day windows, credit packs.
- Chat: a pasted ink-* API key, or one the sign-in creates, named
ink-<host4>-<acct4>-<rand4> (18 of the console's 20 characters). An
idempotency clash (-15109) retries with a fresh name, up to three times.
Pruning is on by default. It only touches this machine's and account's
prefix, keeps the newest two and the key this sign-in created, and never
deletes manual keys or keys of unknown age.
- Closing on Unix: SIGTERM, then SIGKILL only after a 15s grace. Leftover
browsers are matched by --user-data-dir=<escaped profile>, and Windows
uses .Contains().
- The login wait comes from an injected waitForLogin in tests. No env
hook is left in production code.
- Hosts: discovery.intern-ai.org.cn, discovery-api.intern-ai.org.cn,
127.0.0.1 (CDP).
Outside the package: scripts/opencode2.mjs lets a prompt with
`required: false` stay optional (`p.required !== false`). Every package's
copy is synced byte for byte, so all 39 copies in the merged tree are blob
afe074cb. No other package sets `required: false` on a prompt, so this
changes nothing for them. Also a root README row and a registry entry.
Review at 36412a15, on mote, HOME=$(mktemp -d), Bun 1.4.2:
- bun test packages/inkstone: 68 pass, 0 fail in Asia/Shanghai, UTC,
America/Los_Angeles and Pacific/Kiritimati.
- bun scripts/check.mjs inkstone and bun scripts/check.mjs: ok.
- bun test (repo), on 36412a15 merged with origin/main e7cb9dc5:
6743 pass, 20 skip, 0 fail. main has since moved by cline 0.1.14 and
zcode 0.1.55 only, and none of the adapter copies changed.
- Broken by hand, each red: no protectName protection; prune_keys default
off; no post-sign-in prune; no SIGTERM on close; the -15109 retry keeping
its name.
Not tried: a real InkStone account sign-in on macOS, Linux or Windows (no
account here); a live chat request; magpie end to end with the plugin.
nbczw8750 (#657): trae 0.2.26 on OpenCode 2.2.5 fails with "Plugin
must export a default definition with an id and an effect or setup
function. (cause: SchemaError(Missing key at ["default"]))". 2.x
imports a package's exports["."] (a plugin dir and an npm install
alike) and has no V1 path at all, so every package here that serves
models failed the same way, not only trae.
Every one of the 32 model packages now has:
- opencode2.mjs, exports["."]: a copy of scripts/opencode2.mjs, an
adapter that runs the package's V1 plugins inside 2.x's promise
API. Config providers become 2.x providers (package pinned so the
aisdk sdk hook runs), V1 auth methods become integration methods
(oauth auto/code with forms; api without authorize as a key method),
V1 credentials are kept in metadata.v1, the loader's baseURL,
apiKey, headers and fetch are applied through the sdk hook, an
auth.set renewal is stored per credential, and credential.switched
/updated reload the account's own model list.
- opencode.mjs, main: re-exports the V1 plugin functions only.
OpenCode 1.x and magpie's host.js take main. On 1.x, trae 0.2.26's
main exported a non-plugin (_internal) and 1.19.5 refused it ("Plugin
export is not a function"); the new main fixes that too.
- both files in "files"; patch version bumped. devin already had 2.x
and is unchanged.
scripts/check.mjs fails a model package whose 2.x entry has no default
{id, setup}, whose opencode2.mjs differs from the canonical one, whose
entry is missing from files, or whose main exports a non-plugin.
Run at this head (mote):
- HOME=$(mktemp -d) bun test, as CI runs it: 4900 pass, 0 fail
(4914 tests, 374 files). A first run set globalThis.fetch for the
whole process from opencode2.test and failed 528 tests in other
packages; the block is now set and put back around that file's tests.
- bun scripts/check.mjs: every package passes. With the network
blocked cloudflare-workers-ai fails on its fetched catalog, the same
on origin/main.
- Real OpenCode 2.2.5 (npm opencode-ai), sandbox HOME, packed trae
0.2.27: loads with no error; /api/integration lists trae-cn "Trae CN"
and trae-global "Trae Global" with their browser sign-ins; `auth
login` starts the trae.cn authorization and waits (cancelled there);
with a fake credential POSTed to /api/credential, `opencode models`
lists trae-cn's six models.
- Real 2.2.5 with a fake V1 key plugin through the same adapter
against a local fake server: `auth login` with a key, `models`,
`opencode run` reached /real/v1/chat/completions with the loader's
"Bearer loader-sk-fake" and header, and printed the fake's reply;
with @ai-sdk/anthropic it reached /real/v1/messages with x-api-key
from the loader. This run found the key method missing after 2.x's
second integration transform (a once-only flag outside the
transform); fixed, and opencode2.test checks a rebuild.
- Real OpenCode 1.19.5, sandbox HOME, trae 0.2.27: `opencode models`
lists trae-cn and trae-global models; 0.2.26 failed there.
Broken by hand (scratch copy, bun test scripts/ and check.mjs):
- trae's exports back to "./index.mjs": the trae 2.x test fails
(default.id undefined), check fails trae with "OpenCode 2.x:
./index.mjs has no default {id, setup} (plugins#657)".
- zed's opencode2.mjs changed: the copies test fails, check fails zed
"differs from scripts/opencode2.mjs".
- the key flag back outside the transform: the 1.x plugin test fails
on the rebuilt sign-ins (key missing).
Not tried: a real sign-in with a real account on 2.x; Windows (the
reporter's OS); chat.headers, chat.params, usage and tool hooks, which
the adapter doesn't carry to 2.x; the tools/pages packages (calc,
goanyapi, layerfs, search1api, aelios, agent-console, chat,
fingerprint, nowledge-mem, kimi-desktop), which still load only on 1.x.
ZCode embeds its generated environment paragraph, with unindented bullets, inside a larger system prompt. No runtime-context adapter matched it, so "You have been invoked in the following environment:" and "You are powered by the model named" reached Factory unchanged in the system prompt (403). This renames a complete standalone paragraph in system prompts, later system messages and Gemini's system instruction, keeping every value. Also releases factory 0.1.41, which carries #213.
Reviewed at d4ef7d4e; the maintainer commits on top (eb016a4d) merge main b76a577, keep main's Gemini escape test beside this one, expect main's #258 escape in the Gemini user part, add a fenced-paragraph case and bump to 0.1.41.
- On main b76a577, a probe through _internal.droidBody still sends the paragraph unchanged on Responses and Messages; the PR's new tests fail there.
- At eb016a4d: `bun test` in packages/factory (sandbox HOME, on mote): 189 pass, 0 fail. `bun scripts/check.mjs factory`: ok.
- Broken by hand: zcodeRuntimeContext returning its input turns 5 tests red (Responses, Chat, Messages, Gemini, no-Shell). Dropping the insideFence check passed every original test (the fenced inputs never matched); the added fenced case goes red with it, green with it back.
- Not tried: a live Factory account (the PR body records the 403 on all four routes).
Factory refuses the fixed "Called the Read tool with the following input:" opening. ZCode restores a pre-compaction read as one reminder carrying the arguments and the file's text, a shape no adapter matched, so it reached Factory unchanged (403). This renames that opening, as COMPACT_READ already does for Claude Code's arguments-only reminder, and adapts the file text as a read result.
Reviewed at d2d81da0, merged onto main a06512e (clean):
- On main a06512e (factory 0.1.40), a probe through _internal.droidBody still sends the restored reminder with the phrase unchanged; the PR's 5 new tests are 3 fail / 2 pass there.
- With the PR: `bun test` in packages/factory (sandbox HOME, on mote): 183 pass, 0 fail. `bun scripts/check.mjs factory`: ok.
- Broken by hand: dropping the restoredReadText call turns 3 of the 5 new tests red; keeping the file text raw (no quotedToolText) turns the encoding test red.
- Not tried: a live Factory account (the PR body records 403 -> 200 on Messages and Responses).
The version bump (factory 0.1.41) follows on main.
sweanng (yetone/magpie, Discord #general, 10-29): ZCode on Factory's GLM
5.3 got Factory's usage policy check refusing the conversation (403,
code content_policy_rejected). The plugin handed it on as a 403
permission_error with code null, so magpie passed the 403 through and
ZCode showed "Provider authentication failed" (reason=auth_failed
status=403), as if the account were broken.
The plugin now answers that refusal (only content_policy_rejected
without an x-factory-upstream-error header, as droid 0.245.0 tells it)
as a 400 invalid_request_error with code content_policy_rejected kept on
the error, on both the Anthropic (/llm/a) and OpenAI (/llm/o) routes,
with Factory's words and the "start a new session" advice as before.
Every other 403 stays a 403 permission_error. magpie reads the code as
a refusal of the request (yetone/magpie, same day).
Run (on mote): HOME=$(mktemp -d) bun test packages/factory: 178 pass,
0 fail. bun scripts/check.mjs: ok.
Broken by hand: with index.mjs back at main, content-policy.test.mjs
fails 3 of 6 (both 403 shapes on /llm/a and the new /llm/o case).
Not tried: a real Factory refusal; the refusal's body comes from
doubl4door's and sweanng's reports, not a live capture.
Follows Wangzehong111's commit (from #480), with the review's change:
the plugin sends x-provider-routing-source: registry_default on every
request, and droid 0.251.0 sends that only with apiProviders[0]. 1017's
apiProviders is ["fireworks","baseten","databricks"], so Baseten with
registry_default is a header pair droid never sends. 1017 now goes to
Fireworks like every other model's first upstream; the droid test checks
both headers, the README says so, and the fixture header names the binary
the bytes were checked against.
Reported on Discord by sweanng: the model list had DeepSeek V4.1 Flash but
no 1017.
Checked: droid 0.251.0 (LATEST) darwin-arm64 from downloads.factory.ai,
sha256 d3c0b87f..., has the 1017 entry byte for byte as in testdata, with
the c(o,t) helper and I()'s registry_default rule.
Closes#480.
Co-authored-by: Wangzehong111 <112800852+Wangzehong111@users.noreply.github.com>
Offer deepseek-v4.1-flash-1017 on chat completions with the limits,
reasoning variants, attachments and 0.12x rate in Factory.app's Droid
0.251.0 registry. Keep the original Flash entry and its Fireworks route.
Use Baseten: authenticated Factory routing checked on 2026-10-29 orders
1017 as [baseten, fireworks]. Live plugin requests succeeded on both
backends with the distinct 1017 response model IDs. Baseten accepted none
and high; the arithmetic high sample reported 104 reasoning tokens.
Keep the raw registry entry and context helper in a versioned fixture,
including the binary SHA-256. Check both OpenCode config and Magpie's
provider.models hook, retain price checks for every model across the
0.241.1 and 0.251.0 fixtures, and include 1017 in Droid Core usage tests.
Validation: 176 Factory tests pass; all 30 plugins pass check.mjs.
Pack dry-run and an unpacked-package smoke test confirm all five runtime
files are present and the model hooks and request loader load correctly.
A new switch in magpie's plugin options, standard_only ("Standard usage
only"), off by default, read at each usage reading. When on,
limitWindows reports the Standard 5 hours / 7 days / 30 days windows
with no notModels and never aside (extra usage or not), so they count
every model, Droid Core's open models included. Droid Core's windows
become aside (shown only) and Extra usage stays aside. Off, the windows
are exactly as before.
magpie only leaves an account out before sending when it is held at a
usage cap (gateway perKeyBarred/capHeld; order routing tries a used-up
account and benches it only after Factory refuses). The README says to
pair the option with an account cap (magpie provider account-cap
factory <account> 99): then a held account is out before affinity, the
next account takes the same model, and with every account held magpie
answers 429 without sending.
Run at this commit, rebased on origin/main 74be632 (TMPDIR and HOME
under a scratch dir; the factory run was at d1b6500):
- bun test packages/factory: 174 pass, 0 fail
- bun test (whole repo): 2383 pass, 0 fail, exit 0
- bun scripts/check.mjs: exit 0
Broken by hand, usage.test.mjs's two new tests:
- index.mjs back to origin/main: both red
- usage not passing the option to limitWindows: the switch test red
- Droid Core's windows not aside under the option: both red
Not tried: a real Factory account, a real magpie host reading the
switch, or routing with a cap set (read from magpie's source only).
poer2023 (#302): anthropicBody() dropped every top-level system text
block, and a string system, that starts with
"x-anthropic-billing-header: cc_version=". When the header and the
instructions after it arrive joined in one block or one string (Claude
Code's auto-mode classifier policy, for one), the instructions went with
it and Factory got only the Droid identity.
Fix: only the header's first line goes. The rest of the text stays, and
the block keeps its other fields (cache_control and the rest); the rest
then goes through promptText like any other system block, so an identity
line after the header is still made Droid's. A block, or string, holding
only the header (or the header and blank lines) is still dropped.
Siblings: grep -rn "x-anthropic-billing-header" packages/ finds only one
other plugin that strips it, workbuddy (FLAGGED), which already removes
just the line with /x-anthropic-billing-header:[^\n]*\n?/gi and keeps the
rest (unflag.test.mjs covers "header\nhello" -> "hello"). kiro and
antigravity-cloak only carry it in fixtures or escape it. No other
plugin has the bug.
Test: request.test.mjs "a billing header joined with instructions loses
only its own line (#302)" takes the reporter's literal inputs (billing
"cc_version=2.1.300; cc_entrypoint=cli;" + "Preserve this task
instruction. SYSTEM_POLICY_SENTINEL"): joined block with cache_control,
joined string, separate blocks, billing only, billing plus blank lines,
on /v1/messages and /count_tokens, checks the exact system sent, that
messages and max_tokens are unchanged, and that a second pass of the
sent body is byte-for-byte; plus a header followed by Claude Code's
identity line.
Run:
- packages/factory: H=$(mktemp -d); HOME="$H" bun test (bun 1.4.2):
172 pass, 0 fail across 16 files.
- Broken by hand: with index.mjs at origin/main 3d355d3 the new test
fails (70 pass, 1 fail); with the fix, 71 pass.
- The reporter's offline repro-billing.mjs from the issue, run with
node against the fixed index.mjs: all four cases pass (joined block,
joined string, separate blocks, billing only), network false.
Not tried: a real Factory account or Claude Code's auto mode end to end;
the check stops at the body handed to the stubbed fetch.
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.
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.
Factory refuses one sentence in Claude Code's built-in update-config skill description. The plugin reworded it only when the entry was a whole line in the skill-list reminders, and only without a slash. claude-code-guide's own system prompt renders the entry as `- /update-config: …` under "# User's Current Configuration", so its first request was 403.
This change matches the entry by name, with or without the slash. It rewords only "not Claude" to "not the assistant" inside that entry. The rewording now also runs on system prompt blocks (promptText) and at the existing call sites (bareSkills, announcedSkills, announcedContext, generatedContext, userBlockText). factory 0.1.32 -> 0.1.33.
What was run at af6422e (reviewer):
- bun test packages/factory: 153 pass, 0 fail. bun scripts/check.mjs factory: ok. git diff --check: clean.
- Broken by hand: with promptText's configSkillText call removed, 2 of the new tests fail.
- magpie plugin host (magpie main cb05dc2d1), with a copy whose API/WorkOS hosts point at a local fake:
- API-key sign-in worked.
- /v1/messages with a claude-code-guide-shaped system prompt went out with block 0 as the Droid identity and the update-config entry reworded. A user's "/custom: Keep not Claude" entry was left unchanged, and the stream came back 200.
- No new hosts, telemetry or dependencies.
Every model in MODELS carries the tokenMultiplier droid 0.241.1's registry
has for it (testdata/droid-0.241.1-costs.txt, byte for byte). A promotion
running takes its discount off it, with the multiplier before it as rateWas;
one that has ended or not begun is no discount. The rate reaches magpie
through a provider hook (host.js reads rate/rateWas from its models; a
config hook's models carry no rate there). Fast Mode entries stay last.
Reviewed at 498b8723e5350657aa26f8f0e2bb1d859f59803b:
- each multiplier and promotion checked against the testdata excerpt;
gpt-5.6-sol's expired M promotion is skipped and Pt (20%) applies, as
droid's first-running-promotion rule gives
- host.js info(): the provider hook's list replaces the config list, and
the request path strips temperature for OpenAI models in droidBody, so
capabilities.temperature=true in providerModel changes nothing sent
- factory unchanged on main between the PR's base 7687314 and fe5631c
Run (HOME=$(mktemp -d), PR head merged with main fe5631c):
- bun test: 1620 pass, 2 fail; the two are cursor latency.test reds under
the full run at load ~260, already filed as #159 and #162; packages/cursor
alone: 267 pass, 0 fail
- bun test packages/factory: 149 pass, 0 fail
- packages/factory/rate.test.mjs against main's index.mjs: 5 fail
- bun scripts/check.mjs: passes
Not tried with a real Factory account here (the author did, 46 models).
OpenAI's reasoning models turn temperature and top_p away with a 400, and
droid sends neither. droidBody now takes both out of a Responses request
for a model whose upstream is openai, also when the body already opens
with droid's line. configModels says temperature: false for those models,
so OpenCode doesn't send it either. Grok and the chat-completions models
keep theirs.
Run: bun test in packages/factory, 144 pass. The new test fails on 0.1.30's
index.mjs (temperature still in the body). Not tried against Factory's API
with a real account.
sky杨, on magpie 0.1.1254 with this plugin at 0.1.29, got 403 "Factory:
Forbidden" from Claude Code on every model, GPT, Claude and Gemini alike.
Factory's body was a bare "Forbidden", not a phrase-specific refusal.
Header diff against droid 0.242.0 (npm droid and @factory/cli-darwin-arm64
0.242.0, unpacked with --ignore-scripts into an empty directory and read
with strings, never run). Its model requests carry: Authorization,
X-Factory-Client: cli, X-Client-Version, X-Factory-Org-Id, User-Agent
factory-cli/<ver>, x-session-id, x-assistant-message-id, x-api-provider,
x-provider-routing-source (registry_default without a routing claim),
OpenAI-Platform: org-bHuLtG1fGmYk5YaOihAAXFBw for openai/azure_openai,
and X-Api-Key "placeholder" from its Anthropic client. The plugin sends
each of these with the same value, apart from the release: 0.233.0, nine
releases behind. The WorkOS client id is unchanged. droid's binary still
reads a server-side min_cli_version flag and runs a forced auto-update.
0.1.16 was the same case (JL: every model 403 "Forbidden" from pi and
Claude Code while droid worked; the plugin said 0.231.0, two behind), and
JL's later reports (0.1.25) were about models, not refusals. Whether
Factory refuses an old release with a 403 is still not confirmed: there is
no Factory account to try with. This is the one header difference found.
Run: bun test in packages/factory, 143 pass. With VERSION put back to
0.233.0, droid.test.mjs goes red (Expected "0.242.0", Received
"0.233.0"). bun scripts/check.mjs factory: ok.
Not tried against Factory itself.
Full suite: bun test (packages/factory) 143 pass
Echoo, with Factory moved onto this plugin, got "API Error: 403 Factory:
Forbidden" from Claude Code on GLM-5.3-Flash, while Codex worked on the
same account and model. GLM is a chat model Factory serves on /api/llm/o,
so magpie translates Claude Code's Messages request into chat completions
(or Responses) before the plugin gets it. Only anthropicBody, the
/api/llm/a route, adapted Claude Code's fixed phrases Factory refuses (its
identity line, "You have been invoked in the following environment", "You
are powered by the model", update-config's "not Claude, so memory", tool
output quoting them). droidBody, for /api/llm/o, only added droid's line,
so all of them went to Factory as they were. The headers, the model and
the account are the same for both agents; Codex's prompt has none of the
phrases.
anthropicBody's per-text adapters are now functions of their own
(claudeIdentity, promptText, systemMessageText, userBlockText), and
droidBody applies them to chat completions and Responses:
- chat's first system message and Responses' instructions as a system
prompt; other system and developer messages as system messages;
- user text as a user block; a chat user string, where magpie joins a
turn's blocks with nothing between them, also reminder by reminder;
- chat's tool messages and Responses' function_call_output as tool output.
The Messages route is unchanged: the refactor kept every earlier test
green before the new code went in.
testdata/claude-code-2.1.300-glm-{chat,responses}.json are magpie's
translations of a real Claude Code 2.1.300 request, captured in a sandbox
HOME (paths changed to /Users/me, tools left out).
Run: bun test in packages/factory, 143 pass. With index.mjs at 0.1.28 the
new claude-chat.test.mjs fails 4 of 5 (the Codex one passes on both).
bun scripts/check.mjs factory: ok. Routed the captured request through the
plugin: each refused phrase is 0 in the chat and Responses bodies now, as
on /api/llm/a (1 each with 0.1.28).
Not tried against Factory itself: there is no Factory account to try with.
magpie shows a provider with no models picked only the first 24 of its
list. 0.1.27 placed each Fast Mode model beside its base model, which
pushed GPT-5.3-Codex, Grok 4.7, Grok 4.6, GLM-5.3 and GLM-5.3-Flash past
24 ("not exposed"). The six Fast Mode models now come after every other
model, so the first 24 are 0.1.26's again. Asking a base model for fast
still reaches its Fast Mode model (fastBody), and a Fast Mode model can
be picked by name.
Run: bun test packages/factory (138 pass), bun scripts/check.mjs (all
plugins pass). The new fast.test.mjs case fails on 0.1.27's order (put
back by hand: 3 pass, 1 fail) and passes with this one.
Not tried: a real Factory account; magpie's exposure was not run against
the published package, only the list order checked.
psylch on #119 (plugin 0.1.26): claude-opus-5-5-fast answered "Factory:
Not found.", and Opus 5.5 asked with speed "fast" was recorded as
tier_asked fast, tier_served standard, with nothing said.
The plugin now offers droid 0.240.0's Fast Mode models: Opus 5.5/5/4.8
Fast on Anthropic's API, GPT-5.5/5.4/5.3-Codex Fast on Responses, each
at its base model's limits and efforts. They go out as droid 0.240.0
sends them (read from its binary, saved in testdata/droid-0.240.0-fast.txt):
the Fast Mode id itself as the model, with speed "fast" and the
fast-mode-2026-02-01 beta for anthropicFastMode models, at service_tier
"priority" for the GPT ones (their apiRequest Ee). A request asking a base
model for fast (speed "fast" on Messages, service_tier "priority" on
Responses) is sent to its Fast Mode model, as droid's fast toggle
switches to it. A model with no Fast Mode model is sent as asked. Left
out: Opus 4.6/4.7 Fast and GPT-5.4 Mini Fast (base not offered), GPT-5.6
Sol Fast (unreleased:!0), GLM-5.2 Fast (feature flag, a Baseten id).
Run: the full bun test (1222 pass, 0 fail) with a sandbox HOME; the new
fast.test.mjs and the picker test fail on the old index.mjs (4 fail).
Not tried: a real Factory account (none signed in here), so whether
Factory serves the Fast Mode ids at fast speed to a plan, and what its
usage says about speed, is unverified. A non-stream request magpie
translates for a plugin account drops speed before the plugin sees it,
so there only the -fast ids reach fast.
Ziqi-Cui's Codex session on Opus 5.5 gathered nine screenshots, ~4.5 MB
of data URLs, and Factory answered every request after with 413 "Request
Entity Too Large". The plugin passed the 413 on as it came, which reads
as the context window; it is Factory's limit on a body's bytes.
On a 413 from Factory the plugin now sends the request once more with
every image and file but the newest replaced, in place, by a line saying
it was left out (droid 0.239.0 removes older images/PDFs from large
requests the same way). Anthropic image/document blocks, Responses
input_image/input_file, chat image_url/file and Gemini inlineData/fileData
are found wherever they are, tool results included, so every tool call
keeps its result; a Gemini function response's parts, which take inline
data alone, drop the image instead. One retry, never more; none when
there is nothing older to leave out.
If the 413 stands, or nothing could be left out, the error (Anthropic's
request_too_large, else invalid_request_error) gives Factory's words,
says the limit is on the body's bytes and what was left out, and carries
magpie's gateway 413 hint word for word (compact, or start a new
session), so the gateway, finding it, doesn't add it twice and OpenCode
users get it too. The words avoid what the gateway reads as a context
overflow, so it stays a 413.
The caller's own session and files are untouched: only the body sent to
Factory changes, and only on the retry.
Run: bun test in packages/factory (134 pass), bun scripts/check.mjs.
Broken by hand: without the 413 branch, three of size.test.mjs's four
tests fail. Not tried: a real Factory account (none here) or Factory's
real limit, which neither droid's binary nor its changelog states; the
fake upstream refuses over a chosen size.
The plugin offered no Gemini model, so Gemini 4 Argon, new in droid
0.241.1's picker, and the Gemini 3.x models magpie's built-in has were
missing for everyone moved onto the plugin.
- Gemini 4 Argon, Gemini 3.1 Pro, Gemini 3.8/3.7/3.6/3.5 Flash and
Gemini 3 Flash are offered on @ai-sdk/google at /api/llm/g/v1, with
droid 0.241.1's names, total context 1M, output 65536, efforts and
images. Each effort is a thinkingConfig thinkingLevel, as the zed
plugin sends Gemini's.
- send() takes the Google package's models/<id>:streamGenerateContent
to Factory's /api/llm/g/v1/generate, as the built-in does (pathOf
Gemini, FactoryGemini): the model in the body, no stream field, the
system instruction without a role and opened with droid's line like
factoryDroidGoogle. x-api-provider is google; the Google package's
x-goog-api-key is dropped. A rewritten body no longer keeps the
caller's content-length.
- Gemini counts in standard's windows, not Droid Core's, as the
built-in's factoryCore has it.
- Gemini 4 Argon is behind a Factory feature flag (featureFlag
Gemini4Argon, unreleased) in droid 0.241.1; an account it isn't on for
may be refused it.
testdata/droid-0.241.1-gemini.txt is droid 0.241.1's picker and Gemini
entries, byte for byte from @factory/cli-darwin-arm64@0.241.1 bin/droid
(each line checked present in the binary). muse-spark-1.2, also new in
that picker, is not added here.
Run: bun test in packages/factory (130 pass), bun scripts/check.mjs.
Broken by hand: without the route rewrite the three gemini.test.mjs
tests fail; without google in CORE's exclusion usage.test.mjs fails.
Not tried: a real Factory account (none signed in here), so neither
Factory's answer to these bodies nor Gemini 4 Argon's flag was seen.
JL (Windows, droid 0.240.0, Factory desktop 0.197.1, magpie 0.1.1226,
plugin 0.1.24): droid and Factory desktop offer claude-haiku-5-5, droid
through magpie didn't, as the plugin's model table didn't have it.
How droid gets its models: its npm package (@factory/cli 0.240.0, the
platform binary @factory/cli-darwin-arm64) bundles the model registry in
bin/droid; the picker lists that registry (order `y`), gated by
availableInCLI, unreleased, feature flags and legacy grouping. Diffing the
registry of 0.233.0 (the release the plugin's table was last matched to)
against 0.240.0 gives three new models: claude-haiku-5-5, mistral-large-4
and gpt-6-astra-ultrafast.
- Haiku 5.5: Anthropic Messages, x-api-provider anthropic, context
872000 / output 128000 (contextLimits ce, as Sonnet 5.5 and Opus 5.5),
efforts low..max (droid's "off" is the request without a level).
- Mistral Large 4: generic chat completions, x-api-provider mistral, Droid
Core (billingPool core), 524288 / 64000, images, effort high.
- GPT-6 Astra Ultra Fast stays out: droid offers it only once the user has
accepted Factory's high-cost terms (explicitOptInRequirement high_cost).
models.test.mjs is new; its fixture (testdata/droid-0.240.0-models.txt) is
the registry's own bytes: the picker order, the context helper and the three
entries. It checks the two models as droid has them and that every model in
droid's picker is offered or on a named list left out (router, Gemini,
unreleased, opt-in, the older generations the plugin never offered). With
the Haiku 5.5 line removed both tests fail. usage.test.mjs's Core list
gains Mistral Large 4.
Run: bun test in packages/factory (126 pass), bun scripts/check.mjs factory;
a fake Factory saw /api/llm/a/v1/messages with x-api-provider anthropic for
claude-haiku-5-5 and /api/llm/o/v1/chat/completions with mistral for
mistral-large-4. Not tried against Factory itself (no Factory account here);
droid itself was not run.
* factory 0.1.23: a resumed turn's restored skills reach Factory wherever they sit
#68 took 0.1.22, so this moves to 0.1.23.
Claude Code 2.1.292 session 1a2063e5 is the turn Factory answered 403.
Its transcript renders the post-compaction attachments, in order, as system
reminders: a token marker, a restored Read and its result, an omitted-file
note, the invoked-skills reminder, the agent-type list, MCP server
instructions, the environment paragraph and the model line. No token marker
follows the skills reminder. The snapshot's contextRendering is "announced",
so the same paragraphs also travel unwrapped in one system turn. The request
bytes were not in the routing log; the fixture is those rendered paragraphs,
unwrapped, in that order.
announcedContext used to reassemble the reminder only when a token marker
came right after it, and then treated everything up to that marker as skill
text. A reminder at the end of the turn, or followed by a Read, the
environment or a hook, kept the refused opening. A reminder with other
attachments and a later token swallowed those attachments into the skill
encoding.
The refused part is the fixed opening plus the complete IMPORTANT paragraph.
That complete reminder is rephrased wherever it sits. Skill text now ends at
the next paragraph the adapter already knows (token marker, hook, restored
Read, omitted-file note, Read result, environment, model line, skill-list
header, changed-file note, agent-type list, MCP instructions) or at the end
of the turn. Those following paragraphs stay themselves and are adapted on
their own. A second pass is byte-for-byte. Quoted fragments, an incomplete
IMPORTANT paragraph, a hook that owns the reminder and assistant content stay
untouched.
0.1.22 was not tried against Factory: the installed copy stayed 0.1.21, and
this change was not sent to Factory either.
Run: HOME set to an empty temp dir, bun test packages/factory: 120 pass,
0 fail. node --check packages/factory/index.mjs, bun scripts/check.mjs
factory, and git diff --check are clean. The new test covers the captured
order plus a reminder at the end of the turn, a reminder followed by Read,
environment and a hook, and a quoted skill body. Fetch is stubbed.
* factory 0.1.23: restored skills open a resumed turn without token metadata
A resumed turn can start with the complete invoked-skills reminder when no
files were restored and totalTokensReminder is off. restoredContext now
recognizes its exact opening and IMPORTANT paragraph through the existing
invokedSkillsMatch and attachment boundaries. A restored-file opening can
also use the complete skills reminder as evidence when it ends the turn.
Adapted openings, incomplete reminders, quotations and hook-owned output
retain their existing behavior.
Cover no-token system turns and folded user text on inference and token
counting, including standalone reminders, trailing tokens, omitted-file and
Read prefixes, exact skill decoding, cache metadata and byte-for-byte second
passes. Each of the six boundaries missing independent regression coverage
now follows a quoted skill directly. README documents the no-token forms.
Run with HOME set to an empty temporary directory: bun test packages/factory,
121 pass, 0 fail. node --check packages/factory/index.mjs,
bun scripts/check.mjs factory and git diff --check pass.
Removing each of the omitted-note, Read-result, model, skill-list, MCP and
changed-file boundaries makes the new independent regression test fail.
The whole-project test suite is left to CI. Fetch is stubbed; no request was
sent to a real Factory account.
* factory 0.1.24: main already published 0.1.23 (#71), so this change takes the next version
#71 shipped factory 0.1.23 while this PR waited, so npm has 0.1.23. This
only moves the version, so the squash publishes as 0.1.24.
Run: merged onto main a885a16, HOME=<scratch> bun test packages/factory:
124 pass, 0 fail; bun scripts/check.mjs: all pass.
---------
Co-authored-by: chenguoqing <chenguoqing@kemai.cn>
Co-authored-by: yetone <yetoneful@gmail.com>
Claude Code with the context-management beta sends context_management
(here clear_thinking_20251015, keep all). Factory's streaming route
answers it with 400 "context_management: Extra inputs are not permitted";
the same body with stream false, or without the field, gets 200 (the
reporter's three cases). A streamed /messages request now goes without
the field; an unstreamed one keeps it. The server then clears nothing,
and Claude Code's own compaction still runs.
The version bump also releases the previous commit's #72 fix.
Run: HOME=<tmp> bun test in packages/factory, 119 pass (1 new from the
reporter's body; the existing all-fields test now expects the field gone
on its streamed request). With the deletion disabled by hand both go red.
Not sent to Factory: no Factory account here.
Claude Code also sends the skill list as a standalone system message with
only its entries: no header, no <system-reminder> wrapper, no
<total_tokens> tail, as text blocks and (later in the same session) as a
plain string. The adapter only knew the headed and token-terminated forms,
so the update-config line went through unchanged and Factory answered
403; the reporter got 200 with only "not Claude" -> "not the assistant".
bareSkills applies that same known-line change to a system message that
opens with a "- " entry, both content shapes. User messages, quoted lists
and other skills' lines are left alone.
Run: HOME=<tmp> bun test in packages/factory, 118 pass (2 new, the
reporter's body byte for byte as fixture). With bareSkills made a no-op
by hand the new test goes red. Not sent to Factory: no Factory account
here.
After /compact, Claude Code 2.1.280 sends the files it restores and the
session's runtime context as one system text block with no reminder
wrappers and no opening token marker: restored-file notes ("Note: <path> was
read before the last conversation was summarized…"), "Called the Read tool
with the following input: {…}" and its result, "# Environment\nYou have been
invoked in the following environment:", the model line, token and date.
The reporter's bisect shows Factory 403s on each of those fixed fragments,
and 0.1.21 matched none of them: SYSTEM_ENV_CONTEXT is anchored at the
block's start, COMPACT_READ / COMPACT_FILE need a standalone wrapped
reminder, and the token-prefixed bundle path needs a leading token marker.
restoredContext recognizes the complete turn: its first paragraph is a
generated restored-file note or Read call (as COMPACT_FILE / COMPACT_READ
would match it wrapped), and a later paragraph, before any hook output, is
the generated environment paragraph or a token marker. Then
announcedContext adapts every paragraph from the first on, with the
existing compat spellings (Previously read file…, # Runtime context / The
session environment is:, Current model name / Model ID / Model knowledge
cutoff) and the lossless JSON encoding of Read results; everything else
stays byte-for-byte. It runs for system-role strings and text blocks and
for the same block folded into user text. An adapted turn no longer opens
with the generated note, so a second pass is byte-for-byte.
Quoted, incomplete (no environment or token), hook-owned and assistant
forms are left untouched.
Run: bun test (packages/factory: 116 pass; repo: 1010 pass, 0 fail),
bun scripts/check.mjs (all pass). The two new tests use the issue's literal
fragments (several notes, Read call + result, environment, model line with
claude-opus-5-5[1m], token, date); the adapting one fails on 0.1.21's
index.mjs, and removing the env/token requirement, the hook guard, the
user-text path or starting at paragraph 1 each turns a test red. PR #66
applied on top passes too (119 factory tests). Stubbed fetch only; no
request was sent to Factory (no Factory account here).
After pi compacted a session, every turn on factory/claude-opus-5-5 was 403
"Factory: Forbidden". The reporter's replays through magpie found the
refused part: the sentence pi opens its summary message with,
"The conversation history before this point was compacted into the
following summary:" (pi-coding-agent dist/core/messages.js
COMPACTION_SUMMARY_PREFIX, the same in 1.0.4 and 1.1.0), whole; with it
removed, reworded or halved the request was answered.
A user text that is pi's whole summary message (the sentence, a blank line,
<summary>, and </summary> last) now opens "Earlier conversation context is
summarized below:", the summary itself unchanged. pi's other fixed summary
opening, BRANCH_SUMMARY_PREFIX ("The following is a summary of a branch
that this conversation came back from:"), is reworded the same way; that
Factory refuses it is not confirmed. On Messages (string content and text
blocks), chat completions and Responses user messages alike. The sentence
quoted by a user, without pi's summary around it, or in an assistant turn
goes on as it is.
pi.test.mjs: 3 new tests; the two adaptation tests fail on 0.1.20
(Expected/Received differ on the summary text), the third checks what is
left alone. bun test (114 pass) and bun scripts/check.mjs factory pass.
Not tried against Factory itself (no Factory account here).
MODELS predated GPT-6.1 Sol, so a droid account whose policy allows the
model could not reach it through the plugin. droid's built-in picker, read
by giving "droid exec -m" an id it rejects (it prints the whole list),
names it gpt-6.1-sol — droid spells the minor with a dot, as it does
gpt-5.6-sol, not the gpt-6-1-sol other providers' plugins carry.
It goes on RESPONSES with openai as its vendor, 1050000 context and
128000 output like the rest of the GPT-6 family, images on. Factory's
docs list low, medium, high, xhigh and max for it and no none (gpt-6-sol
and gpt-6-luna have one), so it takes E5 rather than E6. The same docs
were read against the other 30 entries: their efforts are correct.
The picker also offers 19 models this list lacks: Claude Opus 4.5, 4.6
and 4.7, Claude Sonnet 4.5, GPT-5.2, GPT-5.4 Mini, GPT-5.5 Pro, Grok
4.5, DeepSeek V4 Pro, the DeepSeek V4 Flash 0731 snapshot, Inkling, and
nine -fast variants. The superseded ones were left out, and the rest
carry no context or output figure from Factory, from the picker or from
the other plugins here — writing a guessed limit would mislead. The list
stays what droid offers, not what one organization's policy allows: of
the entries already here, 21 are blocked by the account this was checked
on.
Tests: bun test (458 pass) and bun scripts/check.mjs factory pass. The id
was confirmed against droid 0.233.0's picker and passes that account's
policy and effort validation; no inference request was sent.
anthropicBody adapted a role:"system" message only when its content was a
string, so Claude Code 2.1.288's context as [{type:"text",...}] reached
Factory unadapted and was refused (403). Each text block of such a message now
goes through systemContext, its other fields and non-text blocks kept; a user
text block opening with the generated environment context (a system message
folded into the user's turn) is adapted too. The top-level system already
treats a string and an array alike, and the OpenAI route adapts no context.
Tests: the #658 shape (fails on 0.1.13), string/array parity, idempotence;
two tests that asserted array content was left alone now use text outside the
generated shape. Not tried with a live Factory account.
Factory refused three generated phrases the adapter left as they were:
- the instructions reminder's "(user's private global instructions for all
projects)" naming ~/.claude/CLAUDE.md, now "(global instructions)" in that
reminder only;
- Claude 5's runtime context after a SessionStart hook's output, as a system
message or folded into the user's turn: the context after the hook is
adapted as it is alone, the hook's output left as it is;
- the model line inside a system prompt (Claude Desktop's), adapted as in a
reminder.
Three tests cover them and fail without the change; bun test passes.
auth.refresh with refreshLead 3 minutes (in-fetch: 2). It renews under
the lock the request path and mendOrg already share, asks whoami again as
droid does, and gives the tokens and org fields. A renewed map (spent
refresh token → what it gave) lets a request that read the old sign-in
before magpie saved go on with the new one, and keeps rotated tokens when a
save fails. WorkOS refusing the refresh token is signIn "expired" (as the
request path's lapse already was); 429 and 5xx throw and are retried.
The check before each request stays for OpenCode, which doesn't call the
hook (magpie 0.1.684+ does). refresh.test.mjs fails without the change;
HOME=$(mktemp -d) bun test passes (396 across the repo).
.github/workflows/publish.yml runs the tests (in a throwaway HOME) and
scripts/publish.sh on each package.json change pushed to main, or by hand;
npm's OIDC exchange stands in for a token and an OTP. Every package now
names magpie-community/plugins' publish.yml as its trusted publisher on
npmjs.com, and gets the repository field npm checks it against.
After /model, Claude Code 2.1.287 sends a separate string-content system message that opens with the new model paragraph and carries <total_tokens> metadata but no environment block; Factory refused it with 403, so continuing a conversation after a model switch failed. systemContext now also adapts that shape: only when the message starts with the model paragraph and has a complete generated <total_tokens>N tokens left</total_tokens> paragraph, it rewrites each whole model paragraph (named or not, routing-group ids, accumulated switches) to Current model / Model ID / Model knowledge cutoff, leaving every other byte, role and order as sent; inference and count_tokens share it, and a second pass is byte-identical. Tests cover accumulated switches across both endpoints with idempotence, and pass-through for incomplete markers, quoted text, array content and non-system roles. Factory bumped to 0.1.9.