From 1e91d1c86bd8bbb2af3e12cac48d713dcb1202ee Mon Sep 17 00:00:00 2001 From: "sweep-nightly[bot]" <131841235+sweep-nightly[bot]@users.noreply.github.com> Date: Tue, 30 Apr 2024 01:57:51 +0000 Subject: [PATCH] feat: Updated 2 files --- sweep.yaml | 14 -------------- sweepai/core/context_pruning.py | 4 +++- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/sweep.yaml b/sweep.yaml index 56c91ab5a3..e69de29bb2 100644 --- a/sweep.yaml +++ b/sweep.yaml @@ -1,14 +0,0 @@ -gha_enabled: True -branch: main -blocked_dirs: ["tests"] -draft: False -description: "sweepai/sweep is a python 3.10 project. The main api endpoints are in sweepai/api.py. All imports should be global (like `import sweepai.utils.github_utils`). Write unit tests in the same directory as their corresponding code, i.e. sweepai/api_test.py tests sweepai/api.py. We use pytest for tests. Never use wildcard imports. Use list and tuple for typing instead of typing.List and typing.Tuple." - -rules: - - "We should use loguru for error logging. If the log is inside an exception, use logger.exception to add tracebacks, where logger is imported from loguru. Use f-strings for string formatting in logger calls (e.g. logger.info(f'Hello {name}') instead of logger.info('Hello {name}', name=name))." - - "There should be no debug log or print statements in production code." - - "All functions should have parameters and output annotated with type hints. Use list, tuple and dict instead of typing.List, typing.Tuple and typing.dict." - - "Leftover TODOs in the code should be handled." - - "All new business logic should have corresponding unit tests in the same directory. For example, sweepai/api_test.py tests sweepai/api.py. Use unittest and unittest.mock as required." - - "Any clearly inefficient or repeated code should be optimized or refactored." - - "Remove any comments before code that are obvious. For example `# this prints hello world; print('hello world')`." diff --git a/sweepai/core/context_pruning.py b/sweepai/core/context_pruning.py index 51fd390226..154714ba6f 100644 --- a/sweepai/core/context_pruning.py +++ b/sweepai/core/context_pruning.py @@ -679,7 +679,9 @@ def get_relevant_context( ) except openai.BadRequestError as e: # sometimes means that run has expired logger.exception(e) - repo_context_manager.current_top_snippets.extend(old_relevant_snippets) + except Exception as e: + logger.exception(e) + repo_context_manager.current_top_snippets.extend(old_relevant_snippets) repo_context_manager.read_only_snippets.extend(old_read_only_snippets) return repo_context_manager except Exception as e: