laomao04_65777 (magpie Discord, 11-01) gets 429 FreeUsageLimitError
("Free models work in OpenCode") on every Zen free model through
zen-free 0.1.18, while real OpenCode works on the same machine.
OpenCode 2.2.5 (@opencode/cli, npm latest; release binary from
anomalyco/opencode) was run in a sandbox HOME on mote against a recording
proxy, and its primary chat request was diffed against 0.1.18's
carrying the same body. 0.1.18 differed in:
- User-Agent opencode/latest/2.0.25/cli, not 2.2.5;
- x-opencode-project "global" on every request. OpenCode 2 sends
sha1("directory:" + folder), or sha1("git-remote:host/path") in a
repository with a remote (packages/core/src/project.ts), and "global"
only from a repository with no remote and no commit;
- no b3 or traceparent trace headers;
- Accept set by hand, so it went first, where OpenCode's is fetch's own,
after Connection;
- the model list GET went with User-Agent Bun/1.4.2;
- the stand-in tools were 1.x's (bash, filePath), with no required or
strict:false; 2.x has shell and path;
- the environment block lacked 2.x's "Prefer <tmp>/opencode ..." line.
All of them now match. The version is read from OpenCode's own updater
(opencode.ai/update/api/latest/cli/npm) at most every six hours, never
older than the built-in 2.2.5, which stays when it can't be read. Not
asked when a test gives its own baseURL.
Run:
- bun test in packages/zen-free on mote (macOS) and in WSL magpie-desktop
(Linux), with HOME a temp dir as CI: 204 pass.
- bun scripts/check.mjs on mote: every package ok.
- Broken by hand: project back to "global", b3 removed, version back to
2.0.25: 8 tests red (the three header tests, the four project tests,
the updater test).
- Recapture on mote: the plugin's loader.fetch given OpenCode 2.2.5's own
captured body, at the same recorder. Headers in order and the body are
byte for byte the same as OpenCode's once the per-request session,
trace and span ids are masked. 0.1.18's capture differs as listed
above. The model list GET now goes as opencode/latest/2.2.5/cli.
Not tried: a 200. Real OpenCode 2.2.5 itself gets the same 429 from our
egress IP (mote, this Mac and xiaomi-gpu share it), as do replays of its
captured request with a fresh project id, so the free limit on that IP
is spent and no request from it can show the fix served. The title
request an agent sends still goes with the environment block and tools
added (as since 0.1.15), which OpenCode's own title request has not;
an agent's title request can't be told from its turn.