personal memory agent
0

Configure Feed

Select the types of activity you want to include in your feed.

fix(providers): route brain-refresh lease probe through owner

The journal brain refresh busy-detection path imported the raw
journal_io probe_file_lease_held primitive into brain_cli.py and called
it against brain_refresh_lease_path() directly. brain_cli.py is not the
L2 owner of the health/brain-refresh.lease domain (brain_state.py is),
so this tripped the journal-io-access gate.

Add a strictly-additive read-only owner accessor
probe_brain_refresh_lease_held() on brain_state.py and route the CLI
through it. No reducer behavior changes; the underlying probe (already
used internally by inspect_brain_state) is unchanged, and the caller
keeps its OSError->not-busy interpretation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

+14 -3
+2 -3
solstone/think/brain_cli.py
··· 16 16 from typing import Any, Literal, Mapping, cast 17 17 18 18 from solstone.think.journal_config import read_journal_config 19 - from solstone.think.journal_io.lease import probe_file_lease_held 20 19 from solstone.think.models import ( 21 20 AttestationFailedError, 22 21 AttestationNotVerifiedError, ··· 38 37 BrainStateRecord, 39 38 abandon_brain_refresh, 40 39 begin_brain_refresh, 41 - brain_refresh_lease_path, 42 40 brain_state_path, 43 41 build_active_brain_fingerprint, 44 42 finish_brain_refresh, 45 43 inspect_brain_state, 44 + probe_brain_refresh_lease_held, 46 45 runtime_phase_reason, 47 46 ) 48 47 from solstone.think.providers.runtime_health import ( ··· 650 649 if permit is None: 651 650 busy = False 652 651 try: 653 - busy = probe_file_lease_held(brain_refresh_lease_path()) 652 + busy = probe_brain_refresh_lease_held() 654 653 except OSError: 655 654 busy = False 656 655 if busy:
+12
solstone/think/providers/brain_state.py
··· 555 555 return root / "health" / "brain-refresh.lease" 556 556 557 557 558 + def probe_brain_refresh_lease_held(*, journal_path: str | Path | None = None) -> bool: 559 + """Report whether a brain-refresh permit lease is currently held. 560 + 561 + Owner-routed read of the ``health/brain-refresh.lease`` domain artifact, so 562 + non-owner callers (the ``journal brain`` CLI) can tell a busy refresh apart 563 + from other reasons a permit was declined without importing the raw 564 + ``journal_io`` lease primitive. Never mutates state; may propagate the 565 + underlying ``OSError`` for the caller to interpret. 566 + """ 567 + return probe_file_lease_held(brain_refresh_lease_path(journal_path=journal_path)) 568 + 569 + 558 570 def _utc(now: datetime) -> datetime: 559 571 if now.tzinfo is None or now.utcoffset() is None: 560 572 raise ValueError("brain state timestamps require timezone-aware datetimes")