You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prevents Events.GuildCreate from being emitted for guilds received as part
of the initial gateway guild stream when waitForGuilds is enabled.
Previously, existing guilds delivered through GUILD_CREATE after an empty READY.guilds payload were indistinguishable from newly joined guilds at the
event-emission layer, causing GuildCreate listeners to fire on every bot
restart.
Changes
Treat GUILD_CREATE events received during initial guild hydration as
startup state rather than new guild joins.
Reset the guild stream settle timer as initial guilds arrive.
Preserve GuildCreate for guilds actually joined after the client becomes
ready.
Add coverage for startup hydration and real guild joins.
Testing
Verified that:
Restarting a bot already in a guild does not emit GuildCreate.
Existing guilds are still hydrated correctly.
Removing and re-adding the bot emits GuildCreate.
Multiple startup guilds do not emit false join events.
Existing test suite passes.
Type of change
Bug fix
New feature
Breaking change
Documentation update
Checklist
My code follows the project's style guidelines (run pnpm run lint)
biome lint .
Checked 489 files in 96ms. No fixes applied.
I have run pnpm run build successfully
Tasks: 11 successful, 11 total
Cached: 11 cached, 11 total
Time: 47ms >>> FULL TURBO
I have run pnpm run test successfully
Tasks: 20 successful, 20 total
Cached: 9 cached, 20 total
Time: 3.934s
AI disclosure
Did you use AI (e.g. Cursor, Copilot, ChatGPT, Claude) to help write or review this PR?
No — I wrote this myself
Yes — AI assisted (briefly note how below)
Yes — AI wrote 60% or more of this code
Diagnosed the problematic code.
Guided me to the files that required the edits.
I updated the code myself after a brief idea was drafted.
This PR changes guild lifecycle handling to suppress GuildCreate for available snapshots explicitly marked with unavailable: false, while retaining GuildAvailable for recovered guilds and using a timeout to finish empty-READY hydration.
Removes readiness-state and known-membership classification introduced in the earlier revision.
Uses the gateway availability field to distinguish snapshots from ordinary guild creation.
Keeps a 500 ms fallback for an empty initial guild list, but no longer extends it as guilds arrive.
Adds a patch changeset for @fluxerjs/core.
Diagram
sequenceDiagram
participant GW as Gateway
participant C as Client
participant A as Application
GW->>C: READY (guilds: [])
C->>C: Start 500 ms timer
GW->>C: Existing GUILD_CREATE
C->>C: Hydrate guild (timer unchanged)
C->>A: Ready after original 500 ms
GW->>C: Remaining existing GUILD_CREATE
C->>C: Hydrate after Ready
Note over A,C: Ready may expose an incomplete guild cache
A new update has been pushed to fluxerapp/fluxer:main to return guild availability. I have rebased this PR back to :main branch and made a minor change that should completely fix the bug.
As a note for myself and future PR readers this is not the final form that will be implemented in the Client but I am crediting this user for getting the issue resolved on Fluxer's side.
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
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.
…teway hydration.
Description
Summary
Prevents
Events.GuildCreatefrom being emitted for guilds received as partof the initial gateway guild stream when
waitForGuildsis enabled.Previously, existing guilds delivered through
GUILD_CREATEafter an emptyREADY.guildspayload were indistinguishable from newly joined guilds at theevent-emission layer, causing
GuildCreatelisteners to fire on every botrestart.
Changes
GUILD_CREATEevents received during initial guild hydration asstartup state rather than new guild joins.
GuildCreatefor guilds actually joined after the client becomesready.
Testing
Verified that:
GuildCreate.GuildCreate.Type of change
Checklist
pnpm run lint)biome lint .
Checked 489 files in 96ms. No fixes applied.
pnpm run buildsuccessfullyTasks: 11 successful, 11 total
Cached: 11 cached, 11 total
Time: 47ms >>> FULL TURBO
pnpm run testsuccessfullyTasks: 20 successful, 20 total
Cached: 9 cached, 20 total
Time: 3.934s
AI disclosure
Did you use AI (e.g. Cursor, Copilot, ChatGPT, Claude) to help write or review this PR?
Diagnosed the problematic code.
Guided me to the files that required the edits.
I updated the code myself after a brief idea was drafted.