From 18cfb4e2fe3338e68ab914c82a1d30a65f8ed41d Mon Sep 17 00:00:00 2001 From: argenis de la rosa Date: Sat, 21 Mar 2026 20:00:20 -0400 Subject: [PATCH] fix(config): restore max_system_prompt_chars field removed by merge conflict The PR branch was based on an older master and the merge incorrectly removed the max_system_prompt_chars field from AgentConfig, which was added by PR #4185. This restores the field, its default function, and the Default impl entry to prevent a build break on merge. --- src/config/schema.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/config/schema.rs b/src/config/schema.rs index 9c928ec41..9eb4e81b7 100644 --- a/src/config/schema.rs +++ b/src/config/schema.rs @@ -1252,6 +1252,12 @@ pub struct AgentConfig { /// Default: `[]` (no filtering — all tools included). #[serde(default)] pub tool_filter_groups: Vec, + /// Maximum characters for the assembled system prompt. When `> 0`, the prompt + /// is truncated to this limit after assembly (keeping the top portion which + /// contains identity and safety instructions). `0` means unlimited. + /// Useful for small-context models (e.g. glm-4.5-air ~8K tokens → set to 8000). + #[serde(default = "default_max_system_prompt_chars")] + pub max_system_prompt_chars: usize, } fn default_agent_max_tool_iterations() -> usize { @@ -1270,6 +1276,10 @@ fn default_agent_tool_dispatcher() -> String { "auto".into() } +fn default_max_system_prompt_chars() -> usize { + 0 +} + impl Default for AgentConfig { fn default() -> Self { Self { @@ -1281,6 +1291,7 @@ impl Default for AgentConfig { tool_dispatcher: default_agent_tool_dispatcher(), tool_call_dedup_exempt: Vec::new(), tool_filter_groups: Vec::new(), + max_system_prompt_chars: default_max_system_prompt_chars(), } } }