Skip to content

The agent that grows with you

fix: test-runner scratch root is /var/tmp/hermes-pytest; two tests follow TMPDIR

teknium1ece388eca8fc
diff --git a/scripts/run_tests_parallel.py b/scripts/run_tests_parallel.py
index c7def2aa6b9..af1c08f626d 100755
--- a/scripts/run_tests_parallel.py
+++ b/scripts/run_tests_parallel.py
@@ -59,13 +59,16 @@ from pathlib import Path
from typing import Dict, List, Optional, Tuple
def _runner_scratch_root() -> str:
- """Per-run temp roots live on disk under the user's cache dir, never the system temp dir:
- a full-suite run writes gigabytes of tmp_path fixtures and /tmp is RAM-backed tmpfs on
- many Linux hosts. Not under the Hermes home (conftest refuses a basetemp inside the live
- install and would relocate it), and kept as short as the old /tmp root because tests that
- bind AF_UNIX sockets under ``tempfile.mkdtemp()`` must stay within sun_path."""
- cache = os.environ.get("XDG_CACHE_HOME") or os.path.join(os.path.expanduser("~"), ".cache")
- root = os.path.join(cache, "hermes-pytest")
+ """Per-run temp roots live on DISK, never the system temp dir: a full-suite run writes
+ gigabytes of tmp_path fixtures and /tmp is RAM-backed tmpfs on many Linux hosts. /var/tmp is
+ the FHS disk-backed temp root and is used because the alternatives fail tests that assume
+ the root's shape: under the Hermes home conftest relocates the basetemp; under a dot-dir
+ (~/.cache) the hidden-dir search tests see every fixture as hidden; anything longer than
+ the old /tmp root pushes AF_UNIX test sockets past sun_path."""
+ if os.name == "nt" or not os.path.isdir("/var/tmp"): # no-tmp: ok — probing the disk-backed FHS root
+ root = os.path.join(tempfile.gettempdir(), "hermes-pytest")
+ else:
+ root = "/var/tmp/hermes-pytest" # no-tmp: ok — /var/tmp is disk-backed by FHS, never tmpfs
os.makedirs(root, exist_ok=True)
return root
diff --git a/tests/tools/test_tool_result_storage.py b/tests/tools/test_tool_result_storage.py
index 6f1d7cb4a76..ebceb176b59 100644
--- a/tests/tools/test_tool_result_storage.py
+++ b/tests/tools/test_tool_result_storage.py
@@ -289,9 +289,11 @@ class TestMaybePersistToolResult:
cmd = env.execute.call_args_list[1][0][0]
target = cmd.split("cat > ", 1)[1].split(" <<", 1)[0]
- assert "Full output saved to: /tmp/hermes-results/outside_whoami_x_" in result
- assert "/tmp/hermes-results/../" not in result
- assert target.startswith("/tmp/hermes-results/outside_whoami_x_")
+ from tools.tool_result_storage import STORAGE_DIR
+
+ assert f"Full output saved to: {STORAGE_DIR}/outside_whoami_x_" in result
+ assert f"{STORAGE_DIR}/../" not in result
+ assert target.startswith(f"{STORAGE_DIR}/outside_whoami_x_")
assert "/../" not in target
assert "$(whoami)" not in target
assert ";" not in target
diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/bot-mode.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/bot-mode.md
index 40c45478715..e53cb8af6b1 100644
--- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/bot-mode.md
+++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/user-guide/bot-mode.md
@@ -166,9 +166,9 @@ Bot 间投递是按次调用的:接收方 Bot 会在它下一次运行时取
```bash
hermes peer add spark --url http://spark.lan:8377 --key <API_SERVER_KEY>
hermes peer list
-hermes peer dm spark < /tmp/dm.txt # 消息内容来自一个文件(不经过 shell 解释)
-hermes peer dm spark/researcher < /tmp/dm.txt # 多路复用 peer 上的指定 profile
-hermes peer run spark --idempotency-key ticket-123 < /tmp/long-task.txt
+hermes peer dm spark < ~/.hermes/cache/scratch/dm.txt # 消息内容来自一个文件(不经过 shell 解释)
+hermes peer dm spark/researcher < ~/.hermes/cache/scratch/dm.txt # 多路复用 peer 上的指定 profile
+hermes peer run spark --idempotency-key ticket-123 < ~/.hermes/cache/scratch/long-task.txt
hermes peer status spark run_abc123
hermes peer stop spark run_abc123
```