Skip to content

fix(discord): reuse existing auto-thread on create race - #48685

Closed
jeeves-assistant wants to merge 3 commits into
NousResearch:mainfrom
jeeves-assistant:fix/discord-existing-thread-race
Closed

fix(discord): reuse existing auto-thread on create race#48685
jeeves-assistant wants to merge 3 commits into
NousResearch:mainfrom
jeeves-assistant:fix/discord-existing-thread-race

Conversation

@jeeves-assistant

@jeeves-assistant jeeves-assistant commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Reuse an existing Discord starter-message thread when message.create_thread() loses a race to another bot/client.
  • Avoid posting the fallback “Thread created by Hermes” seed message when the original message already has a thread.
  • Add regression coverage for both message.thread and starter-message-id lookup paths.
  • Refresh the branch against current main with a normal merge commit and add the release attribution mapping for this PR author.

Verification

  • python3 -m py_compile scripts/release.py
  • PYTHONPATH="$PWD" ~/.hermes/hermes-agent/venv/bin/python -m py_compile plugins/platforms/discord/adapter.py tests/gateway/test_discord_channel_controls.py tests/gateway/test_discord_slash_commands.py scripts/release.py
  • env -u DISCORD_ALLOWED_CHANNELS -u DISCORD_REQUIRE_MENTION -u DISCORD_FREE_RESPONSE_CHANNELS -u DISCORD_IGNORED_CHANNELS -u DISCORD_NO_THREAD_CHANNELS PYTHONPATH="$PWD" ~/.hermes/hermes-agent/venv/bin/python -m pytest tests/gateway/test_discord_channel_controls.py tests/gateway/test_discord_slash_commands.py -q -k 'auto_create_thread or auto_thread' -o 'addopts='
  • git diff --check

Notes

This fixes the duplicate-thread class seen when multiple Discord bots share a channel and one creates a thread from the user’s starter message before another adapter handles the same message.

PR #48690 covered the same race and is being closed as the duplicate; this PR remains the artifact of record.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery platform/discord Discord bot adapter labels Jun 18, 2026
@jeeves-assistant

Copy link
Copy Markdown
Contributor Author

Closing this stale agent-authored PR per the approved cleanup matrix. Evidence: it is currently conflicted/dirty and touches bundled Hermes Discord adapter/release-attribution code. The duplicate-thread bug may still be valid, but resolving this PR would require forbidden core/plugin conflict work in this lane.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/discord Discord bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants