@@ -707,24 +707,29 @@ def test_stop_hook_disabled_by_config(tmp_path):
707707
708708
709709def test_stop_hook_enabled_by_default (tmp_path ):
710- """When config has no hooks section , stop hook blocks normally ."""
710+ """When auto_save is enabled , stop hook saves silently (systemMessage) ."""
711711 transcript = tmp_path / "t.jsonl"
712712 _write_transcript (
713713 transcript ,
714714 [{"message" : {"role" : "user" , "content" : f"msg { i } " }} for i in range (SAVE_INTERVAL )],
715715 )
716+ save_result = {"count" : 3 , "themes" : ["auto-save" ]}
716717 with patch ("mempalace.hooks_cli.MempalaceConfig" ) as mock_cfg_cls :
717718 mock_cfg_cls .return_value .hooks_auto_save = True
718- result = _capture_hook_output (
719- hook_stop ,
720- {
721- "session_id" : "test" ,
722- "stop_hook_active" : False ,
723- "transcript_path" : str (transcript ),
724- },
725- state_dir = tmp_path ,
726- )
727- assert result ["decision" ] == "block"
719+ mock_cfg_cls .return_value .hook_silent_save = True
720+ mock_cfg_cls .return_value .hook_desktop_toast = False
721+ with patch ("mempalace.hooks_cli._save_diary_direct" , return_value = save_result ):
722+ result = _capture_hook_output (
723+ hook_stop ,
724+ {
725+ "session_id" : "test" ,
726+ "stop_hook_active" : False ,
727+ "transcript_path" : str (transcript ),
728+ },
729+ state_dir = tmp_path ,
730+ )
731+ assert "systemMessage" in result
732+ assert "3 memories" in result ["systemMessage" ]
728733
729734
730735def test_precompact_hook_disabled_by_config (tmp_path ):
0 commit comments