fix(tests): contain RUNE_MEMORY_DIR leak in openai_compat transport test — dichotomy wave
CI Pipeline / best-practices (push) Successful in 8s
CI Pipeline / documentation (push) Successful in 3s
CI Pipeline / rust-surface (push) Failing after 14s
CI Pipeline / go-surface (push) Failing after 17s
CI Pipeline / required-checks (push) Canceled after 0s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Canceled after 0s
CI Pipeline / type-check (push) Canceled after 10s
CI Pipeline / gitea-offline (push) Canceled after 10s
Auto-version and Release / release (push) Canceled after 25s
CI Pipeline / unit-tests (push) Canceled after 26s
CI Pipeline / lint (push) Canceled after 26s
CI Pipeline / canary (push) Canceled after 26s
deploy / deploy (push) Canceled after 26s

This commit is contained in:
Nick committed 2026-10-12 02:00:44 +01:00
1 parent 5cea323f8b
commit 480e25c750
2 files changed
+28 -6

No files matched your search

+13 -5
View File
@@ -90,7 +90,14 @@ def iso_of(us):
BASE_US = us_of(datetime(2026, 10, 11, 12, 0, 0, 123456, tzinfo=timezone.utc))
HOUR_US = 3600 * 1_000_000
MEM_FILE = os.path.join("/tmp/ta_truth_memory", "time_awareness.json")
def _mem_file():
"""The singleton's default storage path, resolved at op time — other
tests may repoint RUNE_MEMORY_DIR mid-session (env hygiene leaks)."""
import memory_env
return os.path.join(memory_env.memory_dir(), "time_awareness.json")
def state_obs(instance):
@@ -191,12 +198,13 @@ class Driver:
"file": file_obs(self.instance.storage_path),
}
if kind == "mod_ctx" or kind == "mod_status" or kind == "mod_parse":
mem_file = _mem_file()
seed = op.get("seed_file")
if seed is None:
if os.path.exists(MEM_FILE):
os.remove(MEM_FILE)
if os.path.exists(mem_file):
os.remove(mem_file)
else:
with open(MEM_FILE, "w") as f:
with open(mem_file, "w") as f:
f.write(seed)
ta._time_awareness = None
if kind == "mod_ctx":
@@ -208,7 +216,7 @@ class Driver:
inst = ta._time_awareness
ob = {"result": r, "state": state_obs(inst)}
if kind == "mod_ctx":
ob["file"] = file_obs(MEM_FILE)
ob["file"] = file_obs(mem_file)
return ob
if kind == "cli":
import contextlib
+15 -1
View File
@@ -135,8 +135,22 @@ class TestTransportSelection:
sys.path.insert(0, str(ROOT / "src"))
os.environ["MIMO_PROBE_ENABLED"] = "0"
# Journal edges resolve via memory_env; on CI the real memory dir is
# root-owned (PermissionError on events.jsonl). Isolate first.
# root-owned (PermissionError on events.jsonl). Isolate first — and
# RESTORE after: a leaked RUNE_MEMORY_DIR re-homes every later
# test's default-path singleton (bit the time_awareness port tests).
saved_mem_dir = os.environ.get("RUNE_MEMORY_DIR")
os.environ["RUNE_MEMORY_DIR"] = os.path.join(tempfile.mkdtemp(), "memory")
try:
self._run_pinned_cloud_selection()
finally:
if saved_mem_dir is None:
os.environ.pop("RUNE_MEMORY_DIR", None)
else:
os.environ["RUNE_MEMORY_DIR"] = saved_mem_dir
def _run_pinned_cloud_selection(self):
import os
from unittest import mock
from rune import rune_operator
from rune.local_tool_runtime import OllamaChatTransport