Skip to content

Commit

Permalink
Merge main into sweep/add-github-actions-workflow_2
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-nightly[bot] authored Oct 23, 2023
2 parents 5177ed8 + aef8e95 commit 9d26297
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
10 changes: 2 additions & 8 deletions sweepai/core/sweep_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,6 @@ def check_sandbox(
content=content,
changed_files=changed_files,
)
logger.print(output)
sandbox_execution = SandboxResponse(**output)
if output["success"]:
content = output["updated_content"]
Expand Down Expand Up @@ -993,7 +992,7 @@ def modify_file(
raise SystemExit
except UnneededEditError as e:
if chunking:
return contents, "", None, changed_files
return contents, f"feat: Updated {file_change_request.filename}", None, changed_files
raise e
except Exception as e:
raise e
Expand All @@ -1009,11 +1008,7 @@ def modify_file(
self.delete_messages_from_chat(key)
raise e
try:
commit_message_match = None
if commit_message_match:
commit_message = commit_message_match.group("commit_message")
else:
commit_message = f"feat: Updated {file_change_request.filename}"
commit_message = f"feat: Updated {file_change_request.filename}"
commit_message = commit_message[: min(len(commit_message), 50)]
changed_files.append(
(
Expand Down Expand Up @@ -1555,7 +1550,6 @@ def get_new_file(temperature: float = 0.0):
"No changes made to file.",
changed_files,
)

try:
result = self.repo.update_file(
file_name,
Expand Down
8 changes: 4 additions & 4 deletions sweepai/core/update_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<snippets_and_plan_analysis file="file_path">
Describe what should be changed to the snippets from the old_file to complete the request.
Then, for each snippet in a list, determine whether changes should be made. If so, describe the changes needed, with references to the lines that should be changed and what to change it to. Otherwise, do not write an updated_snippet block for this snippet.
Then, for each snippet in a list, determine whether changes should be made. If so, describe the changes needed, with references to the lines that should be changed and what to change it to.
Maximize information density.
</snippets_and_plan_analysis>
Expand Down Expand Up @@ -41,7 +41,7 @@
<snippets_and_plan_analysis file="file_path">
Describe what should be changed to the snippets from the old_file to complete the request.
Then, for each snippet in a list, determine whether changes should be made. If so, describe the changes needed, with references to the lines that should be changed and what to change it to. Otherwise, do not write an updated_snippet block for this snippet.
Then, for each snippet in a list, determine whether changes should be made. If so, describe the changes needed, with references to the lines that should be changed and what to change it to.
Maximize information density.
</snippets_and_plan_analysis>
Expand Down Expand Up @@ -88,7 +88,7 @@
<snippets_and_plan_analysis file="file_path">
Describe what should be changed to the snippets from the old_file to complete the request.
Then, for each snippet in a list, determine whether changes should be made. If so, describe the changes needed, with references to the lines that should be changed and what to change it to. Otherwise, do not write an updated_snippet block for this snippet.
Then, for each snippet in a list, determine whether changes should be made. If so, describe the changes needed, with references to the lines that should be changed and what to change it to.
Maximize information density.
</snippets_and_plan_analysis>
Expand Down Expand Up @@ -134,7 +134,7 @@
Respond in the following format:
<snippets_and_plan_analysis file="file_path">
For each snippet in a list, determine whether changes should be made. If so, describe the changes needed. Otherwise, do not write an updated_snippet block for this snippet.
For each snippet in a list, determine whether changes should be made. If so, describe the changes needed.
</snippets_and_plan_analysis>
<diffs>
Expand Down
4 changes: 2 additions & 2 deletions sweepai/utils/github_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ class ClonedRepo:

@cached_property
def cache_dir(self):
random_bytes = os.urandom(16)
hash_obj = hashlib.sha256(random_bytes)
curr_time_str = str(time.time()).encode("utf-8")
hash_obj = hashlib.sha256(curr_time_str)
hash_hex = hash_obj.hexdigest()
if self.branch:
return os.path.join(
Expand Down
25 changes: 16 additions & 9 deletions tests/rerun_issue_direct.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,24 @@ def test_issue_url(
issue_request = fetch_issue_request(issue_url)
print(f"Sending request...")

request_process = multiprocessing.Process(
target=send_request, args=(issue_request,)
)
request_process.start()
if debug:
client = TestClient(app)
response = client.post(
"/", json=issue_request.dict(), headers={"X-GitHub-Event": "issues"}
)
print(response)
else:
request_process = multiprocessing.Process(
target=send_request, args=(issue_request,)
)
request_process.start()

request_process.join(timeout=None if debug else 150)
request_process.join(timeout=150)

if request_process.is_alive():
print("Terminating the process...")
request_process.terminate()
request_process.join() # Ensure process has terminated before proceeding
if request_process.is_alive():
print("Terminating the process...")
request_process.terminate()
request_process.join() # Ensure process has terminated before proceeding

better_stack_link = f"{better_stack_prefix}{html.escape(issue_url)}"
print(f"Track the logs at the following link:\n\n{better_stack_link}")
Expand Down

0 comments on commit 9d26297

Please sign in to comment.