diff --git a/metagpt/actions/prepare_documents.py b/metagpt/actions/prepare_documents.py index bba3deaa3..eb674374c 100644 --- a/metagpt/actions/prepare_documents.py +++ b/metagpt/actions/prepare_documents.py @@ -13,6 +13,7 @@ from typing import Dict, Optional from metagpt.actions import Action, UserRequirement from metagpt.const import REQUIREMENT_FILENAME +from metagpt.logs import logger from metagpt.schema import AIMessage from metagpt.utils.common import any_to_str from metagpt.utils.file_repository import FileRepository @@ -56,6 +57,7 @@ class PrepareDocuments(Action): if not v or k in ["resources", "reason"]: continue self.context.kwargs.set(k, v) + logger.info(f"{k}={v}") if self.context.kwargs.project_path: self.config.update_via_cli( project_path=self.context.kwargs.project_path, diff --git a/metagpt/environment/base_env.py b/metagpt/environment/base_env.py index f6d2e431d..db6f6b454 100644 --- a/metagpt/environment/base_env.py +++ b/metagpt/environment/base_env.py @@ -202,6 +202,8 @@ class Environment(ExtEnv): for _ in range(k): futures = [] for role in self.roles.values(): + if role.is_idle: + continue future = role.run() futures.append(future) diff --git a/metagpt/utils/git_repository.py b/metagpt/utils/git_repository.py index 3c45c4085..23a79929e 100644 --- a/metagpt/utils/git_repository.py +++ b/metagpt/utils/git_repository.py @@ -505,11 +505,11 @@ class GitRepository: issue=issue, ) else: - head_branch = base_repo.get_branch(base) - base_branch = head_repo.get_branch(head) + base_branch = base_repo.get_branch(base) + head_branch = head_repo.get_branch(head) pr = base_repo.create_pull( base=base_branch.name, - head=head_branch.commit.sha, + head=f"{head_repo.full_name}:{head_branch.name}", title=title, body=body, maintainer_can_modify=maintainer_can_modify, diff --git a/tests/metagpt/test_environment.py b/tests/metagpt/test_environment.py index 07f5b4305..522013804 100644 --- a/tests/metagpt/test_environment.py +++ b/tests/metagpt/test_environment.py @@ -31,6 +31,7 @@ serdeser_path = Path(__file__).absolute().parent.joinpath("../data/serdeser_stor class MockEnv(Environment): def publish_message(self, message: Message, peekable: bool = True) -> bool: + logger.info(f"{message.metadata}:{message.content}") consumers = [] for role, addrs in self.member_addrs.items(): if is_send_to(message, addrs): @@ -87,6 +88,7 @@ async def test_publish_and_process_message(env: Environment): assert len(env.history.storage) == 0 +@pytest.mark.skip @pytest.mark.asyncio @pytest.mark.parametrize( ("content", "send_to"), @@ -105,7 +107,7 @@ async def test_publish_and_process_message(env: Environment): any_to_str(ProjectManager), ), ( - "Rewrite 'main.py' of the project at '/Users/iorishinier/github/MetaGPT/workspace/snake_game'", + "src filename is 'game.py', Uncaught SyntaxError: Identifier 'Position' has already been declared (at game.js:1:1), the project at '/Users/iorishinier/github/bak/MetaGPT/workspace/snake_game'", any_to_str(Engineer), ), ( diff --git a/tests/metagpt/tools/libs/test_git.py b/tests/metagpt/tools/libs/test_git.py index c96a3eb46..c695275ff 100644 --- a/tests/metagpt/tools/libs/test_git.py +++ b/tests/metagpt/tools/libs/test_git.py @@ -91,6 +91,39 @@ async def test_new_pr(): assert pr +@pytest.mark.skip +@pytest.mark.asyncio +async def test_new_pr1(): + body = """ + >>> SUMMARY + >>> Change HTTP library used to send requests + >>> + >>> TESTS + >>> - [x] Send 'GET' request + >>> - [x] Send 'POST' request with/without body + """ + pr = await GitRepository.create_pull( + base_repo_name="iorisa/MetaGPT", + base="fixbug/vscode", + head_repo_name="send18/MetaGPT", + head="dev", + title="Test pr", + body=body, + access_token=await get_env(key="access_token", app_name="github"), + ) + # pr = await GitRepository.create_pull( + # head_repo_name="iorisa/MetaGPT", + # head="fixbug/vscode", + # base_repo_name="send18/MetaGPT", + # base="dev", + # title="Test pr", + # body=body, + # access_token=await get_env(key="access_token", app_name="github"), + # ) + print(pr) + assert pr + + @pytest.mark.skip @pytest.mark.asyncio async def test_auth(): @@ -124,6 +157,7 @@ async def test_github(context): assert pr +@pytest.mark.skip @pytest.mark.asyncio @pytest.mark.parametrize( "content",