@@ -33,19 +33,6 @@ function createInput(
3333 } ;
3434}
3535
36- function createSnapshot (
37- overrides : Partial < AgentTypes . TreeSnapshotEvent > = { } ,
38- ) : AgentTypes . TreeSnapshotEvent {
39- return {
40- treeHash : "abc123" ,
41- baseCommit : "def456" ,
42- archiveUrl : "https://s3.example.com/archive.tar.gz" ,
43- changes : [ { path : "test.txt" , status : "A" } ] ,
44- timestamp : "2026-04-07T00:00:00Z" ,
45- ...overrides ,
46- } ;
47- }
48-
4936function createCheckpoint (
5037 overrides : Partial < AgentTypes . GitCheckpointEvent > = { } ,
5138) : AgentTypes . GitCheckpointEvent {
@@ -75,7 +62,6 @@ function createDeps(overrides: Partial<HandoffSagaDeps> = {}): HandoffSagaDeps {
7562 } ) ,
7663 updateTaskRun : vi . fn ( ) . mockResolvedValue ( { } ) ,
7764 } ) ,
78- applyTreeSnapshot : vi . fn ( ) . mockResolvedValue ( undefined ) ,
7965 applyGitCheckpoint : vi . fn ( ) . mockResolvedValue ( undefined ) ,
8066 updateWorkspaceMode : vi . fn ( ) ,
8167 reconnectSession : vi . fn ( ) . mockResolvedValue ( {
@@ -96,7 +82,6 @@ function createResumeState(
9682) : AgentResume . ResumeState {
9783 return {
9884 conversation : [ ] ,
99- latestSnapshot : null ,
10085 latestGitCheckpoint : null ,
10186 interrupted : false ,
10287 logEntryCount : 0 ,
@@ -130,22 +115,22 @@ describe("HandoffSaga", () => {
130115 mockFormatConversation . mockReturnValue ( "conversation summary" ) ;
131116 } ) ;
132117
133- it ( "completes happy path with snapshot " , async ( ) => {
134- const snapshot = createSnapshot ( ) ;
118+ it ( "completes happy path with checkpoint " , async ( ) => {
119+ const checkpoint = createCheckpoint ( ) ;
135120 const { result } = await runSaga ( {
136121 resumeState : {
137122 conversation : [
138123 { role : "user" , content : [ { type : "text" , text : "hello" } ] } ,
139124 ] ,
140- latestSnapshot : snapshot ,
125+ latestGitCheckpoint : checkpoint ,
141126 logEntryCount : 10 ,
142127 } ,
143128 } ) ;
144129
145130 expect ( result . success ) . toBe ( true ) ;
146131 if ( ! result . success ) return ;
147132 expect ( result . data . sessionId ) . toBe ( "session-1" ) ;
148- expect ( result . data . snapshotApplied ) . toBe ( true ) ;
133+ expect ( result . data . checkpointApplied ) . toBe ( true ) ;
149134 expect ( result . data . conversationTurns ) . toBe ( 1 ) ;
150135 } ) ;
151136
@@ -165,27 +150,15 @@ describe("HandoffSaga", () => {
165150 expect ( closeOrder ) . toBeLessThan ( fetchOrder ) ;
166151 } ) ;
167152
168- it ( "skips snapshot apply when no archiveUrl " , async ( ) => {
153+ it ( "skips checkpoint apply when no checkpoint is present " , async ( ) => {
169154 const { deps, result } = await runSaga ( {
170- resumeState : {
171- latestSnapshot : createSnapshot ( { archiveUrl : undefined } ) ,
172- logEntryCount : 5 ,
173- } ,
155+ resumeState : { logEntryCount : 5 } ,
174156 } ) ;
175157
176158 expect ( result . success ) . toBe ( true ) ;
177159 if ( ! result . success ) return ;
178- expect ( result . data . snapshotApplied ) . toBe ( false ) ;
179- expect ( deps . applyTreeSnapshot ) . not . toHaveBeenCalled ( ) ;
180- } ) ;
181-
182- it ( "skips snapshot apply when no snapshot at all" , async ( ) => {
183- const { deps, result } = await runSaga ( ) ;
184-
185- expect ( result . success ) . toBe ( true ) ;
186- if ( ! result . success ) return ;
187- expect ( result . data . snapshotApplied ) . toBe ( false ) ;
188- expect ( deps . applyTreeSnapshot ) . not . toHaveBeenCalled ( ) ;
160+ expect ( result . data . checkpointApplied ) . toBe ( false ) ;
161+ expect ( deps . applyGitCheckpoint ) . not . toHaveBeenCalled ( ) ;
189162 } ) ;
190163
191164 it ( "seeds local logs when cloudLogUrl is present" , async ( ) => {
@@ -232,16 +205,16 @@ describe("HandoffSaga", () => {
232205 ) ;
233206 } ) ;
234207
235- it ( "context mentions files restored when snapshot applied" , async ( ) => {
208+ it ( "context mentions files restored when checkpoint applied" , async ( ) => {
236209 const { deps } = await runSaga ( {
237210 resumeState : {
238- latestSnapshot : createSnapshot ( ) ,
211+ latestGitCheckpoint : createCheckpoint ( ) ,
239212 } ,
240213 } ) ;
241214
242215 expect ( deps . setPendingContext ) . toHaveBeenCalledWith (
243216 "run-1" ,
244- expect . stringContaining ( "fully restored" ) ,
217+ expect . stringContaining ( "restored from the cloud session checkpoint " ) ,
245218 ) ;
246219 } ) ;
247220
@@ -262,14 +235,12 @@ describe("HandoffSaga", () => {
262235 const { deps } = await runSaga ( {
263236 resumeState : {
264237 latestGitCheckpoint : createCheckpoint ( ) ,
265- latestSnapshot : createSnapshot ( ) ,
266238 } ,
267239 } ) ;
268240
269241 expect ( getProgressSteps ( deps ) ) . toEqual ( [
270242 "fetching_logs" ,
271243 "applying_git_checkpoint" ,
272- "applying_snapshot" ,
273244 "spawning_agent" ,
274245 "complete" ,
275246 ] ) ;
@@ -318,11 +289,10 @@ describe("HandoffSaga", () => {
318289 } ) ;
319290 } ) ;
320291
321- it ( "applies git checkpoint before restoring the file snapshot " , async ( ) => {
292+ it ( "applies git checkpoint with local git state during handoff " , async ( ) => {
322293 const { deps, result } = await runSaga ( {
323294 input : { localGitState : DEFAULT_LOCAL_GIT_STATE } ,
324295 resumeState : {
325- latestSnapshot : createSnapshot ( ) ,
326296 latestGitCheckpoint : createCheckpoint ( ) ,
327297 } ,
328298 } ) ;
@@ -338,6 +308,5 @@ describe("HandoffSaga", () => {
338308 expect . any ( Object ) ,
339309 DEFAULT_LOCAL_GIT_STATE ,
340310 ) ;
341- expect ( deps . applyTreeSnapshot ) . toHaveBeenCalledTimes ( 1 ) ;
342311 } ) ;
343312} ) ;
0 commit comments