factory 0.1.41 renames ZCode's generated environment paragraph to the
runtime-context wording and ZCode's restored-read reminder ("Called the
Read tool with the following input:") to a previously read file, both of
which Factory answered with 403 Forbidden. keepMovedCurrent updates every
moved user's plugin from 0.1.40 to 0.1.41. Nothing in the account shape
changes.
npm view @magpie-community/opencode-factory-auth version --prefer-online
says 0.1.41 at landing.
Run (mote-run, at this tree): gofmt -l internal/provider (clean);
go vet ./... on darwin, GOOS=linux -tags nogui, GOOS=windows (ok);
go test -tags nogui ./internal/provider -timeout 45m (ok, 87.8s).
Not tried: a real Factory account through ZCode.
sweanng (Discord #general, ZCode + Factory + GLM 5.3) got Factory's
usage policy refusal shown as "Provider authentication failed"
(reason=auth_failed status=403). The refusal is Factory's own; the label
was wrong. Factory refuses at 403 with code content_policy_rejected. The
Factory plugin (up to 0.1.39) handed it on as a 403 permission_error
with no code, magpie didn't know the code as a refusal, so the 403 went
through as is and the agent read it as an auth failure.
- policyRefusal knows content_policy_rejected (Factory's code, in its
own top-level and error.code shapes and the plugin's), so the existing
refusal path answers every protocol with 400 and its own request
error: Anthropic invalid_request_error, OpenAI chat and Responses
invalid_request_error, Gemini INVALID_ARGUMENT. Not asked again of the
same account; other accounts/members follow the Refusal retries
setting as for any refusal.
- restAfter leaves the account unrested for a policy refusal at 403 too,
not only 400 (it rested "other by backoff" before).
- The refusal note keeps up to 1000 bytes of the vendor's message, not
300: Factory's advice (start a new session or drop the quoted text)
and OpenAI's Daybreak link were cut.
- Factory mover min 0.1.40 (plugins #494, on npm as latest): the plugin
now answers this refusal as a 400 invalid_request_error carrying code
content_policy_rejected; its other 403s stay permission_error.
Siblings checked: Devin's plugin maps its content policy to 400, Qoder's
sensitive codes and Zhipu's 1301 are request errors already; Factory was
the one content refusal sent as a 403.
Run (mote, rebased on origin/main 96a703a59, with the next commit):
go test -timeout 45m -count=1 ./internal/provider: ok
go test -timeout 45m -count=1 ./internal/gateway: ok (768s)
(the first gateway run at this commit alone failed only
TestUnroutedUnknownHoldAnsweredSooner's TempDir cleanup, a race in
the test fixed in the next commit)
gofmt -l internal/: clean
plugins: HOME=$(mktemp -d) bun test packages/factory 178 pass;
bun scripts/check.mjs ok.
Broken by hand: with fallback.go and routing.go reverted, all three new
tests fail (403 permission_error / PERMISSION_DENIED reaches every
protocol; policyRefusal false; rests "other by backoff"). With the note
cap back at 300, TestFactoryPolicyRejectedIsARefusal and
TestFactoryPolicyRefusalReachesAgentsAsARefusal fail (advice cut). With
the plugin's index.mjs reverted, content-policy.test.mjs fails 3 of 6.
Not tried: a real Factory content_policy_rejected (no way to trip it on
purpose), and ZCode itself reading the 400: its error mapping isn't in
any source I could find, so ZCode showing it as a refusal is expected
from the Anthropic invalid_request_error, not seen.
npm has @magpie-community/opencode-factory-auth 0.1.39 since 10-29
(plugins fada6e0, from Wangzehong111's #480): DeepSeek V4.1 Flash 1017,
droid 0.251.0's entry, sent to its registry default upstream, Fireworks.
sweanng on Discord found the Factory list had DeepSeek V4.1 Flash but no
1017. keepMovedCurrent installs min, so moved users get it from this
release.
Run on mote at this tree (origin/main 5143bf593 + this line):
- go test -timeout 45m ./internal/provider/: ok (209.6s).
- GOOS=linux and GOOS=windows go vet ./internal/provider/: ok. gofmt clean.
- plugins side: full bun test (HOME=$(mktemp -d)) on mote at load ~100:
factory 176 pass; 4 reds in untouched packages that pass alone, filed
as plugins #490, #491 and noted on #210, #489. bun scripts/check.mjs ok.
Moving 1017 back to baseten turns the new droid test red.
Not tried: a real Factory account sending to 1017 (Factory gates it with
a feature flag).
npm has @magpie-community/opencode-factory-auth 0.1.38 since 10-24
(plugins b04cca3): the "Standard usage only" plugin option, which stops an
account once its Standard window is used up and moves on to the next. The
mover's min stayed 0.1.37, and keepMovedCurrent only installs min, so no
moved user could get the option.
Run on mote at this tree (origin/main 4b0a32e0f + this line):
- go test ./internal/provider/: red on two filed reds unrelated to the
mover, #3632 (filememo synctest fatal in
TestUnreadLoginsWriteErrorsKeepCredentials, 2 of 2) and #3854 (the
three TestFetch* shared-base tests).
- the same with those four tests skipped: ok (93s).
- GOOS=linux and GOOS=windows go vet ./internal/provider/: ok. gofmt clean.
Not tried: a real Factory account taking the update.
factory 0.1.37 (plugins bb020ce) drops only the billing header's own
line from a system block or string, so instructions joined after it,
such as Claude Code auto mode's classifier policy, reach the model.
Raising the mover's min updates every moved user's plugin.
npm view --prefer-online --registry https://registry.npmjs.org shows
0.1.37 for @magpie-community/opencode-factory-auth.
Run at this commit's tree (on origin/main c036d6c34): gofmt -l clean,
go vet ./internal/provider, go test ./internal/provider ok (86.9s).
Not run: the full suite. The machine has 3.8Gi free, under the 8Gi a
full run needs; the change is one string in the movers map, which only
internal/provider reads.
Not tried: a real Factory account through magpie on 0.1.37. The plugin
side ran the reporter's offline repro against the published tarball.
factory 0.1.34 (magpie-community/plugins cdf4513) adapts Claude Code
2.1.292+'s instructions reminder when the files are re-read after
compaction (changed: true, "Instruction files were re-read after the
conversation was compacted; these differ from their earlier copies —
each replaces its earlier copy, ..."), as it did the first one, and its
rebuilt 403 keeps Factory's request id and error code.
`npm view @magpie-community/opencode-factory-auth version --prefer-online`
gives 0.1.34. keepMovedCurrent updates every moved user's plugin to it.
Run at ab7ec8c65 (macOS, go1.26.8, sandbox HOME), both commits in the
tree: gofmt, three vets clean; set -o pipefail; go test -timeout 45m
./...: exit 0, 64 packages ok, no FAIL (load ~200).
Rebased onto b641868eb (origin/main, which moved gateway.go and
routing.go: b749cffbb's reply-room retry on a 400, b641868eb's
heldClockIn; neither touches the 403 path) and run again at a33699df6
(this pair's tree), macOS, go1.26.8, sandbox HOME: gofmt -l none; go
vet ./... (darwin), GOOS=linux go vet -tags nogui ./..., GOOS=windows
go vet ./...: all clean. go test -count=1 -timeout 45m
./internal/provider: ok (809s). go test -run
'TestPlain403|TestOrderedKeepsAnAccountAt98|TestPromptRefusalRestsNobody|ReplyFitsTheWindowLeft|TestHeldClock|Rest|Forbid|403'
./internal/gateway: ok (110s). go test -count=1 -timeout 45m
./internal/gateway: ok (1762s, load ~300). A full ./... at a33699df6 was started
and stopped after 46 minutes with one package done (load 320-420 from
other sessions, disk at 8.7G free); the earlier full run of the same
two commits on ab7ec8c65 was exit 0, 64 packages ok.
"factory" joins retiredBuiltins: every Factory account is served by
@magpie-community/opencode-factory-auth, and the hourly MoveRetiring
moves the ones still on the built-in.
Removed: the built-in's sign-in (factory_signin.go, WorkOS's device
flow), keeping the sign-in (renew, lapse, org reconcile and mend,
headers, factoryGet), its provider and account (factoryProvider,
factoryAccount, factoryAlsoOn), its login list, switch, on/off and
forget, its usage card (factoryLoginQuota), droid's prompt and body
rewriting (factory_client.go), and its rows in signin.go, logins.go,
logins_on.go, login_usage.go, subscription_usage.go and account.go.
zcodeDecode/Encode, kept in zcode.go only for factory_client.go, go
with it. An API key always goes to the plugin now (factoryAddKey), and
`magpie accounts import factory` keeps saying to add it with accounts
add factory; its dead import branches are gone.
Kept: the mover and what it reads (factoryLogins, factorySaved,
factoryCreds, factoryMu); ImportFactoryKeys, factory_key.go and
factoryWhoami, for "Use an API key instead"; droid's model table with
factoryAPIs and factoryCore, since the plugin's provider is named
"factory" (account.go APIs, FactoryGemini and servedByFactory still
answer for it); factoryAPI for the moved provider's host
(builtinHost); factory_usage.go's limits reader behind
FactoryAllowanceForTest, which the gateway's pool tests use; the
gateway's "factory" lists (estimatedMoved, the account check), as the
Zed commit kept zed's; the parity tests.
Tests:
- git rm'd, built-in only: factory_test.go (sign-in, refresh, accounts,
orgs), factory_client_test.go, gateway factory_agents_test.go
(droid's line on every wire, the generate route to chat) and
factory_think_off_test.go (TestPluginThinkingOff covers the plugin);
TestFactoryAPIKey, TestFactoryKeyAgainReadsUsageAfresh,
TestFactoryServesModelsAddedSinceItsFetch, TestUserAgentAccountUntouched
(TestUserAgentFor still covers an account's User-Agent).
- Changed meaning: TestGeminiEmptyReplyIsAnError,
TestGeminiEmptyRepliesAskedAgain and TestGeminiImageModelReturnsItsImage
used Factory's generate route as a fake-able Gemini upstream; they now
use a Gemini API of the user's own (saveGem), the same decoder, and the
image test checks :streamGenerateContent instead of /api/llm/g/v1/generate.
TestMovedShowsBuiltinHost's first check is now a plain plugin
(fakeco), and a retired Factory with no migration record shows
api.factory.ai. TestFactoryAPIKeyMoved checks factoryLogins() is empty
instead of the removed factoryLookup. factorySite/factoryJSON moved
into factory_key_test.go.
Run in this worktree:
gofmt -l internal: nothing
go vet -tags nogui ./internal/provider ./internal/gateway ./internal/cli
./internal/gui, GOOS=darwin, linux, windows: clean
staticcheck -checks U1000 -tests=false (darwin, windows) on
internal/provider: nothing new
go test -tags nogui -count=1 -run 'Factory|Gemini|PaymentRequired|
ResetsInWords|UserAgent|UsedWindow|Vertex|PayloadTooLarge|UsageCache|
AnthropicImage|ThinkingOff|Moved|Retired|Mover|Migrat|Move|
SayTheirPlugin|Allowance|Discovery|ClaudeModels|GrokPrice|
LoopbackSignIns|AsksOwnBackend|SideLogin|Import|Accounts|ZCode|MiMo'
on the four packages: ok (all four); TestFactoryAPIKeyMoved ran with
Bun (PASS), not skipped.
Not run: whole packages, the full suite, the GUI suite (machine load
~300). Not tried with a real Factory account. docs/subsystems not
changed, as for Zed.
The factory mover's min goes from 0.1.31 to 0.1.33, so keepMovedCurrent
updates every moved Factory user's opencode-factory-auth:
- 0.1.32 (plugins#158): each model carries droid's token multiplier, given
to magpie as its rate, with a running promotion's discount struck through.
- 0.1.33 (plugins#198): the update-config skill entry Factory refuses is
adapted in a system prompt's configuration section too, including
claude-code-guide's "- /update-config:" form.
npm view @magpie-community/opencode-factory-auth@0.1.33 --prefer-online
printed 0.1.33 before the change.
Run at this commit's tree, with the DeepSeek search commit on top: see
that commit's body for gofmt, go vet (darwin, linux, windows) and the full
go test -tags nogui -timeout 45m ./... run on the pushed head.
A Factory account added by its fk- key moved as an oauth sign-in with no
refresh token, which the plugin would try to renew and then lapse. It now
moves as the plugin's "Factory API key" sign-in saves one (type api, key,
whoami's metadata), and comes back as a key. A moved Factory's Import of
API keys sends them to its plugin (factoryKeyToPlugin), so the GUI no longer
hides Import for a moved Factory.
TestFactoryKeyMover, factory_key_test.go and plugin-moved-signin.test.cjs
(chromium, webkit; en, zh) go red without it.
Run at 63be47717 with this batch: go test -tags nogui ./... -count=1 -timeout 90m, 66 packages ok, no FAIL (load ~250). gofmt -l clean; GOOS=linux and GOOS=windows go vet of provider, gateway and plugin pass.
Raises the factory mover's min to 0.1.31 (npm view --prefer-online
@magpie-community/opencode-factory-auth@0.1.31 answers 0.1.31; published
by plugins 4e64f26's publish run 38857895455). The magpie side of the
class, plugin models' temperature: false not read, is #2492.
Run at a15e57656 + this change, sandbox HOME, go test -timeout 45m ./...:
every package ok except internal/gui, red only on
TestPanelJoinsFullScreenSpaces ("the panel shown doesn't take the
keyboard"), which is #2450 and fails alone 3 of 3 here; this change
touches only a string in internal/provider. gofmt -l clean.
Factory answered every model 403 "Forbidden" to requests that named an
older droid version. The built-in now sends factoryVersion 0.242.0, and
the mover's min is 0.1.30, the plugin release with the same headers
(magpie-community/plugins b8717aa), so keepMovedCurrent updates every
moved user's plugin.
npm view @magpie-community/opencode-factory-auth@0.1.30 --prefer-online
answers 0.1.30.
Run: gofmt; go vet -tags nogui ./internal/provider for darwin, linux and
windows; go test -run 'Factory|Moved|Mover|Migrat' ./internal/provider ok.
Not tried: a real Factory account through the built-in.
Full suite: SUITE_LINE
Plugins 95af6cf moved the six -fast entries after every other model;
0.1.27 had put them beside their bases, pushing five models past the 24 a
provider with no picks exposes. npm view --prefer-online shows 0.1.28 on
registry.npmjs.org.
Run: go test -tags nogui -run 'Moved|Migrat|Mover|Factory|Adopt|HandOver|KeepMoved' ./internal/provider passes; gofmt clean.
Not run: a real moved account updating to 0.1.28.
The movers' min, so keepMovedCurrent updates every moved user's plugin:
- kiro 0.1.11: a thinking model offers xhigh as its own level (50k
budget), so Claude Code's xhigh isn't routed as max (plugins#120).
- workbuddy 0.1.21: a model free only at night (Hy4 preview, 23:00-08:00)
is never said free, and a whole-day discount shows the price before it,
from WorkBuddy's modelPromotions (plugins#121).
- factory 0.1.27: droid's Fast Mode models (Opus 5.5/5/4.8, GPT-5.5/5.4/
5.3-Codex), and fast asked of a base model sent to its Fast Mode model
(plugins#119).
All three are on npm (npm view: 0.1.11, 0.1.21, 0.1.27).
Run: gofmt -l, go vet ./internal/provider for darwin, GOOS=linux -tags
nogui and GOOS=windows, go test ./internal/provider (ok, 449s under load
~280). Not tried: a moved user's update in a running magpie.
@magpie-community/opencode-factory-auth 0.1.26 (published, npm latest):
- Gemini 4 Argon and Gemini 3.x on Factory's /api/llm/g/v1/generate,
as the built-in sends them (#2080; plugins 60c9054).
- on a 413 from Factory, the request asked once more with every image
and file but the newest left out, tool results kept beside their
calls; failing that, an error saying it is Factory's limit on the
body's bytes, not the context, with the gateway's 413 hint
(#2082; plugins 1bd6d17).
Unmoved users: the gateway already adds the same byte-limit hint to any
413 and fails a routing group over to the next member.
Run: npm view @magpie-community/opencode-factory-auth@0.1.26 version
(0.1.26); go test ./internal/provider ./internal/gateway -count=1 (ok);
vet on darwin, linux (nogui) and windows. Not tried: a real Factory
account.
JL (Windows, droid 0.240.0, Factory desktop 0.197.1, magpie 0.1.1226,
opencode-factory-auth 0.1.24): droid and Factory desktop offer
claude-haiku-5-5; droid through magpie couldn't pick it.
droid's models are the registry bundled in its npm binary
(@factory/cli-<platform> 0.240.0, bin/droid). Against 0.233.0's registry,
0.240.0 adds claude-haiku-5-5, mistral-large-4 and gpt-6-astra-ultrafast.
The plugin (magpie-community/plugins e4023d9, published as 0.1.25, npm view
checked) now offers Haiku 5.5 (Anthropic Messages, 872000/128000, efforts
low..max) and Mistral Large 4 (chat completions, x-api-provider mistral,
Droid Core, 524288/64000, images). GPT-6 Astra Ultra Fast stays out: droid
offers it only once the user accepts Factory's high-cost terms.
- migrate_factory.go: the mover's min is 0.1.25, so keepMovedCurrent
updates moved users (JL is on the plugin).
- factory.go: the built-in had the same gap; its table gets the same two
rows for users who haven't moved.
- factory_pool_rest_test.go: the plugin's Core list, copied from its
usage, gains Mistral Large 4.
- TestFactoryDroid0240Models is new; its fixture is droid 0.240.0's
registry bytes (the same as the plugin's models.test.mjs). It fails with
the Haiku 5.5 row removed.
Run, under a temp HOME: go test -tags nogui ./... with the machine at load
35-190 (other sessions). Every package passed except five that hit the
10m timeout mid-test (agent, gateway, library, plugin, provider, in
tests that don't touch Factory). Rerun with -timeout 40m: provider ok;
gateway still timed out at load ~130 (TestCodexHeardWithinItsIdleTimeout
failed on its timing, unrelated); -run 'Factory|Moved' on gateway ok.
agent, library and plugin were not rerun to the end; this change
doesn't touch them. gofmt -l clean; GOOS=linux and GOOS=windows go vet
-tags nogui on internal/provider and internal/gateway ok.
Not tried against Factory itself (no Factory account here); droid was read,
not run.
factory 0.1.24 (magpie-community/plugins #66, guoqchen1001) is on npm:
a session continued after Claude Code compaction, whose restored context
opens with the invoked-skills reminder, is adapted so Factory takes it.
Raising the mover's min lets keepMovedCurrent bring every moved user to it.
Run: npm registry dist-tags latest = 0.1.24; go test -tags nogui
-run 'Mov|Migrat|Plugin|Factory|Mover' ./internal/provider ok; gofmt clean.
Factory's streaming route answers context_management with 400 "Extra
inputs are not permitted" (#71), and the update-config line in a skill
list Claude Code sends as its own system message, as text blocks or a
plain string, got 403 (#72). Plugin 0.1.23 (on npm) handles both; the
mover's min makes keepMovedCurrent update moved users to it.
Run: go test -tags nogui ./internal/provider under a temp HOME; gofmt
-l; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/provider.
npm view @magpie-community/opencode-factory-auth version: 0.1.23.
After /compact in Claude Code 2.1.280, every turn on factory/claude-opus-5-5
was 403 "Factory: Forbidden". The reporter's bisect found that Factory
refuses each fixed fragment of the turn Claude Code sends with the files it
restores: the "Note: <path> was read before the last conversation was
summarized…" notes, "Called the Read tool with the following input:", the
"# Environment\nYou have been invoked in the following environment:"
paragraph and the model line. Plugin 0.1.21 recognized none of them in
that combined, unwrapped block. Plugin 0.1.22 (magpie-community/plugins
0437abb, on npm) recognizes the complete block and applies the existing
compat spellings and the lossless Read-result encoding to each fixed
paragraph, the rest byte-for-byte. The mover's min is raised so
keepMovedCurrent updates moved users. The built-in, which has none of the
plugin's Claude Code adaptations, is unchanged.
Plugin: its two new tests use the issue's literal fragments; the adapting
one fails on 0.1.21; bun test (1010 pass) and check.mjs pass. Here:
go test -tags nogui -count=1 ./internal/provider/, go vet -tags nogui for
darwin, linux and windows, gofmt -l pass. Stubbed fetch only; not tried
against Factory itself (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 found the refused part: pi's
fixed opening of its summary message, "The conversation history before
this point was compacted into the following summary:"
(COMPACTION_SUMMARY_PREFIX in pi-coding-agent dist/core/messages.js), whole.
Plugin 0.1.21 (magpie-community/plugins f4c0d96, on npm) rewords that
sentence, and pi's branch summary opening, when a user text is pi's whole
summary, on Messages, chat completions and Responses; the mover's min is
raised so keepMovedCurrent updates moved users. The built-in, which has
none of the plugin's pi or Claude Code adaptations (#952, #1132), is
unchanged.
Plugin: its new pi.test.mjs tests fail on 0.1.20 and pass on 0.1.21; bun
test (114 pass) and check.mjs factory pass; the npm tarball's index.mjs is
the committed one. Here: go test -tags nogui -count=1 ./internal/provider/
in Docker (golang:1.26.8; on the Mac new test binaries hung in dyld while
syspolicyd was at 100%), go vet -tags nogui for darwin, linux and windows,
gofmt -l pass. Not tried against Factory itself (no Factory account here).
tedestar found it: anthropicBody adapted a role:"system" message only when its
content was a string, so Claude Code 2.1.288's context as an array of text
blocks reached Factory unadapted and came back 403 Forbidden (shown by Claude
Code as Please run /login). @magpie-community/opencode-factory-auth 0.1.14
(magpie-community/plugins 16ec1b8) adapts each text block as the string one,
keeping the blocks' other fields and non-text blocks; keepMovedCurrent moves
every moved user onto it. bun test in packages/factory passes (the new #658
test fails on 0.1.13). No live Factory account: tried with the captured shape
against a stubbed fetch only. go vet, builds (darwin, GOOS=linux,
GOOS=windows) and go test -tags nogui -count=1 ./internal/provider/ under a
temp HOME pass.
Codex's codex_app automation_update takes an anyOf of objects at its root, and Claude models behind Factory answered every request offering it with 400 "input_schema does not support oneOf, allOf, or anyOf at the top level". Factory is a moved subscription, so the fix that reaches users is the plugin: factory 0.1.13 (SadWood's #12) nests such a schema under one "arguments" property, constraints intact, and unwraps the calls on the way back; migrate_factory.go's min is 0.1.13, so keepMovedCurrent updates moved users. The built-in Anthropic outbound (buildAnthropic) now does what Grok's objectRoot did: provider.ObjectRoot, shared, merges a root allOf's branches and the object branches of a root anyOf/oneOf (a field each requires stays required), following local $refs; a schema without a root combinator is sent byte for byte. TestAnthropicToolSchemaRoot fails on the old code. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass but TestClaudeSignInOverStaleCredentials, a timing test that passes alone (3/3). Not tried against a real Factory account.