Skip to content

每日AI大佬推送#1

Draft
08183080 wants to merge 1 commit intomainfrom
cursor/ai-9779
Draft

每日AI大佬推送#1
08183080 wants to merge 1 commit intomainfrom
cursor/ai-9779

Conversation

@08183080
Copy link
Member

@08183080 08183080 commented Jan 17, 2026

Implement a daily X information flow to collect and email recent tweets from active AI leaders.


Open in Cursor Open in Web


Open with Devin

Co-authored-by: dragon123xyz1 <dragon123xyz1@gmail.com>
@cursor
Copy link

cursor bot commented Jan 17, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View issue and 5 additional flags in Devin Review.

Open in Devin Review

print("no recipients")
return
hours = int(os.getenv("ACTIVE_HOURS", "24"))
max_results = int(os.getenv("MAX_RESULTS", "10"))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Missing validation for MAX_RESULTS causes silent API failures

The Twitter API's get_users_tweets endpoint requires max_results to be between 5 and 100. The code reads this value from environment variable without validation.

Click to expand

How it happens

At test.py:124, the code reads MAX_RESULTS from environment:

max_results = int(os.getenv("MAX_RESULTS", "10"))

If a user sets MAX_RESULTS to a value less than 5 (e.g., MAX_RESULTS=3), the Twitter API will reject the request. The error is caught by the TweepyException handler at test.py:66-72, which returns {"tweets": [], "error": str(e)}.

At test.py:131, the code checks if data.get("tweets"): which is falsy for empty lists, so no users are included in items.

Impact

The email will be sent saying "无活跃AI大佬更新" (no active AI experts update) when in fact all API calls failed. Users receive a misleading email with no indication of the underlying error.

Recommendation: Add validation to ensure max_results is between 5 and 100: max_results = max(5, min(100, int(os.getenv("MAX_RESULTS", "10"))))

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants