Repository navigation
v0.49.92
·
35 commits
to master
since this release
v0.49.92
This patch fixes five faults: two in the recovery after a provider rejects a request as too large (issues 950, 1010 and 1009), two on OpenCode 2 (issues 1011 and 1012), and one that lost facts from summaries on every host (issue 997).
Upgrading
Update the plugin with npx @cortexkit/magic-context@latest doctor, then restart your host. No database migration is needed.
Fixed
- A gateway's limit on new tokens in one request was not recovered from (issues 950 and 1010). Some gateways refuse a request that adds more than a set number of uncached tokens at once. They answer with HTTP 413 and the code
cold_request_too_large, or with a message such as "limit 350,000 per request". Magic Context did not read this as a size rejection, so it made no room and the next attempt failed the same way. It now recognizes the code, the structured 413 body and both wordings, on OpenCode 1, OpenCode 2 and Pi, and runs the same recovery as for any other size rejection. When the limit in the message is lower than the model's input window, Magic Context uses it as the input limit for that session and model, so later requests are reduced before they reach it. A limit that is not lower than the window changes nothing. A 413 for another reason (an upload, an image, a byte size, a rate limit, an empty body) is still not treated as a size rejection. - After a provider rejected a request as too large, later messages could be refused for up to ten minutes (issue 1009). The message after a rejection starts a recovery that asks for a summary first. The summarizer has a work budget per ten-minute window. When earlier summaries had used it up, the recovery could not start one, and Magic Context refused the turn; the host showed it as "Aborted", and the log gave no reason. Every further message ended the same way until the window was over or you ran
/ctx-flushor/ctx-recomp. This affected every release since 0.49.46. A recovery after a provider rejection may now start its summary although the budget is used up. The work still counts against the same window, and the 60-second pause after a failed summary still applies. Pi and Oh My Pi already recovered in this case. - OpenCode 2: a session with attachments stored by reference stopped working after the host compacted it (issue 1011). With
experimental.media_blobon OpenCode 2.3 and newer, the host stores an attachment as a reference (media:<sha256>) and keeps the bytes in its own store. When OpenCode compacts a session (by itself or on/compact), Magic Context puts the messages that its own summaries do not cover back into the request. It put such a message back without the attachment's bytes, and the host then failed every later prompt of the session withe.source.data.length. Magic Context now reads the bytes from the host's store by the same reference, as the host does for its own history, so the message reaches the provider with the same content as before the compaction. A session that an earlier release left in this state works again after the update. Two related cases are fixed with it:- An image inside a tool result was put back with the reference in place of its data. It now carries the real bytes.
- When the host no longer has the bytes, the request carries the host's own text for that,
[media unavailable: name (type)].
- OpenCode 2 development builds showed Magic Context's background runs in the sidebar (issue 1012). Magic Context chose how to hide a summary or nightly run from the host's version string, and treated a development build, a pre-release or a missing version as an old host. It now hides background runs on every OpenCode 2 version. The one exception is exactly 2.3.0, as before: that version starts a model step in the session that holds a hidden run when the run ends.
- A summary run that set its last summary aside lost every fact of that run (issue 997). When the last summary of a run has too little conversation after it, Magic Context sets it aside and reads those messages again in the next run, or keeps it without saving anything from it. The facts of a run did not say which summary they came from, so in both cases all of them were dropped, also the ones from summaries that were kept. In the session store attached to the report, 106 of the 145 facts that summary runs had produced were never saved. Each fact now names its summary, and the facts of kept summaries are saved as project memories. This is fixed on OpenCode 1, OpenCode 2, Pi and Oh My Pi. Facts that were dropped before the update are not brought back:
/ctx-recomprebuilds summaries and writes no facts.
What to expect after the update
- A new hint after a size rejection. When a provider rejects a request as too large, you see one message: "The provider rejected this request as too large. Send your message again; Magic Context makes room first." OpenCode shows it as a toast and Pi as a notice. It is not stored in the session and starts no model step. Subagents and background runs do not show it, and it is not shown for a rate-limit error. It is also not shown when the rejected request was itself sent right after a recovery, because sending again would then not make more room; the log says so in one line.
- The summarizer's instructions are about 170 tokens longer. They now ask for the summary each fact belongs to. Only the summarizer's own requests change, and its prompt cache is written once more after the update.
- Requests of your sessions change only where a fix applies. A session on OpenCode 2 that has attachments stored by reference sends their real content again after the host compacts it. A session whose provider reported a per-request limit is reduced earlier. Every other request is built as before.
- OpenCode 2: a failed read of the host's store refuses the turn. If the host's store cannot be read at the moment an attachment is put back (for example because it is locked), Magic Context replays the last good request or refuses the turn with its "store is busy" notice, as for any other failed read of that store. It does not send the request with a placeholder in place of the attachment.