Files
hermes-agent/tools
Brooklyn Nicholson 4f37880f3d fix(delegation): type-validate the parent db_path before pinning the live home
The side-effect screen on #131931 caught _parent_live_home's double
getattr turning any parent without a real _session_db.db_path (MagicMock
test doubles, duck-typed fakes) into a truthy Mock 'home', sending
transcripts to str(<MagicMock>) paths — red 3/3 in
tests/tools/test_delegation_recovery_diagnostics.py, green on main.

Validate the resolved db_path against concrete str/Path before trusting
its .parent; anything else falls back to None (ambient resolve) with a
debug log. Concrete types on purpose, not the os.PathLike protocol:
MagicMock registers __fspath__ and so IS PathLike, which is exactly how
the garbage pin slipped through a protocol check.

Also documents the answer to the positional-.parent invariant question
from Enough1122's review on source PR #92001: state.db's direct-under-home
placement is load-bearing across the codebase, asserted by a new test.
2026-10-02 21:49:36 -05:00
..