AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

feat(backend): baseline summary processing

Open ntindle opened this issue 9 months ago β€’ 9 comments

We want to be able to process emails on a scheduled basis for summaries. This adds the baselines for that

Changes πŸ—οΈ

  • Adds new tooling to Scheduluer to handle the in-memory schedule for the weekly processing
  • Adds new exposes to notification manager to handle the different data models for scheduled emails
  • adds new models to the notification data models to handle the different requirements for scheduled emails, closely paralleling the existing notification ones
  • Adds new email template

Note: After testing, email sending was disabled until the template and data filling are done later down the line. We don't want to email people random stuff, ya know?

Checklist πŸ“‹

For code changes:

  • [x] I have clearly listed my changes in the PR description
  • [x] I have made a test plan
  • [x] I have tested my changes according to the test plan:
    • [x] Test sending an email on the scheduled basis
    • [x] Make sure you get the email, ignoring the fact that all the data isn't real inside it

ntindle avatar Mar 07 '25 05:03 ntindle

The PR generally follows the requirements but has some issues: 1) The PR title has a scope (backend) and follows conventional commit format. 2) Changes are documented and explained. 3) The code changes involve handling user_id appropriately in the notification systems. 4) The test plan is included though basic. However, the checklist items are not marked as completed which is a requirement, even though we're being lenient about checklist completeness.

AutoGPT-Agent avatar Mar 07 '25 05:03 AutoGPT-Agent

Here's the code health analysis summary for commits f37d4c2..0f16ba3. View details on DeepSourceΒ β†—.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScriptβœ…Β SuccessView CheckΒ β†—
DeepSource Python LogoPythonβœ…Β Success
❗ 67 occurences introduced
🎯 23 occurences resolved
View CheckΒ β†—

πŸ’‘ If you’re a repository administrator, you can configure the quality gates from the settings.

deepsource-io[bot] avatar Mar 07 '25 05:03 deepsource-io[bot]

PR Reviewer Guide πŸ”

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 πŸ”΅πŸ”΅πŸ”΅βšͺβšͺ
πŸ§ͺΒ No relevant tests
πŸ”’Β No security concerns identified
⚑ Recommended focus areas for review

Commented Code

The weekly summary scheduler is commented out, which means the feature won't actually run on a schedule. This contradicts the PR description which states this adds scheduled queue processing.

# get_scheduler().add_weekly_notification_schedule(
#     # weekly on Friday at 12pm
#     cron="0 12 * * 5",
# )
Mock Data

The _gather_summary_data method uses hardcoded mock data instead of actual data retrieval. The commented-out code suggests real implementations should be used but aren't completed.

total_credits_used = 3.0
total_executions = 2
most_used_agent = {"name": "Some"}
execution_times = [1, 2, 3]
runs = [{"status": "COMPLETED"}, {"status": "FAILED"}]

successful_runs = len([run for run in runs if run["status"] == "COMPLETED"])
failed_runs = len([run for run in runs if run["status"] != "COMPLETED"])
average_execution_time = (
    sum(execution_times) / len(execution_times) if execution_times else 0
)
# cost_breakdown = self.run_and_wait(
#     get_cost_breakdown(user_id, start_time, end_time)
# )

cost_breakdown = {
    "agent1": 1.0,
    "agent2": 2.0,
}
Queue Name Mismatch

The code tries to get a queue named "summary_notifications" but the queue defined in create_notification_config is named "weekly_summary_notifications", which will cause runtime errors.

summary_queue = self.run_and_wait(channel.get_queue("summary_notifications"))

qodo-code-review[bot] avatar Mar 07 '25 06:03 qodo-code-review[bot]

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

github-actions[bot] avatar Mar 07 '25 21:03 github-actions[bot]

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

github-actions[bot] avatar Mar 07 '25 21:03 github-actions[bot]

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

github-actions[bot] avatar Mar 10 '25 17:03 github-actions[bot]

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

github-actions[bot] avatar Mar 10 '25 20:03 github-actions[bot]

Deploy Preview for auto-gpt-docs-dev canceled.

Name Link
Latest commit 0f16ba35f6b926a1d96bb268c983b96ce2a3452f
Latest deploy log https://app.netlify.com/sites/auto-gpt-docs-dev/deploys/67d1131932cb1800088ec6ad

netlify[bot] avatar Mar 10 '25 20:03 netlify[bot]

Deploy Preview for auto-gpt-docs canceled.

Name Link
Latest commit 0f16ba35f6b926a1d96bb268c983b96ce2a3452f
Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/67d11319864c460008210e0b

netlify[bot] avatar Mar 10 '25 20:03 netlify[bot]