Skip to content

The agent that grows with you

test: local-runtime recovery fixture publishes its router record by rename

teknium19fd49de9d86d
diff --git a/tests/hermes_cli/test_local_runtime_recovery.py b/tests/hermes_cli/test_local_runtime_recovery.py
index e9ba3536f91..c9fdd0e6054 100644
--- a/tests/hermes_cli/test_local_runtime_recovery.py
+++ b/tests/hermes_cli/test_local_runtime_recovery.py
@@ -53,12 +53,15 @@ def test_startup_preserves_trees_and_explicit_stop_checks_owner(tmp_path, monkey
# A real owner exits without cleanup, leaving a router and its model child.
ready = tmp_path / "router.json"
child_script = tmp_path / "router.py"
+ # The record lands by rename: the parent polls ``ready.exists()``, and an in-place write is visible
+ # (empty) the instant the child opens it — a loaded runner then reads b"" and json.loads raises.
child_script.write_text(
"import json,os,sys,time,subprocess,psutil\n"
"child = subprocess.Popen([sys.executable, '-c', 'import time; time.sleep(60)'])\n"
- "with open(sys.argv[1], 'w') as f:\n"
+ "with open(sys.argv[1] + '.tmp', 'w') as f:\n"
" json.dump({'router': os.getpid(), 'child': child.pid, "
"'create_time': psutil.Process().create_time()}, f)\n"
+ "os.replace(sys.argv[1] + '.tmp', sys.argv[1])\n"
"time.sleep(60)\n", encoding="utf-8")
owner = subprocess.Popen([
sys.executable, "-c",