Skip to content

armgit / avibe

Public Imported from GitHub
0

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.

fix(memory): retain unverifiable legacy ownership (#1545)

rkrkrkkdad7a9ace9a8
diff --git a/core/memory/process.py b/core/memory/process.py
index 66349a4d9..5624451f0 100644
--- a/core/memory/process.py
+++ b/core/memory/process.py
@@ -3195,7 +3195,7 @@ def _legacy_create_time_mismatch_verdict(
if identity.uid != own_uid:
return _RecordedSidecar.NOT_OURS
if identity.environment is None:
- return _RecordedSidecar.NOT_OURS
+ return _RecordedSidecar.UNVERIFIABLE
if not _provider_roots_match(identity.environment.get("EVEROS_ROOT"), provider_root):
return _RecordedSidecar.NOT_OURS
return None
diff --git a/tests/test_memory_process.py b/tests/test_memory_process.py
index 87fa15532..3e9f56e68 100644
--- a/tests/test_memory_process.py
+++ b/tests/test_memory_process.py
@@ -1343,8 +1343,6 @@ def test_recorded_sidecar_identity_accepts_only_a_provably_owned_orphan(tmp_path
not_ours: list[tuple[dict, _ProcessIdentity | None]] = [
# The process is confirmed gone.
(_orphan_record(process), None),
- # The pid was recycled: same number, different process.
- (_orphan_record(process), _orphan_identity(process, create_time=_ORPHAN_CREATE_TIME + 1)),
# Not our entrypoint.
(_orphan_record(process), _orphan_identity(process, cmdline=(sys.executable, "-m", "http.server"))),
# Our entrypoint name, but serving a different socket.
@@ -1386,6 +1384,12 @@ def test_recorded_sidecar_identity_accepts_only_a_provably_owned_orphan(tmp_path
_orphan_record(process),
_orphan_identity(process, create_time=424_242.0, wall_create_time=None),
),
+ # A different legacy wall time can be a clock step. Without the
+ # environment, no disclosed fact proves that the pid was recycled.
+ (
+ _orphan_record(process),
+ _orphan_identity(process, create_time=_ORPHAN_CREATE_TIME + 1),
+ ),
]
for record, identity in unverifiable:
assert verdict(record, identity) is _RecordedSidecar.UNVERIFIABLE, (record, identity)
@@ -1842,10 +1846,10 @@ def test_sidecar_launch_reaps_a_recorded_orphan_from_a_previous_run(
assert not record_path.exists()
-def test_sidecar_launch_never_signals_a_pid_it_cannot_identify(
+def test_sidecar_launch_keeps_legacy_record_when_environment_is_undisclosed(
tmp_path: Path,
) -> None:
- """A recycled pid retires the record instead of killing its new owner."""
+ """A clock step without environment evidence cannot prove pid reuse."""
host = _FakeProcessHost()
process = _orphan_process(tmp_path, host=host)
@@ -1855,10 +1859,11 @@ def test_sidecar_launch_never_signals_a_pid_it_cannot_identify(
)
record_path = _write_orphan_record(process, _orphan_record(process))
- asyncio.run(process._ownership.reap())
+ with pytest.raises(RuntimeError, match="recorded sidecar identity could not be verified"):
+ asyncio.run(process._ownership.reap())
assert host.signal_calls == []
- assert not record_path.exists()
+ assert record_path.exists()
def test_sidecar_launch_refuses_to_start_beside_an_unreapable_orphan(
diff --git a/tests/test_memory_sync_process.py b/tests/test_memory_sync_process.py
index 5984beb94..8251842ee 100644
--- a/tests/test_memory_sync_process.py
+++ b/tests/test_memory_sync_process.py
@@ -582,11 +582,12 @@ async def test_handleless_spawn_failure_marks_discovered_pending_record_retryabl
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
) -> None:
+ monkeypatch.setattr(memory_sync_process, "_uses_linux_starttime_stamp", lambda: True)
python = tmp_path / "runtime" / "bin" / "python"
python.parent.mkdir(parents=True)
python.write_bytes(b"python")
uid = os.getuid() if hasattr(os, "getuid") else None
- parent = _ParentIdentity(pid=99, create_time=8.25, uid=uid)
+ parent = _ParentIdentity(pid=99, create_time=8.25, uid=uid, stamp=8.25)
class HandlelessSpawnHost(_Host):
child_is_present = True
@@ -628,11 +629,12 @@ async def test_handleless_spawn_failure_marks_uncertain_pending_record_retryable
monkeypatch: pytest.MonkeyPatch,
tmp_path: Path,
) -> None:
+ monkeypatch.setattr(memory_sync_process, "_uses_linux_starttime_stamp", lambda: True)
python = tmp_path / "runtime" / "bin" / "python"
python.parent.mkdir(parents=True)
python.write_bytes(b"python")
uid = os.getuid() if hasattr(os, "getuid") else None
- parent = _ParentIdentity(pid=99, create_time=8.25, uid=uid)
+ parent = _ParentIdentity(pid=99, create_time=8.25, uid=uid, stamp=8.25)
class UncertainHandlelessSpawnHost(_Host):
discovery_is_uncertain = True