From f8290a65bcd42a193af064cbc56ba4af7070b20b Mon Sep 17 00:00:00 2001 From: Rogee Date: Sun, 20 Sep 2026 23:42:29 +0800 Subject: [PATCH] fix: register verified bound accounts remotely --- .../WxAgent.Service/RemoteAgentHostedService.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/node-agent/WxAgent.Service/RemoteAgentHostedService.cs b/node-agent/WxAgent.Service/RemoteAgentHostedService.cs index 6fa590a..7fde772 100644 --- a/node-agent/WxAgent.Service/RemoteAgentHostedService.cs +++ b/node-agent/WxAgent.Service/RemoteAgentHostedService.cs @@ -142,7 +142,7 @@ public sealed class RemoteAgentHostedService( } var currentSnapshot = await ReadSnapshotAsync(remote, cancellationToken); - if (!string.Equals(remote.ActiveAccountId, task.AccountId, StringComparison.Ordinal) || !currentSnapshot.ActiveAccountVerified) + if (!string.Equals(currentSnapshot.ActiveAccountId, task.AccountId, StringComparison.Ordinal) || !currentSnapshot.ActiveAccountVerified) { var result = new RemoteTaskResult(task.TaskId, task.AccountId, task.LeaseGeneration, RemoteTaskStatus.Failed, "AccountContextUnconfirmed", "The active account binding could not be confirmed.", false, null, Guid.NewGuid().ToString("N")); @@ -453,16 +453,16 @@ public sealed class RemoteAgentHostedService( new(remote.NodeId!, typeof(RemoteAgentHostedService).Assembly.GetName().Version?.ToString() ?? "dev", RemoteProtocol.Version, ["heartbeat", "poll-tasks", "send-text", "read-sessions", "read-contacts", "read-messages", "report-message"], reporting.ConfigVersion, snapshot.Accounts - .Where(identity => reporting.Accounts.Any(account => account.Enabled && string.Equals(account.AccountId, identity.AccountId, StringComparison.Ordinal))) + .Where(identity => identity.Verified) .Select(identity => { - var account = reporting.FindAccount(identity.AccountId)!; + var account = reporting.FindAccount(identity.AccountId); return new RemoteAccountSummary( identity.AccountId, - string.Equals(identity.AccountId, remote.ActiveAccountId, StringComparison.Ordinal), + string.Equals(identity.AccountId, snapshot.ActiveAccountId, StringComparison.Ordinal), identity.Verified, - account.AllowedChats.Count(chat => chat.Type == ReportingChatType.Group && chat.Enabled && chat.IdentityVerified), - account.AllowedChats.Count(chat => chat.Type == ReportingChatType.Private && chat.Enabled && chat.IdentityVerified)); + account?.AllowedChats.Count(chat => chat.Type == ReportingChatType.Group && chat.Enabled && chat.IdentityVerified) ?? 0, + account?.AllowedChats.Count(chat => chat.Type == ReportingChatType.Private && chat.Enabled && chat.IdentityVerified) ?? 0); }).ToArray()); private static RemoteHeartbeat CreateHeartbeat(RemoteAgentOptions remote, ReportingConfig reporting, BackendSnapshot snapshot, string? errorCode) =>