The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tools): floor the spillover window at 24h so retention_days=0 cannot delete a fresh spill
teknium19465563f01a4
diff --git a/tests/tools/test_tool_result_storage.py b/tests/tools/test_tool_result_storage.pyindex d9cf1c82d0c..7dfbf3f6b94 100644--- a/tests/tools/test_tool_result_storage.py+++ b/tests/tools/test_tool_result_storage.py@@ -558,6 +558,13 @@ class TestSpillover:lambda: {"sessions": {"retention_days": -5}})assert trs._spillover_retention_hours() == trs.SPILLOVER_MAX_AGE_HOURS+ # 0 is a legal prune setting (ended sessions go at once) but open sessions survive it;+ # a 0h spill window would delete the file the first spill just wrote.+ monkeypatch.setattr(+ hermes_cli.config, "load_config_readonly",+ lambda: {"sessions": {"retention_days": 0}})+ assert trs._spillover_retention_hours() == trs.SPILLOVER_MAX_AGE_HOURS+def test_cleanup_missing_dir_returns_zero(self):assert cleanup_spillover_cache() == 0diff --git a/tools/tool_result_storage.py b/tools/tool_result_storage.pyindex 68ea0610f4a..d99544ffdb1 100644--- a/tools/tool_result_storage.py+++ b/tools/tool_result_storage.py@@ -51,10 +51,13 @@ def _spillover_retention_hours() -> int:Falls back to the legacy 24h cache age when the config is unreadable."""try:from hermes_cli.config import load_config_readonly- days = int((load_config_readonly().get("sessions") or {}).get("retention_days", 90))+ days = float((load_config_readonly().get("sessions") or {}).get("retention_days", 90))except Exception:return SPILLOVER_MAX_AGE_HOURS- return SPILLOVER_MAX_AGE_HOURS if days < 0 else days * 24+ # ``retention_days: 0`` is legal (ended sessions pruned at once) but session prune never+ # touches OPEN sessions, while a zero-hour spill cutoff deletes the file the first spill+ # just wrote (the pointer then names a missing path). Floor at the legacy cache age.+ return max(SPILLOVER_MAX_AGE_HOURS, int(days * 24))def cleanup_spillover_cache(max_age_hours: int | None = None) -> int:diff --git a/website/docs/user-guide/configuration.md b/website/docs/user-guide/configuration.mdindex 6732b8727c5..f415a95fbe4 100644--- a/website/docs/user-guide/configuration.md+++ b/website/docs/user-guide/configuration.md@@ -923,7 +923,7 @@ tool_output:### Tool-Result Spillover Budget-Separately from truncation, oversized tool *results* are spilled to disk rather than cut: the full output is saved under `$HERMES_HOME/cache/spillover/` and the in-context content is replaced by a preview plus the saved file's path (readable with `read_file` using `offset`/`limit`, or processable with `execute_code`). The generic per-result spillover threshold is 100,000 chars, scaled down automatically for small-context models.+Separately from truncation, oversized tool *results* are spilled to disk rather than cut: the full output is saved under `$HERMES_HOME/cache/spillover/` and the in-context content is replaced by a preview plus the saved file's path (readable with `read_file` using `offset`/`limit`, or processable with `execute_code`). The generic per-result spillover threshold is 100,000 chars, scaled down automatically for small-context models. Spill files are kept for the session retention window (`sessions.retention_days`, default 90 days, never less than 24 hours) so a session resumed later still finds what its transcript points at; the gateway's hourly housekeeping and the first spill of each process sweep older files.MCP tool results (tools named `mcp_*`) spill at a tighter **50,000-char** default: MCP servers routinely return large un-paginated payloads (tool-discovery catalogs, batched executions) that would otherwise sit under the generic threshold and bloat context on every subsequent turn. Nothing is lost — the full result is preserved on disk. Override the threshold via: