fix(config): enable compact_context by default (#3995)

* fix: change compact_context default to true

Local LLMs with limited context windows immediately run out of context
when compact_context defaults to false. The system prompt alone can
consume 25K+ tokens, exceeding even 55K context windows with history.

Setting compact_context=true by default limits system prompt injection
to 6000 chars and RAG results to 2 chunks, making the agent usable
with smaller models out of the box.

Fixes #3987

* docs: update compact_context default to true in config reference

Update all locale variants (en, zh-CN, vi) to reflect the new default.

* test: update tests to expect compact_context default of true

Update assertions in schema.rs unit tests and config_persistence.rs
component tests to match the new default value.
This commit is contained in:
Argenis 2026-03-19 15:13:14 -04:00 committed by Roman Tataurov
parent 1866888e9f
commit 296fff7af9
No known key found for this signature in database
GPG Key ID: 70A51EF3185C334B
5 changed files with 9 additions and 9 deletions

View File

@ -76,7 +76,7 @@ runtime_trace_max_entries = 200
| 键 | 默认值 | 用途 |
|---|---|---|
| `compact_context` | `false` | 为 true 时bootstrap_max_chars=6000rag_chunk_limit=2。适用于 13B 或更小的模型 |
| `compact_context` | `true` | 为 true 时bootstrap_max_chars=6000rag_chunk_limit=2。适用于 13B 或更小的模型 |
| `max_tool_iterations` | `10` | 跨 CLI、网关和渠道的每条用户消息的最大工具调用循环轮次 |
| `max_history_messages` | `50` | 每个会话保留的最大对话历史消息数 |
| `parallel_tools` | `false` | 在单次迭代中启用并行工具执行 |

View File

@ -76,7 +76,7 @@ Operational note for container users:
| Key | Default | Purpose |
|---|---|---|
| `compact_context` | `false` | When true: bootstrap_max_chars=6000, rag_chunk_limit=2. Use for 13B or smaller models |
| `compact_context` | `true` | When true: bootstrap_max_chars=6000, rag_chunk_limit=2. Use for 13B or smaller models |
| `max_tool_iterations` | `10` | Maximum tool-call loop turns per user message across CLI, gateway, and channels |
| `max_history_messages` | `50` | Maximum conversation history messages retained per session |
| `parallel_tools` | `false` | Enable parallel tool execution within a single iteration |

View File

@ -65,7 +65,7 @@ Lưu ý cho người dùng container:
| Khóa | Mặc định | Mục đích |
|---|---|---|
| `compact_context` | `false` | Khi bật: bootstrap_max_chars=6000, rag_chunk_limit=2. Dùng cho model 13B trở xuống |
| `compact_context` | `true` | Khi bật: bootstrap_max_chars=6000, rag_chunk_limit=2. Dùng cho model 13B trở xuống |
| `max_tool_iterations` | `10` | Số vòng lặp tool-call tối đa mỗi tin nhắn trên CLI, gateway và channels |
| `max_history_messages` | `50` | Số tin nhắn lịch sử tối đa giữ lại mỗi phiên |
| `parallel_tools` | `false` | Bật thực thi tool song song trong một lượt |

View File

@ -1141,7 +1141,7 @@ fn default_agent_tool_dispatcher() -> String {
impl Default for AgentConfig {
fn default() -> Self {
Self {
compact_context: false,
compact_context: true,
max_tool_iterations: default_agent_max_tool_iterations(),
max_history_messages: default_agent_max_history_messages(),
max_context_tokens: default_agent_max_context_tokens(),
@ -8828,7 +8828,7 @@ reasoning_effort = "turbo"
#[test]
async fn agent_config_defaults() {
let cfg = AgentConfig::default();
assert!(!cfg.compact_context);
assert!(cfg.compact_context);
assert_eq!(cfg.max_tool_iterations, 10);
assert_eq!(cfg.max_history_messages, 50);
assert!(!cfg.parallel_tools);

View File

@ -72,11 +72,11 @@ fn agent_config_default_tool_dispatcher() {
}
#[test]
fn agent_config_default_compact_context_off() {
fn agent_config_default_compact_context_on() {
let agent = AgentConfig::default();
assert!(
!agent.compact_context,
"compact_context should default to false"
agent.compact_context,
"compact_context should default to true"
);
}
@ -204,7 +204,7 @@ default_temperature = 0.7
// Agent config should use defaults
assert_eq!(parsed.agent.max_tool_iterations, 10);
assert_eq!(parsed.agent.max_history_messages, 50);
assert!(!parsed.agent.compact_context);
assert!(parsed.agent.compact_context);
}
#[test]