From 2629ae5b713a0da6bb2e5b5f7c0f0d9b93e89238 Mon Sep 17 00:00:00 2001 From: jp Date: Sun, 19 Apr 2026 08:22:45 -0700 Subject: [PATCH] =?UTF-8?q?fix(hooks):=20default=20silent=5Fguard=3DTrue?= =?UTF-8?q?=20=E2=80=94=20config-read=20failure=20must=20not=20suppress=20?= =?UTF-8?q?saves?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses bensig's review on PR #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) --- mempalace/hooks_cli.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mempalace/hooks_cli.py b/mempalace/hooks_cli.py index 8532632..9ee0661 100644 --- a/mempalace/hooks_cli.py +++ b/mempalace/hooks_cli.py @@ -241,19 +241,22 @@ def hook_stop(data: dict, harness: str): # no loop to prevent — and Claude Code's plugin dispatch sets this flag on every # fire after the first, which would otherwise suppress all subsequent auto-saves. if str(stop_hook_active).lower() in ("true", "1", "yes"): - silent_guard = False + # Safe default: assume silent mode on any config-read failure so saves + # proceed rather than being silently dropped. Silent mode is the default + # (v3.3.0+), so if we can't read config, behave as if it's still on. + silent_guard = True try: from .config import MempalaceConfig except ImportError as exc: _log( - f"WARNING: could not import MempalaceConfig for stop guard: {exc}; preserving block-mode guard" + f"WARNING: could not import MempalaceConfig for stop guard: {exc}; defaulting to silent mode" ) else: try: silent_guard = MempalaceConfig().hook_silent_save except AttributeError as exc: _log( - f"WARNING: could not read hook_silent_save: {exc}; preserving block-mode guard" + f"WARNING: could not read hook_silent_save: {exc}; defaulting to silent mode" ) if not silent_guard: _output({})