@@ -906,24 +906,29 @@ def test_stop_hook_disabled_by_config(tmp_path):
906906
907907
908908def test_stop_hook_enabled_by_default (tmp_path ):
909- """When config has no hooks section , stop hook blocks normally ."""
909+ """When auto_save is enabled , stop hook saves silently (systemMessage) ."""
910910 transcript = tmp_path / "t.jsonl"
911911 _write_transcript (
912912 transcript ,
913913 [{"message" : {"role" : "user" , "content" : f"msg { i } " }} for i in range (SAVE_INTERVAL )],
914914 )
915+ save_result = {"count" : 3 , "themes" : ["auto-save" ]}
915916 with patch ("mempalace.hooks_cli.MempalaceConfig" ) as mock_cfg_cls :
916917 mock_cfg_cls .return_value .hooks_auto_save = True
917- result = _capture_hook_output (
918- hook_stop ,
919- {
920- "session_id" : "test" ,
921- "stop_hook_active" : False ,
922- "transcript_path" : str (transcript ),
923- },
924- state_dir = tmp_path ,
925- )
926- assert result ["decision" ] == "block"
918+ mock_cfg_cls .return_value .hook_silent_save = True
919+ mock_cfg_cls .return_value .hook_desktop_toast = False
920+ with patch ("mempalace.hooks_cli._save_diary_direct" , return_value = save_result ):
921+ result = _capture_hook_output (
922+ hook_stop ,
923+ {
924+ "session_id" : "test" ,
925+ "stop_hook_active" : False ,
926+ "transcript_path" : str (transcript ),
927+ },
928+ state_dir = tmp_path ,
929+ )
930+ assert "systemMessage" in result
931+ assert "3 memories" in result ["systemMessage" ]
927932
928933
929934def test_precompact_hook_disabled_by_config (tmp_path ):
0 commit comments