fix chdir
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
import logging
|
||||
import re
|
||||
import os
|
||||
import subprocess
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Any, Callable
|
||||
@@ -677,14 +676,7 @@ class AgentDispatcher:
|
||||
workspace = WorkspaceManager()
|
||||
repo_path = workspace.get_repo_path(repo)
|
||||
|
||||
original_cwd = os.getcwd()
|
||||
changed_dir = False
|
||||
if os.path.isdir(str(repo_path)):
|
||||
os.chdir(str(repo_path))
|
||||
changed_dir = True
|
||||
|
||||
results: list[str] = []
|
||||
try:
|
||||
# Get authenticated username for reviewer filter
|
||||
ai_username = "meeks-ai"
|
||||
try:
|
||||
@@ -723,10 +715,6 @@ class AgentDispatcher:
|
||||
result = await processor.process(attempt_limit=self._max_retries)
|
||||
results.append(result)
|
||||
|
||||
finally:
|
||||
if changed_dir:
|
||||
os.chdir(original_cwd)
|
||||
|
||||
return results
|
||||
|
||||
# Backward compatibility helper methods for unit tests
|
||||
|
||||
@@ -137,8 +137,6 @@ async def test_dispatch_planning_and_coding_phases(mock_planning_class: MagicMoc
|
||||
priority=0
|
||||
)
|
||||
|
||||
# We mock os.path.isdir to return True so os.chdir won't fail or crash in test
|
||||
with patch("os.path.isdir", return_value=True), patch("os.chdir"):
|
||||
results = await dispatcher.dispatch("meeks/repo1", [work_item])
|
||||
|
||||
assert len(results) == 1
|
||||
|
||||
Reference in New Issue
Block a user