@@ -212,12 +212,20 @@ async def complete_runtime(
212
212
def init_replay (replay_dir : str | Path ) -> None :
213
213
replay_dir = Path (replay_dir )
214
214
if not replay_dir .exists ():
215
- raise ValueError (f'Replay directory { replay_dir } not found' )
216
-
217
- for repo_name in ['replayapi' , 'devtools' ]:
215
+ replay_dir .mkdir (parents = True )
216
+
217
+ repo_urls = [
218
+ 'https://github.com/replayio-public/replayapi' ,
219
+ 'https://github.com/replayio/devtools' ,
220
+ ]
221
+ for repo_url in repo_urls :
222
+ repo_name = repo_url .split ('/' )[- 1 ]
218
223
repo_path = replay_dir / repo_name
219
224
if not repo_path .exists ():
220
- raise ValueError (f'Repository { repo_name } not found in { replay_dir } ' )
225
+ logger .info (
226
+ f'[Replay] Repository { repo_name } not found in { replay_dir } , cloning...'
227
+ )
228
+ Repo .clone_from (repo_url , str (repo_path ))
221
229
222
230
# Now mypy should see Repo as a proper class.
223
231
repo = Repo (str (repo_path ))
@@ -255,12 +263,6 @@ async def process_issue(
255
263
workspace_base = os .path .join (
256
264
output_dir , 'workspace' , f'{ issue_handler .issue_type } _{ issue .number } '
257
265
)
258
-
259
- replay_dir = os .path .join (output_dir , 'replay' )
260
- logger .info (
261
- f'DEBUGG output_dir={ output_dir } replay_dir={ replay_dir } workspace_base={ workspace_base } '
262
- )
263
-
264
266
# Get the absolute path of the workspace base
265
267
workspace_base = os .path .abspath (workspace_base )
266
268
# write the repo to the workspace
@@ -282,7 +284,8 @@ async def process_issue(
282
284
timeout = 300 ,
283
285
),
284
286
replay = ReplayConfig (
285
- dir = os .environ .get ('REPLAY_DIR' , replay_dir ),
287
+ # Don't set config.replay.dir here in the resolver workflow.
288
+ dir = os .environ .get ('REPLAY_DIR' , None ),
286
289
api_key = os .environ .get ('REPLAY_API_KEY' , None ),
287
290
),
288
291
# do not mount workspace
@@ -300,9 +303,8 @@ async def process_issue(
300
303
await runtime .connect ()
301
304
302
305
# Force-update the Replay repos, if necessary:
303
- if config .replay .dir is None :
304
- raise ValueError ('config.replay.dir is missing' )
305
- init_replay (config .replay .dir )
306
+ replay_dir = os .path .abspath (os .path .join (output_dir , 'replay' ))
307
+ init_replay (replay_dir )
306
308
307
309
async def on_event (evt ):
308
310
logger .info (evt )
0 commit comments