mariamatrix (#5468) and mahiro233 on Discord: magpie writes OpenCode's
magpie provider with @ai-sdk/openai-compatible and only baseURL/apiKey, so
OpenCode sends no prompt_cache_key and an upstream that caches by it misses.
Checked against OpenCode's source and real runs (sandbox HOME on mote, a
recording Chat server):
- 2.2.5: v1/config/migrate.ts maps options.setCacheKey to
compatibility.supportsPromptCacheKey, and openai-chat.ts sends
prompt_cache_key only then. Without it: no key; with it:
"prompt_cache_key":"ses_…" on the turn and the title request. A config
with magpie's provider under providers, compatibility.supportsPromptCacheKey
true, sends it too; without, none.
- 1.19.5: setCacheKey true sends camelCase promptCacheKey (the previous
commit sends it on as prompt_cache_key).
- 2.0.25: ignores the option; the run answers as before, no error.
Now:
- the "opencode" shape's options have setCacheKey: true. Every writer of
provider.magpie goes through it and openCodeKept: OpenCode, its
OPENCODE_CONFIG_DIR copies, MiMo Code, DevEco, Air's OpenCode and
OpenChamber's.
- openCodeNative writes it as OpenCode 2 does: compatibility
.supportsPromptCacheKey, not a setting.
- a setCacheKey the file has already under provider.magpie.options, or a
supportsPromptCacheKey under providers.magpie.compatibility, is the
user's (false too) and stays, through a sync and a pick.
Kilo has no wiring in magpie; no other agent's config has this option.
TestAirProviderWritesKeepCustomFields compared every option as a string;
it now compares a bool as its JSON.
Run on mote: go test ./internal/agent (full package) ok; go test -run
'OpenCode|CacheKey|Air|OpenChamber|Deveco|Mimo|KeepTheir' ./internal/agent
./internal/gateway ok; go vet on darwin, GOOS=linux, GOOS=windows; go
build ./... (darwin, windows); gofmt clean.
Broken by hand, each failing TestOpenCodeSetsCacheKey: no setCacheKey in
the shape ("no setCacheKey"); no keep under provider ("the user's false not
kept"); no keep under providers (same); no move out of settings
("setCacheKey in OpenCode 2's settings").
Not tried: a config written by a running magpie fed to a real OpenCode
(the real runs used configs of the same shape, written by hand); a real
upstream's cache hit rate before and after.
Reported-by: mariamatrix
Reported-by: mahiro233
whiteS18 installed OpenCode from IDEA's ACP registry. The IDE unpacks it
into ~/Library/Caches/JetBrains/IntelliJIdea2026.2/acp-agents/opencode/
1.19.0/opencode, on no PATH, so Air's Magpie agent said "OpenCode not
installed". airOpenCode now also looks where JetBrains IDEs and Zed put
registry installs (Caches/JetBrains/*/acp-agents/opencode/*, Zed's
external_agents/registry/opencode/*; ~/.cache and ~/.local/share on
Linux, %LOCALAPPDATA% on Windows), the newest by mtime.
Run:
- TestAirFindsACPRegistryOpenCode: darwin, linux and windows layouts
(the reporter's literal macOS paths), none installed gives "", the
newer of two wins.
- XDG_CACHE_HOME listed in agentenv_test's notAnAgent (TestFolderVarsAreListed
was red without it).
- go test -tags nogui -count=1 ./internal/agent ok; gofmt clean;
go vet -tags nogui darwin, linux, windows ok on agent.
- Not tried: a real IDE registry install (none on this machine).
Full suite: agent only here; the release head runs ./... before its tag.