feat: long-running session improvements

- Hang fix: 120s timeout on compression LLM call + raw_stream
  channel-close handling (None => break instead of spinning)
- Supervisor effective active count: stop counting finished
  JoinHandles as occupying capacity slots
- Universal tool result size cap: truncate_if_needed() on
  ToolResult, applied in eval_tool_calls() after escalation block;
  configurable via max_tool_result_chars in AppConfig/AgentConfig
- Windowed compression: compression_keep_last config param keeps
  the N most recent messages visible after compression
- Fix pre-existing flaky test: add #[serial] to
  handle_list_available_unrestricted_when_no_whitelist so it does
  not race with TestConfigDirGuard-based tests that temporarily
  populate the agents data dir
This commit is contained in:
2026-07-23 12:25:54 -06:00
parent d51bdd3086
commit 54c5079cb7
9 changed files with 118 additions and 19 deletions
+12
View File
@@ -531,6 +531,14 @@ impl Agent {
self.config.compression_threshold
}
pub fn max_tool_result_chars(&self) -> Option<usize> {
self.config.max_tool_result_chars
}
pub fn compression_keep_last(&self) -> Option<usize> {
self.config.compression_keep_last
}
pub fn is_dynamic_instructions(&self) -> bool {
self.config.dynamic_instructions
}
@@ -679,6 +687,10 @@ pub struct AgentConfig {
pub memory: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub compression_threshold: Option<usize>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub max_tool_result_chars: Option<usize>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub compression_keep_last: Option<usize>,
#[serde(default)]
pub description: String,
#[serde(default)]