The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(state): keep unstamped flock records breakable when pidns lookup fails
kshitijk4poor11d9a1d1d958
diff --git a/hermes_state_pidns.py b/hermes_state_pidns.pyindex c1272020155..75cce52ae0d 100644--- a/hermes_state_pidns.py+++ b/hermes_state_pidns.py@@ -108,10 +108,10 @@ def _qualify(recorded: Optional[str], *, unstamped_checkable: bool) -> bool:local = _local_pid_namespace()if not local.supported:return True # single-namespace platform: a pid is evidence on its own- if local.id is None:- return False # our own lookup failed: unknown authority is not authorityif recorded is None:return unstamped_checkable+ if local.id is None:+ return False # our own lookup failed: unknown authority is not authorityreturn str(recorded) == str(local.id)diff --git a/tests/hermes_state/test_lease_pid_namespace.py b/tests/hermes_state/test_lease_pid_namespace.pyindex d5d6905ff8f..bdc895cd369 100644--- a/tests/hermes_state/test_lease_pid_namespace.py+++ b/tests/hermes_state/test_lease_pid_namespace.py@@ -52,7 +52,7 @@ def test_turn_lease_of_sibling_namespace_is_not_stolen(tmp_path) -> None:assert db.try_acquire_session_turn_lease("shared", contender, ttl_seconds=300) is True-def test_flock_holder_record_qualifies_pid_namespaces() -> None:+def test_flock_holder_record_qualifies_pid_namespaces(monkeypatch) -> None:dead = _dead_pid()provably_dead = hermes_state_common._lock_holder_provably_dead@@ -63,3 +63,10 @@ def test_flock_holder_record_qualifies_pid_namespaces() -> None:# Unstamped (pre-upgrade) record: these never expire, so keep probing them.assert provably_dead({"pid": dead, "start_ticks": 1, "acquired_at": 0.0}) is Trueassert provably_dead(None) is False++ # Our own namespace lookup failed: a stamped record is unverifiable, but an+ # unstamped one still breaks (#100108 orphan-lock cleanup must not regress).+ monkeypatch.setattr(hermes_state_pidns, "_LOCAL_PID_NS", None)+ monkeypatch.setattr(hermes_state_pidns, "_resolve_local_pid_namespace", lambda: LocalPidNamespace(None, True))+ assert provably_dead({"pid": dead, "pidns": _OURS, "start_ticks": 1, "acquired_at": 0.0}) is False+ assert provably_dead({"pid": dead, "start_ticks": 1, "acquired_at": 0.0}) is True