Skip to content

Commit 2629ae5

Browse files
jpheinclaude
andcommitted
fix(hooks): default silent_guard=True — config-read failure must not suppress saves
Addresses bensig's review on PR MemPalace#1021. silent_guard was initialized to False, so when both MempalaceConfig import and .hook_silent_save attribute access failed, silent_guard stayed False. Then `if not silent_guard:` fired and returned empty — silently dropping the save. In silent mode (the default since v3.3.0), saves should ALWAYS proceed on config-read failure. Changing the initial value to True makes that the safe default. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 2183d86 commit 2629ae5

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

mempalace/hooks_cli.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,19 +241,22 @@ def hook_stop(data: dict, harness: str):
241241
# no loop to prevent — and Claude Code's plugin dispatch sets this flag on every
242242
# fire after the first, which would otherwise suppress all subsequent auto-saves.
243243
if str(stop_hook_active).lower() in ("true", "1", "yes"):
244-
silent_guard = False
244+
# Safe default: assume silent mode on any config-read failure so saves
245+
# proceed rather than being silently dropped. Silent mode is the default
246+
# (v3.3.0+), so if we can't read config, behave as if it's still on.
247+
silent_guard = True
245248
try:
246249
from .config import MempalaceConfig
247250
except ImportError as exc:
248251
_log(
249-
f"WARNING: could not import MempalaceConfig for stop guard: {exc}; preserving block-mode guard"
252+
f"WARNING: could not import MempalaceConfig for stop guard: {exc}; defaulting to silent mode"
250253
)
251254
else:
252255
try:
253256
silent_guard = MempalaceConfig().hook_silent_save
254257
except AttributeError as exc:
255258
_log(
256-
f"WARNING: could not read hook_silent_save: {exc}; preserving block-mode guard"
259+
f"WARNING: could not read hook_silent_save: {exc}; defaulting to silent mode"
257260
)
258261
if not silent_guard:
259262
_output({})

0 commit comments

Comments
 (0)