@@ -23,22 +23,8 @@ export async function getCheckpointService(
23
23
if ( ! cline . enableCheckpoints ) {
24
24
return undefined
25
25
}
26
-
27
26
if ( cline . checkpointService ) {
28
- if ( cline . checkpointServiceInitializing ) {
29
- console . log ( "[Task#getCheckpointService] checkpoint service is still initializing" )
30
- const service = cline . checkpointService
31
- await pWaitFor (
32
- ( ) => {
33
- console . log ( "[Task#getCheckpointService] waiting for service to initialize" )
34
- return service . isInitialized
35
- } ,
36
- { interval, timeout } ,
37
- )
38
- return service . isInitialized ? cline . checkpointService : undefined
39
- } else {
40
- return cline . checkpointService
41
- }
27
+ return cline . checkpointService
42
28
}
43
29
44
30
const provider = cline . providerRef . deref ( )
@@ -78,25 +64,32 @@ export async function getCheckpointService(
78
64
shadowDir : globalStorageDir ,
79
65
log,
80
66
}
81
-
67
+ if ( cline . checkpointServiceInitializing ) {
68
+ await pWaitFor (
69
+ ( ) => {
70
+ console . log ( "[Task#getCheckpointService] waiting for service to initialize" )
71
+ return ! ! cline . checkpointService && ! ! cline ?. checkpointService ?. isInitialized
72
+ } ,
73
+ { interval, timeout } ,
74
+ )
75
+ if ( ! cline ?. checkpointService ) {
76
+ cline . enableCheckpoints = false
77
+ return undefined
78
+ }
79
+ return cline . checkpointService
80
+ }
81
+ if ( ! cline . enableCheckpoints ) {
82
+ return undefined
83
+ }
82
84
const service = RepoPerTaskCheckpointService . create ( options )
83
85
cline . checkpointServiceInitializing = true
84
-
85
- // Check if Git is installed before initializing the service
86
- // Only assign the service after successful initialization
87
- try {
88
- await checkGitInstallation ( cline , service , log , provider )
89
- cline . checkpointService = service
90
- return service
91
- } catch ( err ) {
92
- // Clean up on failure
93
- cline . checkpointServiceInitializing = false
94
- cline . enableCheckpoints = false
95
- throw err
96
- }
86
+ await checkGitInstallation ( cline , service , log , provider )
87
+ cline . checkpointService = service
88
+ return service
97
89
} catch ( err ) {
98
90
log ( `[Task#getCheckpointService] ${ err . message } ` )
99
91
cline . enableCheckpoints = false
92
+ cline . checkpointServiceInitializing = false
100
93
return undefined
101
94
}
102
95
}
@@ -175,13 +168,6 @@ export async function checkpointSave(cline: Task, force = false) {
175
168
return
176
169
}
177
170
178
- if ( ! service . isInitialized ) {
179
- const provider = cline . providerRef . deref ( )
180
- provider ?. log ( "[checkpointSave] checkpoints didn't initialize in time, disabling checkpoints for this task" )
181
- cline . enableCheckpoints = false
182
- return
183
- }
184
-
185
171
TelemetryService . instance . captureCheckpointCreated ( cline . taskId )
186
172
187
173
// Start the checkpoint process in the background.
0 commit comments