Open wwzeng1 opened 10 months ago
4e91638360
)Here are the sandbox execution logs prior to making any changes:
bb084a7
Checking sweepai/config/client.py for syntax errors... ✅ sweepai/config/client.py has no syntax errors!
1/1 ✓Checking sweepai/config/client.py for syntax errors... ✅ sweepai/config/client.py has no syntax errors!
Sandbox passed on the latest main
, so sandbox checks will be enabled for this issue.
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
sweepai/config/client.py
✓ https://github.com/sweepai/sweep/commit/e509f1c894a252fa606303a2bd3acee60a35c52c Edit
Modify sweepai/config/client.py with contents:
• Modify the get_branch_name_config method to first check if the sweep.yaml file exists in the .github directory of the repository.
• If the file exists in the .github directory, read its contents and return the branch_use_underscores configuration.
• If the file does not exist in the .github directory, fall back to the current behavior of reading the file from the root of the repository.
• Make sure to handle any exceptions that may occur during this process.
--- +++ @@ -225,7 +225,10 @@ @lru_cache(maxsize=None) def get_branch_name_config(repo: Repository): try: - contents = repo.get_contents("sweep.yaml") + try: + contents = repo.get_contents(".github/sweep.yaml") + except Exception: + contents = repo.get_contents("sweep.yaml") description = yaml.safe_load(contents.decoded_content.decode("utf-8")).get( "branch_use_underscores", False )
sweepai/config/client.py
✓ Edit
Check sweepai/config/client.py with contents:
Ran GitHub Actions for e509f1c894a252fa606303a2bd3acee60a35c52c:
• black: ✓
• Vercel Preview Comments: ✓
sweepai/config/client.py
✓ https://github.com/sweepai/sweep/commit/d6d8df8f45aa95e51f990128808c0c8c7deb6073 Edit
Modify sweepai/config/client.py with contents:
• Modify the get_draft method to first check if the sweep.yaml file exists in the .github directory of the repository.
• If the file exists in the .github directory, read its contents and return the draft configuration.
• If the file does not exist in the .github directory, fall back to the current behavior of reading the file from the root of the repository.
• Make sure to handle any exceptions that may occur during this process.
--- +++ @@ -166,7 +166,10 @@ @staticmethod def get_draft(repo: Repository): try: - contents = repo.get_contents("sweep.yaml") + try: + contents = repo.get_contents(".github/sweep.yaml") + except Exception: + contents = repo.get_contents("sweep.yaml") config = yaml.safe_load(contents.decoded_content.decode("utf-8")) return config.get("draft", False) except SystemExit: @@ -225,7 +228,10 @@ @lru_cache(maxsize=None) def get_branch_name_config(repo: Repository): try: - contents = repo.get_contents("sweep.yaml") + try: + contents = repo.get_contents(".github/sweep.yaml") + except Exception: + contents = repo.get_contents("sweep.yaml") description = yaml.safe_load(contents.decoded_content.decode("utf-8")).get( "branch_use_underscores", False )
sweepai/config/client.py
✓ Edit
Check sweepai/config/client.py with contents:
Ran GitHub Actions for d6d8df8f45aa95e51f990128808c0c8c7deb6073:
• black: ✓
• Vercel Preview Comments: ✓
sweepai/config/client.py
✓ https://github.com/sweepai/sweep/commit/586ea4a559661ae44b93a1496dc7347d197e7fc8 Edit
Modify sweepai/config/client.py with contents:
• Modify the get_gha_enabled method to first check if the sweep.yaml file exists in the .github directory of the repository.
• If the file exists in the .github directory, read its contents and return the gha_enabled configuration.
• If the file does not exist in the .github directory, fall back to the current behavior of reading the file from the root of the repository.
• Make sure to handle any exceptions that may occur during this process.
--- +++ @@ -166,7 +166,10 @@ @staticmethod def get_draft(repo: Repository): try: - contents = repo.get_contents("sweep.yaml") + try: + contents = repo.get_contents(".github/sweep.yaml") + except Exception: + contents = repo.get_contents("sweep.yaml") config = yaml.safe_load(contents.decoded_content.decode("utf-8")) return config.get("draft", False) except SystemExit: @@ -179,7 +182,10 @@ @lru_cache(maxsize=None) def get_gha_enabled(repo: Repository) -> bool: try: - contents = repo.get_contents("sweep.yaml") + try: + contents = repo.get_contents(".github/sweep.yaml") + except Exception: + contents = repo.get_contents("sweep.yaml") gha_enabled = yaml.safe_load(contents.decoded_content.decode("utf-8")).get( "gha_enabled", True ) @@ -187,7 +193,7 @@ except SystemExit: raise SystemExit except Exception as e: - logger.exception( + logger.warning( f"Error when getting gha enabled: {e}, traceback: {traceback.format_exc()}, falling back to True" ) return True @@ -225,7 +231,10 @@ @lru_cache(maxsize=None) def get_branch_name_config(repo: Repository): try: - contents = repo.get_contents("sweep.yaml") + try: + contents = repo.get_contents(".github/sweep.yaml") + except Exception: + contents = repo.get_contents("sweep.yaml") description = yaml.safe_load(contents.decoded_content.decode("utf-8")).get( "branch_use_underscores", False )
sweepai/config/client.py
✓ Edit
Check sweepai/config/client.py with contents:
Ran GitHub Actions for 586ea4a559661ae44b93a1496dc7347d197e7fc8:
• black: ✓
• Vercel Preview Comments: ✓
I have finished reviewing the code for completeness. I did not find errors for sweep/allow_sweepyaml_to_be_read_from_the_user
.
💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. Join Our Discord
Checklist
- [X] Modify `sweepai/config/client.py` ✓ https://github.com/sweepai/sweep/commit/e509f1c894a252fa606303a2bd3acee60a35c52c [Edit](https://github.com/sweepai/sweep/edit/sweep/allow_sweepyaml_to_be_read_from_the_user/sweepai/config/client.py#L225-L236) - [X] Running GitHub Actions for `sweepai/config/client.py` ✓ [Edit](https://github.com/sweepai/sweep/edit/sweep/allow_sweepyaml_to_be_read_from_the_user/sweepai/config/client.py#L225-L236) - [X] Modify `sweepai/config/client.py` ✓ https://github.com/sweepai/sweep/commit/d6d8df8f45aa95e51f990128808c0c8c7deb6073 [Edit](https://github.com/sweepai/sweep/edit/sweep/allow_sweepyaml_to_be_read_from_the_user/sweepai/config/client.py#L166-L176) - [X] Running GitHub Actions for `sweepai/config/client.py` ✓ [Edit](https://github.com/sweepai/sweep/edit/sweep/allow_sweepyaml_to_be_read_from_the_user/sweepai/config/client.py#L166-L176) - [X] Modify `sweepai/config/client.py` ✓ https://github.com/sweepai/sweep/commit/586ea4a559661ae44b93a1496dc7347d197e7fc8 [Edit](https://github.com/sweepai/sweep/edit/sweep/allow_sweepyaml_to_be_read_from_the_user/sweepai/config/client.py#L179-L192) - [X] Running GitHub Actions for `sweepai/config/client.py` ✓ [Edit](https://github.com/sweepai/sweep/edit/sweep/allow_sweepyaml_to_be_read_from_the_user/sweepai/config/client.py#L179-L192)