Nepsama1337 on X: magpie 0.1.4414 wrote gpt-6.2-sol into OpenCode's
config as limit {context: 922000, output: 128000}. models.dev gives
{context: 1050000, input: 922000, output: 128000}. magpie's
catalog.Model.Context is the prompt window, so it prefers models.dev's
input, and the opencode shape wrote that number as context and
dropped input.
What OpenCode reads, checked in anomalyco/opencode on dev:
packages/schema/src/config/provider.ts and
packages/core/src/v1/config/provider.ts take limit {context, input,
output}. session/compaction.ts uses min(input, context) when both are
there. OpenCode 1's models.ts (8df09abb1) has input too, and its
compaction uses limit.input || context - output.
catalog keeps the whole window that models.dev pairs with each input
cap (WholeOf, voted the same way as the windows and looked up through
the same renames). The opencode shape now writes {context: whole,
input: prompt window, output} when the catalog gives a wider whole
window, and {context, output} as before otherwise. A user's own
context for a model (Contexts) has no pair, so it stays a plain
context. This shape serves OpenCode 1 and 2, MiMo Code, DevEco, Air
and OpenChamber. OpenCode 2's converter copies limit whole, so input
reaches it too.
Agents with one window field (Crush's context_window, droid, Cline and
the rest) get the prompt window, which is right for them. ZCode and
MiniMax Code also write {context, output}, but their schemas can't be
checked: #7060.
Run:
- TestOpenCodeLimitKeepsContextAndInput is red on the old agents.go
(relay/gpt-6.2-sol: limit {"context":922000,"output":128000}) and
green with the fix. It covers the paired model, a model with no
input cap, a user's own context, and openCodeNative.
- go test -run 'TestOpenCode' ./internal/agent on mote: ok.
- Real OpenCode 1.19.5 on mote, sandbox HOME: `opencode models magpie
--verbose` lists gpt-6.2-sol with limit {context 1050000, input
922000, output 128000}.
- Full suite, go test -timeout 45m ./... on Linux (magpie-desktop, at
48fffb60c plus this change; mote and mica were over their cores):
every package ok except internal/usage's
TestRequestStateKeptAcrossACatalogFetchedAgain, red on the old code
too (#6572). The three GUI-linked packages need -tags gtk3 there:
. and internal/cli ok; internal/gui's TestClipboardReadBack
segfaults under WSLg (#7074), the rest ok.
- go vet ./... on Linux (-tags gtk3) and on Windows: ok. gofmt -l:
clean.
After rebasing onto 1318864d1: internal/agent and internal/catalog ok on Linux.
Not tried: a real OpenCode 2 run (its schema was read from source),
ZCode and MiniMax Code (#7060), and the macOS full suite.