@cloudflare/codemode@0.5.2
maximhq/bifrost@cloudflare/codemode@0.5.2Sep 11, 2026by github-actions[bot]
Upgrading?
AI Summary
This patch release improves the handling of oversized results and logs by implementing structural truncation to ensure valid JSON output and prevent context overflow.
Key Highlights
- Structural truncation of oversized objects, arrays, and strings to ensure valid JSON output
- Bounded sandbox logs passed to the model via `toModelOutput` to prevent context overflow
- MCP servers now apply the response budget to their text output
New Features
- Structural truncation logic for results and logs
- Projection of `calls` out of model context
- MCP server response budget application
Full Release Notes
### Patch Changes
- [#2224](https://github.com/cloudflare/agents/pull/2224) [`dcca089`](https://github.com/cloudflare/agents/commit/dcca0896cc829e4a602a1feb47466ac79d1ca096) Thanks [@mattzcarey](https://github.com/mattzcarey)! - Truncate structured results structurally instead of slicing their JSON.
`truncateResult` (the default `transformResult` in Think's execute tool and the browser tools) and the `codeMcpServer` / `openApiMcpServer` response path used to pretty-print an oversized object and cut it at a character count, leaving the model with half a JSON document. Oversized values are now shrunk in place, largest values first: strings are clipped with a `--- TRUNCATED --- <n> chars` suffix, arrays keep their leading items and end with a `--- TRUNCATED --- <n> more items` element, and an object only loses entries (largest first, named in a `"--- TRUNCATED ---"` entry) when its values cannot share the budget. The output is always valid JSON of the original shape and small values pass through untouched.
The Code Mode tool now carries a `toModelOutput` that projects `calls` out of what the model sees and bounds the sandbox `logs` the same way a result is bounded. The durable call log — every connector call's args and result — stays on the persisted tool part for UIs and audit, but no longer rides into the model's context uncapped alongside the transformed `result`. The projection never throws: a BigInt or cyclic value is rendered rather than failing a completed run at model assembly.
The MCP servers apply the response budget to the text they emit, pretty-printing only while that still fits.
Fixes [#2009](https://github.com/cloudflare/agents/issues/2009), [#2143](https://github.com/cloudflare/agents/issues/2143) and [#2182](https://github.com/cloudflare/agents/issues/2182).
Related Repositories
ollama/ollama★ 184,217
Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
fatedier/frp★ 110,057
A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
infiniflow/ragflow★ 92,618
RAGFlow is a leading open-source Retrieval-Augmented Generation (RAG) engine that fuses cutting-edge RAG with Agent capabilities to create a superior context layer for LLMs
gohugoio/hugo★ 90,198
The world’s fastest framework for building websites.
junegunn/fzf★ 83,715
:cherry_blossom: A command-line fuzzy finder