Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(release): canonicalize memory runtime temp roots (#1366)
Call Whitebe16d634d7e6
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.ymlindex 82592636c..7eb7f2102 100644--- a/.github/workflows/publish.yml+++ b/.github/workflows/publish.yml@@ -137,6 +137,8 @@ jobs:python-version: "3.12"- name: Build Memory Runtime bundle+ env:+ TMPDIR: ${{ runner.temp }}run: |python scripts/build_memory_runtime.py \--output-dir runtime-artifacts \diff --git a/.github/workflows/release_ai.yml b/.github/workflows/release_ai.ymlindex 9ca1e0f56..8374cbf8d 100644--- a/.github/workflows/release_ai.yml+++ b/.github/workflows/release_ai.yml@@ -116,6 +116,8 @@ jobs:python-version: "3.12"- name: Build Memory Runtime bundle+ env:+ TMPDIR: ${{ runner.temp }}run: |python scripts/build_memory_runtime.py \--output-dir runtime-artifacts \diff --git a/scripts/build_memory_runtime.py b/scripts/build_memory_runtime.pyindex c85464d82..0b2d6b653 100644--- a/scripts/build_memory_runtime.py+++ b/scripts/build_memory_runtime.py@@ -14,6 +14,8 @@ import sysimport sysconfigimport tarfileimport tempfile+from collections.abc import Iterator+from contextlib import contextmanagerfrom pathlib import Path, PurePosixPath, PureWindowsPath@@ -55,6 +57,24 @@ def _sha256(path: Path) -> str:return digest.hexdigest()+@contextmanager+def _temporary_directory(prefix: str) -> Iterator[Path]:+ """Create scratch space beneath the canonical system temp directory."""++ temp_root = Path(tempfile.gettempdir()).resolve(strict=True)+ with tempfile.TemporaryDirectory(prefix=prefix, dir=temp_root) as temporary:+ yield Path(temporary)+++@contextmanager+def _short_socket_directory(prefix: str) -> Iterator[Path]:+ """Create canonical scratch space short enough for Unix-domain sockets."""++ temp_root = Path("/tmp").resolve(strict=True)+ with tempfile.TemporaryDirectory(prefix=prefix, dir=temp_root) as temporary:+ yield Path(temporary)++def _platform_tag() -> str:raw = sysconfig.get_platform().lower()machine = raw.rsplit("-", 1)[-1]@@ -142,8 +162,8 @@ def create_archive(*, runtime_root: Path, output: Path, platform: str) -> dict[sdef verify_archive(archive_path: Path, *, binary_sha256: str) -> None:"""Extract and smoke the final bytes in a new directory."""- with tempfile.TemporaryDirectory(prefix="avibe-memory-runtime-verify-") as temporary_value:- destination = Path(temporary_value) / "runtime"+ with _temporary_directory("avibe-memory-runtime-verify-") as temporary:+ destination = temporary / "runtime"destination.mkdir()destination_resolved = destination.resolve()with tarfile.open(archive_path, "r:gz") as archive:@@ -171,8 +191,8 @@ def verify_archive(archive_path: Path, *, binary_sha256: str) -> None:if _sha256(binary) != binary_sha256:raise SystemExit("Memory Runtime extracted Python checksum mismatch")_smoke(binary, cwd=destination.parent)- with tempfile.TemporaryDirectory(prefix="mrv-health-", dir="/tmp") as health_home:- _sidecar_health_smoke(binary, effective_home=Path(health_home))+ with _short_socket_directory("mrv-") as health_home:+ _sidecar_health_smoke(binary, effective_home=health_home)def prune_runtime(runtime_root: Path) -> None:@@ -329,8 +349,7 @@ def build_runtime(if uv_identity.split()[:2] != ["uv", UV_VERSION]:raise SystemExit(f"Memory Runtime builder requires uv {UV_VERSION}")- with tempfile.TemporaryDirectory(prefix="avibe-memory-runtime-") as temporary_value:- temporary = Path(temporary_value)+ with _temporary_directory("avibe-memory-runtime-") as temporary:_run([uv_command, "python", "install", python_version], cwd=temporary)found = _run([uv_command, "python", "find", "--no-project", "--managed-python", python_version],diff --git a/tests/test_memory_runtime_release.py b/tests/test_memory_runtime_release.pyindex 158f72608..19330c7ee 100644--- a/tests/test_memory_runtime_release.py+++ b/tests/test_memory_runtime_release.py@@ -5,6 +5,7 @@ import ioimport jsonimport osimport tarfile+import tempfilefrom pathlib import Pathimport pytest@@ -16,6 +17,8 @@ from scripts.build_memory_runtime import (LOCK_SHA256,PYTHON_VERSION,UV_VERSION,+ _short_socket_directory,+ _temporary_directory,create_archive,prune_runtime,)@@ -41,6 +44,46 @@ def test_release_workflows_emit_metadata_for_the_current_runtime_version() -> Noassert "memory-runtime-1.2.1-${{ matrix.artifact }}.json" not in workflow+def test_release_workflows_build_memory_runtime_under_runner_temp() -> None:+ workflows = Path(__file__).resolve().parents[1] / ".github/workflows"++ for name in ("release_ai.yml", "publish.yml"):+ workflow = (workflows / name).read_text(encoding="utf-8")+ build_step = workflow.split("- name: Build Memory Runtime bundle", 1)[1]+ build_step = build_step.split("- name: Upload Memory Runtime bundle", 1)[0]+ assert "TMPDIR: ${{ runner.temp }}" in build_step+++def test_memory_runtime_scratch_paths_resolve_the_system_temp_root(+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ real_temp = tmp_path / "real-temp"+ real_temp.mkdir()+ linked_temp = tmp_path / "linked-temp"+ linked_temp.symlink_to(real_temp, target_is_directory=True)+ monkeypatch.setattr(tempfile, "tempdir", str(linked_temp))++ with _temporary_directory("memory-runtime-test-") as scratch:+ assert scratch.parent == real_temp.resolve(strict=True)+ assert scratch == scratch.resolve(strict=True)+++def test_memory_runtime_health_home_uses_a_short_canonical_root(+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ long_temp = tmp_path / ("long-temp-" * 12)+ long_temp.mkdir()+ monkeypatch.setattr(tempfile, "tempdir", str(long_temp))++ with _short_socket_directory("mrv-") as health_home:+ socket_path = health_home / "memory" / ".rt" / "everos.sock"+ assert health_home.parent == Path("/tmp").resolve(strict=True)+ assert health_home == health_home.resolve(strict=True)+ assert len(os.fsencode(socket_path)) < 104++def test_github_only_release_runs_memory_runtime_guard_before_uploading_assets() -> None:workflow = (Path(__file__).resolve().parents[1] / ".github/workflows/release_ai.yml"