fix(discord): track handoff-created threads for replies - #90348
fix(discord): track handoff-created threads for replies#90348ryanlatham wants to merge 2 commits into
Conversation
Reviewed by reviewer-e (AI automated review). Correct root-cause fix: a handoff thread the bot itself created was invisible to the thread registry, so follow-up replies inside it were gated by channel-level mention policy and silently dropped under REQUIRE_MENTION. The try/except/else restructure puts
|
|
Thanks — both findings are addressed in follow-up commit
Verification on current-main integration:
The direct thread still required its link to locate. Discoverability and Discord public/private-thread behavior remain unchanged and intentionally separate from this PR. |
What does this PR do?
DiscordAdapter.create_handoff_thread()did not register successfully created Discord threads in the existingThreadParticipationTracker.With
require_mention=trueandthread_require_mention=false, the first ordinary, unmentioned message in a handoff-created thread could therefore be rejected. This change records both direct-created and seed-fallback-created threads before returning them.Thread creation remains authoritative over bookkeeping: if participation-tracker persistence fails after Discord creates the thread, Hermes logs a warning (including the thread ID, traceback, and restart-durability consequence) and still returns the real thread ID. It does not report a false creation failure or attempt a duplicate fallback thread.
Failed and unsupported creation attempts remain untracked. No configuration change is required.
Related Issue
Related PR: #63459
Based on work by @SEStarkman in #63459, especially commit 9d269402d5. This PR ports the tracking behavior onto current main's direct-first/fallback implementation.
It intentionally does not change creation order, stale-seed cleanup, Discord public/private thread behavior, or thread discoverability. Those broader changes remain separate.
Type of Change
Changes Made
plugins/platforms/discord/adapter.pytests/gateway/test_discord_send.py_save()failure and verify the in-memory mark remains usable.tests/e2e/test_discord_adapter.pyHow to Test
scripts/run_tests.sh tests/gateway/test_discord_send.py tests/e2e/test_discord_adapter.py -q scripts/run_tests.sh tests/gateway tests/e2e/test_discord_adapter.py -q scripts/run_tests.sh ruff check . python scripts/check-windows-footguns.py --all git diff --check upstream/main...HEAD python3 scripts/audit_pr_attribution.pyAutomated evidence:
8fcbb1374fbd68b7340bfa0b0c44cfade98a0bfd.13f4cfebfafbce8ac9d1bf29f66731858ed638b5.6a46804520d589656972812e750ca88f10bd2851.05243f87a727a7bedd3c072865c6f7cb801fdc1c; it has the two SHAs above as parents and the same tree as the tested local integration.ruff check .: passed (with two pre-existing invalid-noqawarnings).git diff --check: passed.Manual Discord evidence:
require_mention=trueandthread_require_mention=false, the first message sent in the handoff-created thread—without a mention and without replying to the bot—received a response and correctly recalledBLUE-COMET-90348.Checklist
Code
Documentation & Housekeeping
Screenshots / Logs
Not applicable. Automated regressions and a live Discord test are summarized above.