|
8 | 8 | from helpers.Agent import Agent
|
9 | 9 | from helpers.files import get_file_contents
|
10 | 10 | from const.function_calls import GET_FILE_TO_MODIFY, REVIEW_CHANGES
|
| 11 | +from logger.logger import logger |
11 | 12 |
|
12 | 13 | from utils.exit import trace_code_event
|
13 | 14 | from utils.telemetry import telemetry
|
@@ -268,17 +269,27 @@ def review_change(
|
268 | 269 |
|
269 | 270 | if len(hunks_to_apply) == len(hunks):
|
270 | 271 | print("Applying entire change")
|
| 272 | + logger.info(f"Applying entire change to {file_name}") |
271 | 273 | return new_content, None
|
| 274 | + |
272 | 275 | elif len(hunks_to_apply) == 0:
|
273 |
| - print(f"Rejecting entire change with reason: {llm_response['review_notes']}") |
274 |
| - # If everything can be safely ignoring, it's probably because the files already implement the changes |
275 |
| - # from previous tasks (which can happen often). Insisting on a change here is likely to cause problems. |
276 |
| - return old_content, None |
| 276 | + if hunks_to_rework: |
| 277 | + print(f"Requesting rework for {len(hunks_to_rework)} changes with reason: {llm_response['review_notes']}") |
| 278 | + logger.info(f"Requesting rework for {len(hunks_to_rework)} changes to {file_name} (0 hunks to apply)") |
| 279 | + return old_content, review_log |
| 280 | + else: |
| 281 | + # If everything can be safely ignored, it's probably because the files already implement the changes |
| 282 | + # from previous tasks (which can happen often). Insisting on a change here is likely to cause problems. |
| 283 | + print(f"Rejecting entire change with reason: {llm_response['review_notes']}") |
| 284 | + logger.info(f"Rejecting entire change to {file_name} with reason: {llm_response['review_notes']}") |
| 285 | + return old_content, None |
277 | 286 |
|
278 | 287 | print("Applying code change:\n" + diff_log)
|
| 288 | + logger.info(f"Applying code change to {file_name}:\n{diff_log}") |
279 | 289 | new_content = self.apply_diff(file_name, old_content, hunks_to_apply, new_content)
|
280 | 290 | if hunks_to_rework:
|
281 | 291 | print(f"Requesting rework for {len(hunks_to_rework)} changes with reason: {llm_response['review_notes']}")
|
| 292 | + logger.info(f"Requesting further rework for {len(hunks_to_rework)} changes to {file_name}") |
282 | 293 | return new_content, review_log
|
283 | 294 | else:
|
284 | 295 | return new_content, None
|
|
0 commit comments