Skip to content

fix: prevent proactive replies during explicit mentions#9

Open
SebastianBoehler wants to merge 1 commit into
mainfrom
fix/proactive-mention-overlap
Open

fix: prevent proactive replies during explicit mentions#9
SebastianBoehler wants to merge 1 commit into
mainfrom
fix/proactive-mention-overlap

Conversation

@SebastianBoehler

@SebastianBoehler SebastianBoehler commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes the likely duplicate-response path from Discord proactive monitoring overlapping with an explicit bot mention.

Changes:

  • Expose a StudyBot.has_active_mention_task(channel_id) helper for runtime coordination.
  • Make ProactiveMonitor skip channels that currently have active mention work.
  • Make ProactiveMonitor skip latest human messages that mention the bot, marking them processed so proactive checks do not respond after the mention run finishes.
  • Add focused proactive monitor tests for both cases.

Why

The thread report points to proactive replies landing while an explicit mention-triggered Codex run is still working or later timing out. The previous safeguards only covered mention dispatch itself; proactive checks could still inspect the same mention message and produce a second response.

This PR prevents the proactive monitor from treating explicit bot mentions as proactive opportunities.

Verification

  • ruff check .
  • pyright
  • pytest

Notes

This addresses the proactive-overlap cause discussed in Discord. The broader cross-process durable idempotency idea in #8 may still be useful as a separate hardening step if multiple gateway instances are expected to consume the same Discord bot token.

Refs #8

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.

1 participant