Skip to content

fix(gateway): preserve newest thread participation entries#13639

Closed
hharry11 wants to merge 1 commit into
NousResearch:mainfrom
hharry11:fix/discord-thread-cache-ordering
Closed

fix(gateway): preserve newest thread participation entries#13639
hharry11 wants to merge 1 commit into
NousResearch:mainfrom
hharry11:fix/discord-thread-cache-ordering

Conversation

@hharry11
Copy link
Copy Markdown
Contributor

Summary

  • Preserve insertion order in ThreadParticipationTracker instead of storing participated threads in an unordered set.
  • Ensure capped thread state evicts the oldest entries and keeps newly joined threads after restart.
  • Add regression coverage for full persisted thread state.

Why

Discord/Matrix thread participation state is capped, but converting persisted JSON to a set made eviction order nondeterministic. A newly participated thread could be dropped from the saved state, causing follow-up messages after gateway restart to require a mention again.

Test

  • uv run --extra dev python -m pytest tests/gateway/test_discord_thread_persistence.py -q -n 4

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery platform/discord Discord bot adapter labels Apr 21, 2026
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 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