Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sweep: Add tests for context agent #3648

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions sweep.yaml
Original file line number Diff line number Diff line change
@@ -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')`."
4 changes: 3 additions & 1 deletion sweepai/core/context_pruning.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading