@@ -66,8 +66,10 @@ func TestHookOverwrite_MidTurnWipe_NextPromptRecovers(t *testing.T) {
6666 "hooks should be detected as overwritten" )
6767
6868 // Second commit — hooks are gone, use plain go-git commit (no binary invoked).
69- // This simulates what happens in the real world: git runs the husky hook script,
70- // which doesn't call `entire`, so no trailer is added.
69+ // This simulates the real-world situation after husky/lefthook has overwritten
70+ // our hooks: a commit is made where git would run a third-party hook that does
71+ // not call `entire`, so from Entire's perspective no hooks run and no trailer
72+ // is added.
7173 env .GitAdd ("fileB.go" )
7274 env .GitCommit ("Add file B" )
7375 cpID2 := env .GetCheckpointIDFromCommitMessage (env .GetHeadHash ())
@@ -78,17 +80,16 @@ func TestHookOverwrite_MidTurnWipe_NextPromptRecovers(t *testing.T) {
7880 err = env .SimulateStop (sess .ID , sess .TranscriptPath )
7981 require .NoError (t , err )
8082
81- // === Prompt 2: EnsureSetup should reinstall hooks ===
82- sess2 := env .NewSession ()
83+ // === Prompt 2: same session, next turn — EnsureSetup should reinstall hooks ===
8384
8485 env .WriteFile ("fileC.go" , "package main\n \n func C() {}\n " )
8586
86- sess2 .CreateTranscript ("Create file C" , []FileChange {
87+ sess .CreateTranscript ("Create file C" , []FileChange {
8788 {Path : "fileC.go" , Content : "package main\n \n func C() {}\n " },
8889 })
8990
9091 err = env .SimulateUserPromptSubmitWithPromptAndTranscriptPath (
91- sess2 .ID , "Create file C" , sess2 .TranscriptPath )
92+ sess .ID , "Create file C" , sess .TranscriptPath )
9293 require .NoError (t , err )
9394
9495 // Verify hooks were reinstalled by EnsureSetup
@@ -102,8 +103,8 @@ func TestHookOverwrite_MidTurnWipe_NextPromptRecovers(t *testing.T) {
102103 assert .NoError (t , err , "backup %s.pre-entire should exist after reinstall" , hookName )
103104 }
104105
105- // Third commit — hooks restored, binary invoked again → trailer added
106- env .GitCommitWithShadowHooks ("Add file C" , "fileC.go" )
106+ // Third commit — hooks restored, agent commits (no TTY) → trailer added via fast path
107+ env .GitCommitWithShadowHooksAsAgent ("Add file C" , "fileC.go" )
107108 cpID3 := env .GetCheckpointIDFromCommitMessage (env .GetHeadHash ())
108109 assert .NotEmpty (t , cpID3 ,
109110 "third commit should have trailer (hooks reinstalled by prompt 2)" )
0 commit comments