AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Replace deprecated event hooks with lifecycle handler

Open vishesh10 opened this issue 1 year ago โ€ข 7 comments

User description

Background

This PR replaces the deprecated @app.on_event hooks with lifecycle handler. Addresses https://github.com/Significant-Gravitas/AutoGPT/issues/7947

Changes ๐Ÿ—๏ธ

  • Updated the ws_api.py file to have lifecycle handlers instead of on_event hooks.

PR Quality Scorecard โœจ

  • [x] Have you used the PR description template? โ€‚ +2 pts
  • [x] Is your pull request atomic, focusing on a single change? โ€‚ +5 pts
  • [x] Have you linked the GitHub issue(s) that this PR addresses? โ€‚ +5 pts
  • [x] Have you documented your changes clearly and comprehensively? โ€‚ +5 pts
  • [ ] Have you changed or added a feature? โ€‚ -4 pts
    • [ ] Have you added/updated corresponding documentation? โ€‚ +4 pts
    • [ ] Have you added/updated corresponding integration tests? โ€‚ +5 pts
  • [ ] Have you changed the behavior of AutoGPT? โ€‚ -5 pts
    • [ ] Have you also run agbenchmark to verify that these changes do not regress performance? โ€‚ +10 pts

vishesh10 avatar Sep 18 '24 15:09 vishesh10

PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

PR Reviewer Guide ๐Ÿ”

โฑ๏ธย Estimated effort to review: 2 ๐Ÿ”ต๐Ÿ”ตโšชโšชโšช
๐Ÿงชย No relevant tests
๐Ÿ”’ย No security concerns identified
โšกย Key issues to review

Potential Race Condition
The lifespan function creates an asyncio task for event_broadcaster, but doesn't ensure it's properly cancelled on shutdown. This could lead to a race condition or resource leaks.

qodo-merge-pro[bot] avatar Sep 18 '24 15:09 qodo-merge-pro[bot]

Deploy Preview for auto-gpt-docs canceled.

Name Link
Latest commit 9671863dbd7f6e4fa0fb0f6dbeac10c7af00b4cf
Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/66fd5525475eb80008e09945

netlify[bot] avatar Sep 18 '24 15:09 netlify[bot]

Thanks for your contribution - can you please run the linter?

aarushik93 avatar Sep 18 '24 16:09 aarushik93

To run the linter you do:

poetry format in autogpt_sever folder

Swiftyos avatar Sep 19 '24 06:09 Swiftyos

Thanks for considering this PR @aarushik93 @Swiftyos. The same is done.

vishesh10 avatar Sep 19 '24 16:09 vishesh10

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

github-actions[bot] avatar Sep 20 '24 14:09 github-actions[bot]

@vishesh10 there has been some directory restructuring on this repo, this PR is valuable, would you mind resolving the conflict on this? :)

majdyz avatar Sep 27 '24 20:09 majdyz

Conflicts have been resolved! ๐ŸŽ‰ A maintainer will review the pull request shortly.

github-actions[bot] avatar Oct 01 '24 06:10 github-actions[bot]

@vishesh10 there has been some directory restructuring on this repo, this PR is valuable, would you mind resolving the conflict on this? :)

Hi @majdyz, The same is done. Thanks

vishesh10 avatar Oct 01 '24 07:10 vishesh10