Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 24, 2026

When adding a repository for the first time, the plugin floods the chat with all historical commits, issues, PRs, and releases because last_processed timestamps are missing. The notification logic compares item timestamps against None, treating everything as new.

Changes

  • Added initialize_repo_timestamps() in repo_activity_new.py

    • Fetches latest items from all endpoints (commits, issues, PRs, releases)
    • Records timestamps in last_processed table
    • Initializes issue/PR and comment ID tracking to prevent comment flooding
    • Uses current time as fallback on fetch failures or empty repositories
    • Skips initialization if timestamps already exist
  • Modified add_repo() command in commands.py

    • Calls initialize_repo_timestamps() after validating and adding repository
    • Ensures only items created after repository addition trigger notifications

Result

# Before: Adding repo triggers notifications for all 100+ historical items
await add_repo(bot, event, "/repo.add owner/repo")
# → Floods chat with all historical activity

# After: Only new items created post-addition trigger notifications  
await add_repo(bot, event, "/repo.add owner/repo")
# → Silent initialization, then tracks only new activity

Database structure:

  • last_processed table: stores latest timestamp per repo/data_type
  • issues/prs tables: tracks latest issue/PR ID (id=0) and latest comment ID (id=issue_id)
Original prompt

This section details on the original issue you should resolve

<issue_title>第一次添加仓库时会推送大量消息</issue_title>
<issue_description>第一次添加仓库时插件会推送大量历史的提交/issue等信息。希望在没有历史仓库信息的时候能够静默查询,防止刷屏。</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 24, 2026 13:13
Co-authored-by: HTony03 <80151962+HTony03@users.noreply.github.com>
Co-authored-by: HTony03 <80151962+HTony03@users.noreply.github.com>
Co-authored-by: HTony03 <80151962+HTony03@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix excessive message push during first repository addition Initialize repository timestamps on first add to prevent message flooding Jan 24, 2026
Copilot AI requested a review from HTony03 January 24, 2026 13:18
@HTony03 HTony03 marked this pull request as ready for review January 25, 2026 07:39
@HTony03 HTony03 merged commit 8a55515 into main Jan 25, 2026
13 checks passed
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