Skip to content

Commit

Permalink
Merge pull request #660 from Codium-ai/ok/add_command_to_log
Browse files Browse the repository at this point in the history
Add logging context to command execution in pr_agent.py
  • Loading branch information
okotek authored Feb 15, 2024
2 parents bd88c66 + 433b8d2 commit 4947c6b
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions pr_agent/agent/pr_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,21 @@ async def handle_request(self, pr_url, request, notify=None) -> bool:
args = update_settings_from_args(args)

action = action.lstrip("/").lower()
if action == "reflect_and_review":
get_settings().pr_reviewer.ask_and_reflect = True
if action == "answer":
if notify:
notify()
await PRReviewer(pr_url, is_answer=True, args=args, ai_handler=self.ai_handler).run()
elif action == "auto_review":
await PRReviewer(pr_url, is_auto=True, args=args, ai_handler=self.ai_handler).run()
elif action in command2class:
if notify:
notify()

await command2class[action](pr_url, ai_handler=self.ai_handler, args=args).run()
else:
return False
return True
with get_logger().contextualize(command=action):
if action == "reflect_and_review":
get_settings().pr_reviewer.ask_and_reflect = True
if action == "answer":
if notify:
notify()
await PRReviewer(pr_url, is_answer=True, args=args, ai_handler=self.ai_handler).run()
elif action == "auto_review":
await PRReviewer(pr_url, is_auto=True, args=args, ai_handler=self.ai_handler).run()
elif action in command2class:
if notify:
notify()

await command2class[action](pr_url, ai_handler=self.ai_handler, args=args).run()
else:
return False
return True

0 comments on commit 4947c6b

Please sign in to comment.