mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-03 09:17:09 +08:00
fix: address PR review — alias expansion + L3 budget enforcement
- Add `shopt -s expand_aliases` to snapshot so aliases captured by `alias -p` actually work under `bash -c` (review comment #2) - Pass threshold=0 in enforce_turn_budget() so L3 can force-persist results below the 50K default when aggregate budget is exceeded (review comment #3) - Add regression test: 6x42K results (each under 50K) exceeding 200K budget are now correctly persisted
This commit is contained in:
@@ -28,7 +28,6 @@ logger = logging.getLogger(__name__)
|
||||
DEFAULT_MAX_RESULT_SIZE_CHARS: int = 50_000
|
||||
MAX_TURN_BUDGET_CHARS: int = 200_000
|
||||
PREVIEW_SIZE_CHARS: int = 2000
|
||||
PREVIEW_SIZE_BYTES = PREVIEW_SIZE_CHARS # deprecated alias
|
||||
PERSISTED_OUTPUT_TAG = "<persisted-output>"
|
||||
PERSISTED_OUTPUT_CLOSING_TAG = "</persisted-output>"
|
||||
|
||||
@@ -179,7 +178,8 @@ def enforce_turn_budget(
|
||||
content = msg["content"]
|
||||
tool_use_id = msg.get("tool_call_id", f"budget_{idx}")
|
||||
|
||||
result = persist_large_result(content, tool_use_id, storage_dir)
|
||||
result = persist_large_result(content, tool_use_id, storage_dir,
|
||||
threshold=0)
|
||||
if result:
|
||||
replacement = build_persisted_output_message(result)
|
||||
total_size -= size
|
||||
|
||||
Reference in New Issue
Block a user