fix(discord): only send turn limit warning from participating bot#728
Conversation
Before this fix, when multiple bots shared a channel and the bot turn soft limit was reached, every bot instance sent its own warning message into the thread — even bots that never participated. This caused duplicate warnings and pulled uninvolved bots into the thread. Now the WarnAndStop path calls bot_participated_in_thread() before sending the warning, so only the bot that actually replied in the thread will post the limit message. Closes openabdev#727
OpenAB PR ScreeningThis is auto-generated by the OpenAB project-screening flow for context collection and reviewer handoff.
Screening report## IntentPR #728 tries to stop duplicate Discord turn-limit warnings when multiple OpenAB bot instances share the same channel. The user-visible problem is that every bot instance currently posts FeatThis is a Discord bug fix. Behavioral change: when the Discord turn-limit handler reaches the Who It ServesPrimary beneficiaries:
Rewritten PromptFix Discord turn-limit warning fan-out when multiple bot instances observe the same channel. In Add or update focused tests if the Discord handler has test coverage for turn-limit behavior. Verify that participating bots still warn once, while non-participating bots do not post anything. Merge PitchThis is a small, targeted fix for a real multi-bot Discord deployment issue. It reduces user-facing noise without changing normal single-bot behavior. Risk profile is low: the change is scoped to the warning path and reuses an existing helper already used elsewhere in the same file. The main reviewer concern is likely whether suppressing the warning on API failure is acceptable. Given the helper already fails closed and this path is specifically about avoiding uninvolved bot chatter, that default is reasonable. Best-Practice ComparisonRelevant OpenClaw principles:
Relevant Hermes Agent principles:
Overall, the PR aligns with the shared best-practice theme of explicit ownership before side effects. Implementation OptionsOption 1: Conservative participation gate Option 2: Balanced ownership helper Option 3: Ambitious per-thread bot ownership model Comparison Table
RecommendationAdvance the conservative participation gate, preferably with a tiny helper or test only if it fits the existing code structure cleanly. This PR addresses a concrete Discord bug with minimal blast radius and follows the right ownership principle: only the bot that participated should produce conversation-visible side effects. A broader thread ownership model may be useful later, but it should be split into a separate design item rather than blocking this targeted fix. |
Co-reviewed-by: VISION
This comment has been minimized.
This comment has been minimized.
|
LGTM ✅ — Four-monk unanimous approval. Clean, minimal fix for a real multi-bot deployment issue. Consolidated Review (超渡 × 普渡 × 擺渡 × 覺渡)1. What problem does this solve?Issue #727: when multiple bot instances share a channel, ALL instances send the 2. How does it solve it?One surgical change in 3. What was considered?
4. Is this the best approach?Yes. The existing Traffic Light🟢 INFO — Excellent use of existing infrastructure. No new methods, no new state, no new dependencies. 🟢 INFO — Comment referencing #727 is helpful for future readers. 🟢 INFO — Prevents the secondary cascade: uninvolved bots posting warnings → becoming "involved" → responding to subsequent human messages. |
chaodu-agent
left a comment
There was a problem hiding this comment.
Four-monk unanimous LGTM. Clean fix, reuses existing helper, fail-closed safe default.
🟢 LGTM — Clean, minimal, correctVerdict: Approve-ready. Single-purpose fix that reuses existing infrastructure with zero new concepts. Four-Question Review1. What problem does this solve? 2. How does it solve it? 3. What was considered?
4. Is this the best approach? Traffic Light
NIT (non-blocking)No new tests added. However, Review by 超渡法師 🔮 — 四問框架 applied, baseline verified against main |
…enabdev#728) * fix(discord): only send turn limit warning from participating bot Before this fix, when multiple bots shared a channel and the bot turn soft limit was reached, every bot instance sent its own warning message into the thread — even bots that never participated. This caused duplicate warnings and pulled uninvolved bots into the thread. Now the WarnAndStop path calls bot_participated_in_thread() before sending the warning, so only the bot that actually replied in the thread will post the limit message. Closes openabdev#727 * fix(discord): annotate ignored is_multibot return value Co-reviewed-by: VISION --------- Co-authored-by: JARVIS-coding-Agent <jarvis-coding-agent@users.noreply.github.com>
Context
When multiple bot instances share a channel, the bot turn limit warning (
⚠️ Bot turn limit reached) is sent by every instance — not just the one that actually participated in the thread. This spams the thread with duplicate warnings and pulls uninvolved bots into the conversation.Closes #727
Summary
Gate the turn limit warning behind a
bot_participated_in_thread()check so only the bot that actually replied in the thread sends the warning message.Changes
bot_participated_in_thread()call in theWarnAndStoppath before sending the warning messageNotes
bot_participated_in_thread()is fail-closed: on API error it returns(false, false), so the warning is suppressed rather than sent — safe defaultWarnAndStoppath (at most once per soft/hard limit per thread), so performance impact is negligibleDiscord Discussion URL: https://discord.com/channels/1395707092077248593/1395707093364768850/1500805519630274701