chore: increase context and tool output buffer sizes#4
Conversation
- MIMI_CONTEXT_BUF_SIZE: 16KB → 24KB Prevents silent truncation when loading bootstrap files + MEMORY.md + daily notes - TOOL_OUTPUT_SIZE: 8KB → 12KB Prevents JSON truncation on verbose web_search results (Brave API can exceed 8KB)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 630fc8ba7c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #define MIMI_FILE_WRITE_ALLOW_SESSION_DIR 0 | ||
| #endif | ||
| #define MIMI_CONTEXT_BUF_SIZE (16 * 1024) | ||
| #define MIMI_CONTEXT_BUF_SIZE (24 * 1024) |
There was a problem hiding this comment.
Keep context buffer below total context budget
Raising MIMI_CONTEXT_BUF_SIZE to 24KB makes the system prompt eligible to consume the entire MIMI_AGENT_MAX_CONTEXT_BYTES budget (also 24KB), but the agent enforces budget on system_prompt + messages in agent_loop.c (get_context_bytes check at line 919). In sessions with large bootstrap/memory content, any non-empty message history now pushes total context over budget and the turn aborts with the context-too-long error instead of answering; with the previous 16KB prompt cap there was headroom for messages. This is a functional regression for users with larger stored memory.
Useful? React with 👍 / 👎.
Summary
Two one-line buffer size increases to prevent silent truncation:
1. Context Buffer: 16KB → 24KB
main/mimi_config.hMIMI_CONTEXT_BUF_SIZEfrom(16 * 1024)to(24 * 1024)Current 16KB limit causes
append_file()to silently read 0 bytes when full, leaving dangling headers with no content.2. Tool Output Buffer: 8KB → 12KB
main/agent/agent_loop.cTOOL_OUTPUT_SIZEfrom(8 * 1024)to(12 * 1024)cJSON_Parse()failures in LLM response handlerTesting
Both changes are backward-compatible buffer size increases:
Related Issues
Part of the ongoing memory safety improvements tracked in the mimiclaw-improve analysis.
Generated by OpenClaw Agent