sweepai / sweep

Sweep: open-source AI-powered Software Developer for small features and bug fixes.
https://sweep.dev
Other
7.45k stars 427 forks source link

Sweep: Use traceback for logging exceptions in `change_files_in_github_iterator` function in `sweepai/agents/graph_child.py` #1769

Open sweep-nightly[bot] opened 1 year ago

sweep-nightly[bot] commented 1 year ago

In the sweepai/agents/graph_child.py file, the change_files_in_github_iterator function catches exceptions and logs them without using traceback. This is against the user's rules which require all error logs to use traceback during exceptions.

To fix this issue, please update the exception handling in the change_files_in_github_iterator function to use traceback when logging exceptions. This will provide more detailed error information in the logs, which can be helpful for debugging.

Here is an example of how you can update the code:

except Exception as e:
    logger.error(f"Error in change_files_in_github_iterator {e}")
    logger.error(traceback.format_exc())  # Add this line
Checklist - [X] `sweepai/agents/graph_child.py` ✅ Commit [`0d1e103`](https://github.com/sweepai/sweep/commit/0d1e1034c605272c4ac89bbde8273c3a2615ed00)
• Find the `change_files_in_github_iterator` function in the file. • Within this function, locate the `except Exception as e:` block. • In this exception block, after the line `logger.error(f"Error in change_files_in_github_iterator {e}")`, add the following line of code: `logger.error(traceback.format_exc())`.
sweep-nightly[bot] commented 1 year ago

Here's the PR! https://github.com/sweepai/sweep/pull/1770.

💎 Sweep Pro: I'm creating this ticket using GPT-4. You have unlimited GPT-4 tickets.

Actions (click)


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description.

I also found some related docs:


Step 2: ⌨️ Coding


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/add-traceback-logging.

.


🎉 Latest improvements to Sweep:


💡 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