Skip to content

Commit b408d3a

Browse files
committed
fix replay_dir in resolver + also git clone if necessary
1 parent 6959a29 commit b408d3a

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

openhands/resolver/resolve_issue.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,20 @@ async def complete_runtime(
212212
def init_replay(replay_dir: str | Path) -> None:
213213
replay_dir = Path(replay_dir)
214214
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]
218223
repo_path = replay_dir / repo_name
219224
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))
221229

222230
# Now mypy should see Repo as a proper class.
223231
repo = Repo(str(repo_path))
@@ -255,12 +263,6 @@ async def process_issue(
255263
workspace_base = os.path.join(
256264
output_dir, 'workspace', f'{issue_handler.issue_type}_{issue.number}'
257265
)
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-
264266
# Get the absolute path of the workspace base
265267
workspace_base = os.path.abspath(workspace_base)
266268
# write the repo to the workspace
@@ -282,7 +284,8 @@ async def process_issue(
282284
timeout=300,
283285
),
284286
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),
286289
api_key=os.environ.get('REPLAY_API_KEY', None),
287290
),
288291
# do not mount workspace
@@ -300,9 +303,8 @@ async def process_issue(
300303
await runtime.connect()
301304

302305
# 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)
306308

307309
async def on_event(evt):
308310
logger.info(evt)

0 commit comments

Comments
 (0)