Repository navigation
fix(discord-bridge): pop reply-anchor INTO a var before downstream read - #1003
Merged
Merged
Conversation
…tream Live-test caught: PR #1002's auto-thread never fired because the result-send loop popped pending_reply_anchors[task_id] immediately after pending_replies pop, then ~50 lines later tried to .get(task_id) — which returned None because the pop already removed it. Capture the anchor into `source_message_anchor` at pop time; reference that local in the auto-thread conditional. Unit test still green (covers the "explicit [reply: <id>] directive present" + "no directive, no reference" cases — the latter passes because pending_reply_anchors is also empty in the test fixture, which is why the unit test missed the bug). Symptom: reply went as a fresh channel message instead of a quote-reply threaded to the triggering msg. Caught 2026-05-22 ~03:00 UTC by Chi ("it's not a quote reply") on the first live verification round of #1002. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
liususan091219
pushed a commit
to liususan091219/sutando-fork
that referenced
this pull request
May 28, 2026
…tream (sonichi#1003) Live-test caught: PR sonichi#1002's auto-thread never fired because the result-send loop popped pending_reply_anchors[task_id] immediately after pending_replies pop, then ~50 lines later tried to .get(task_id) — which returned None because the pop already removed it. Capture the anchor into `source_message_anchor` at pop time; reference that local in the auto-thread conditional. Unit test still green (covers the "explicit [reply: <id>] directive present" + "no directive, no reference" cases — the latter passes because pending_reply_anchors is also empty in the test fixture, which is why the unit test missed the bug). Symptom: reply went as a fresh channel message instead of a quote-reply threaded to the triggering msg. Caught 2026-05-22 ~03:00 UTC by Chi ("it's not a quote reply") on the first live verification round of sonichi#1002. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
PR #1002 added auto-thread of replies to the triggering message via
pending_reply_anchors. Live-tested 2026-05-22 ~03:00 UTC: replies still appeared as fresh messages, not quote-replies. Chi: "it's not a quote reply".Root cause
In
poll_results, the anchor was popped immediately after the channel pop:Fix
Capture into a local:
Why the unit test missed it
tests/discord-bridge-reply-directive.test.pyexercises two paths: explicit[reply: <id>]directive (passes) and no-directive (passes). The no-directive case passed coincidentally because the test fixture never populatespending_reply_anchorsfor that task_id — so the buggy.get()returned None, and the test asserted "no reference set". The bug + the test gap canceled out.Test plan
python3 tests/discord-bridge-reply-directive.test.py(all 3 cases pass)pending_reply_anchors[task_id]and asserting the reference WAS set, to prevent future regressions🤖 Generated with Claude Code