@@ -768,24 +768,29 @@ def test_stop_hook_disabled_by_config(tmp_path):
768768
769769
770770def test_stop_hook_enabled_by_default (tmp_path ):
771- """When config has no hooks section , stop hook blocks normally ."""
771+ """When auto_save is enabled , stop hook saves silently (systemMessage) ."""
772772 transcript = tmp_path / "t.jsonl"
773773 _write_transcript (
774774 transcript ,
775775 [{"message" : {"role" : "user" , "content" : f"msg { i } " }} for i in range (SAVE_INTERVAL )],
776776 )
777+ save_result = {"count" : 3 , "themes" : ["auto-save" ]}
777778 with patch ("mempalace.hooks_cli.MempalaceConfig" ) as mock_cfg_cls :
778779 mock_cfg_cls .return_value .hooks_auto_save = True
779- result = _capture_hook_output (
780- hook_stop ,
781- {
782- "session_id" : "test" ,
783- "stop_hook_active" : False ,
784- "transcript_path" : str (transcript ),
785- },
786- state_dir = tmp_path ,
787- )
788- assert result ["decision" ] == "block"
780+ mock_cfg_cls .return_value .hook_silent_save = True
781+ mock_cfg_cls .return_value .hook_desktop_toast = False
782+ with patch ("mempalace.hooks_cli._save_diary_direct" , return_value = save_result ):
783+ result = _capture_hook_output (
784+ hook_stop ,
785+ {
786+ "session_id" : "test" ,
787+ "stop_hook_active" : False ,
788+ "transcript_path" : str (transcript ),
789+ },
790+ state_dir = tmp_path ,
791+ )
792+ assert "systemMessage" in result
793+ assert "3 memories" in result ["systemMessage" ]
789794
790795
791796def test_precompact_hook_disabled_by_config (tmp_path ):
0 commit comments