@@ -24,23 +24,6 @@ export async function getCheckpointService(
2424 return undefined
2525 }
2626
27- 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- }
42- }
43-
4427 const provider = cline . providerRef . deref ( )
4528
4629 const log = ( message : string ) => {
@@ -53,8 +36,6 @@ export async function getCheckpointService(
5336 }
5437 }
5538
56- console . log ( "[Task#getCheckpointService] initializing checkpoints service" )
57-
5839 try {
5940 const workspaceDir = getWorkspacePath ( )
6041
@@ -78,20 +59,31 @@ export async function getCheckpointService(
7859 shadowDir : globalStorageDir ,
7960 log,
8061 }
81-
82- const service = RepoPerTaskCheckpointService . create ( options )
62+ if ( cline . checkpointServiceInitializing ) {
63+ await pWaitFor (
64+ ( ) => {
65+ console . log ( "[Task#getCheckpointService] waiting for service to initialize" )
66+ return cline . checkpointService ?. isInitialized === true
67+ } ,
68+ { interval, timeout } ,
69+ )
70+ return cline . checkpointService
71+ }
72+ console . log ( "[Task#getCheckpointService] initializing checkpoints service" )
8373 cline . checkpointServiceInitializing = true
74+ const service = RepoPerTaskCheckpointService . create ( options )
75+ cline . checkpointService = service
8476
8577 // Check if Git is installed before initializing the service
8678 // Only assign the service after successful initialization
8779 try {
8880 await checkGitInstallation ( cline , service , log , provider )
89- cline . checkpointService = service
9081 return service
9182 } catch ( err ) {
9283 // Clean up on failure
9384 cline . checkpointServiceInitializing = false
9485 cline . enableCheckpoints = false
86+ cline . checkpointService = undefined
9587 throw err
9688 }
9789 } catch ( err ) {
0 commit comments