Skip to content

fix(discord): force clean reconnect after resumed session#1239

Merged
Aaronontheweb merged 7 commits into
devfrom
fix/discord-reconnect-zombie
May 30, 2026
Merged

fix(discord): force clean reconnect after resumed session#1239
Aaronontheweb merged 7 commits into
devfrom
fix/discord-reconnect-zombie

Conversation

@Aaronontheweb
Copy link
Copy Markdown
Collaborator

Summary

  • add a Discord gateway readiness state that is stricter than socket Connected
  • force a clean Discord reconnect when Discord.Net resumes a previous session
  • report connected-but-not-ready Discord gateways as degraded instead of healthy
  • add offline tests for clean reconnect, retry, and queued reconnect behavior
  • update netclaw-operations guidance for Discord degraded channel diagnostics

Fixes #1238.

Verification

  • dotnet test src/Netclaw.Actors.Tests/Netclaw.Actors.Tests.csproj --filter "FullyQualifiedName~Discord"
  • dotnet build Netclaw.slnx --no-restore
  • dotnet slopwatch analyze
  • pwsh ./scripts/Add-FileHeaders.ps1 -Verify
  • git diff --check

Notes

./evals/run-evals.sh was attempted earlier but could not run in this shell because NETCLAW_EVAL_PROVIDER_TYPE, NETCLAW_EVAL_PROVIDER_ENDPOINT, and NETCLAW_EVAL_MODEL_ID are not set.

Comment thread src/Netclaw.Channels.Discord/Transport/DiscordNetGatewayClient.cs Fixed
Comment thread src/Netclaw.Actors.Tests/Channels/DiscordChannelHealthTests.cs Fixed
Comment thread src/Netclaw.Channels.Discord/Transport/DiscordNetGatewayClient.cs
@Aaronontheweb Aaronontheweb added the channels Discord, Slack, and other channels. label May 30, 2026
Comment thread src/Netclaw.Channels.Discord/Transport/DiscordNetGatewayClient.cs Fixed
Comment thread src/Netclaw.Channels.Discord/Transport/DiscordNetGatewayClient.cs Fixed
Comment thread src/Netclaw.Channels.Discord/Transport/DiscordNetGatewayClient.cs Fixed
Comment thread src/Netclaw.Channels.Discord/Transport/DiscordNetGatewayClient.cs Fixed
Comment thread src/Netclaw.Channels.Discord/Transport/DiscordNetGatewayClient.cs Fixed
Comment thread src/Netclaw.Channels.Discord/Transport/DiscordNetGatewayClient.cs Fixed
Comment thread src/Netclaw.Channels.Discord/Transport/DiscordNetGatewayClient.cs Fixed
Comment on lines +331 to +335
catch (Exception ex)
{
self.Tell(new DiscordStartFailed(attempt, ex));
return;
}
Comment on lines +412 to +416
catch (Exception ex)
{
self.Tell(new DiscordStopFailed(replyTo, ex));
return;
}
Comment on lines +557 to +561
catch (Exception ex)
{
self.Tell(new DispatchFailed("Discord fatal-close stop", ex));
return;
}
Comment on lines +670 to +674
catch (Exception ex)
{
Self.Tell(new DiscordButtonDeferFailed(component.Id, ex));
return;
}
Comment on lines +943 to +947
catch (Exception ex)
{
_logger.LogError(ex, "Error handling {Operation}", operation);
return;
}
Copy link
Copy Markdown
Collaborator Author

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb Aaronontheweb merged commit d6a33d0 into dev May 30, 2026
20 checks passed
@Aaronontheweb Aaronontheweb deleted the fix/discord-reconnect-zombie branch May 30, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channels Discord, Slack, and other channels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord gateway can enter zombie state after Discord.Net reconnect/resume

1 participant