Skip to content

Add dedicated voting proxy routing - #1551

Merged
BenCodez merged 4 commits into
masterfrom
agent/dedicated-voting-proxy-routing
Aug 16, 2026
Merged

Add dedicated voting proxy routing#1551
BenCodez merged 4 commits into
masterfrom
agent/dedicated-voting-proxy-routing

Conversation

@BenCodez

@BenCodez BenCodez commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • add an opt-in DedicatedVotingProxy proxy setting for one central voting proxy when regional proxies do not run VotingPlugin
  • use backend presence confirmed by PR Add backend player presence tracking foundation #1550 wherever normal proxy routing needs online-player/current-server state
  • preserve normal SendVotesToAllServers behavior in dedicated mode: when enabled, votes still reach every backend; when disabled, a confirmed online player routes to their backend and unknown/offline players use the existing cache path
  • after a complete startup/recovery snapshot, drain voter-keyed cached rewards for each newly confirmed player
  • retain normal routing unchanged when the toggle is off
  • reject dedicated presence routing on PLUGINMESSAGING; it falls back to normal proxy routing and logs the misconfiguration
  • use backend presence for cached-vote delivery, VoteParty delivery, and status checks in dedicated mode
  • add Bungee and Velocity configuration accessors plus routing-policy regression coverage

Configuration

On the dedicated voting proxy only:

DedicatedVotingProxy: true
BungeeMethod: MQTT # or MYSQL, REDIS, SOCKETS

Regional proxies should not run VotingPlugin. Backends use the same non-PLUGINMESSAGING global-message transport and their configured Server name.

Validation

  • git diff --check: passed
  • GitHub Java 21 Maven CI: passed
  • targeted Maven compile/tests could not be run locally because Maven is not installed in this workspace

AI disclosure: This content was written with assistance from ChatGPT.

AI disclosure: This commit message was written with assistance from ChatGPT.

Copy link
Copy Markdown
Owner Author

@codex review

Please review the dedicated voting-proxy routing introduced in this PR, especially that it uses only confirmed backend presence, never fans out through SendVotesToAllServers, preserves the unknown/offline cache path, and refuses dedicated presence routing under PLUGINMESSAGING.

Java 21 Maven CI passes.

AI disclosure: This review request was written with assistance from ChatGPT.

AI disclosure: This commit message was written with assistance from ChatGPT.

Copy link
Copy Markdown
Owner Author

Updated in 07ffb08f: dedicated mode now preserves normal SendVotesToAllServers behavior. The toggle changes only the source of online/current-server state (confirmed backend presence); it no longer forces a single-backend route.

AI disclosure: This comment was written with assistance from ChatGPT.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6b01f8964

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// A dedicated voting proxy has no player-facing proxy state. Its confirmed
// backend presence selects one destination, so never fan a vote out merely
// because a legacy configuration still has SendVotesToAllServers enabled.
if (getConfig().getSendVotesToAllServers() && !isDedicatedVotingProxyEnabled()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Drain cached votes after presence snapshots

When a dedicated proxy starts or recovers while a player is already online, this branch caches any vote received before the presence snapshot arrives. Completing an ordinary snapshot populates backendPlayerPresenceTracker, but the snapshot handler only completes pending cross-backend handoffs and never invokes login or checkOnlineVotes for the newly confirmed players; the periodic retry paths only retry broadcasts. Consequently, these rewards remain cached until the player generates a new login, potentially for the rest of their session. Process voter-keyed cached votes when a completed snapshot confirms their presence.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in e72772c5. Once a complete presence snapshot is accepted, dedicated mode now runs the existing login/cache-draining path for every confirmed player on that backend. This releases votes cached while the dedicated proxy was waiting for startup/recovery presence.

The existing token-bound handoff completion runs first; its players are excluded from the snapshot drain so they cannot receive a duplicate login callback.

Added dedicatedSnapshotDrainsCachedVotesForConfirmedPlayers coverage.

AI disclosure: This reply was written with assistance from ChatGPT.

AI disclosure: This commit message was written with assistance from ChatGPT.

Copy link
Copy Markdown
Owner Author

@codex review

Please review latest head (e72772c5), focusing on dedicated-proxy snapshot recovery: a complete snapshot must drain voter-keyed cached rewards for confirmed players, while token-bound cross-backend handoffs remain single-callback and are not drained twice. Also confirm normal SendVotesToAllServers behavior remains preserved.

Java 21 Maven CI passes.

AI disclosure: This review request was written with assistance from ChatGPT.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e72772c5af

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

});
}
for (PendingPresenceHandoff handoff : completed) {
completedPlayers.add(handoff.playerUuid);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Exclude only handoffs whose token actually completed

When a player reconnects on the destination backend before the snapshot is captured and the new login event is lost, the snapshot can install the player's new connection token while the pending handoff still contains the old token. This UUID is added to completedPlayers unconditionally, but the token-bound branch skips login because the tokens differ, and processDedicatedSnapshotLogins then excludes the UUID as if the callback had run. The complete recovery snapshot therefore fails to drain that confirmed player's voter-keyed rewards until another login; only add the UUID to the exclusion set when the token comparison succeeds and login is invoked.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in a8a7b806. A handoff UUID is now added to the snapshot-drain exclusion set only after the snapshot still matches that handoff's connection token and the handoff path invokes login. If the snapshot contains a newer connection, it is no longer excluded and the normal completed-snapshot drain processes its cached rewards.

AI disclosure: This reply was written with assistance from ChatGPT.

AI disclosure: This commit message was written with assistance from ChatGPT.
@BenCodez
BenCodez marked this pull request as ready for review August 16, 2026 22:43
@BenCodez
BenCodez merged commit 6867c48 into master Aug 16, 2026
4 checks passed
@BenCodez
BenCodez deleted the agent/dedicated-voting-proxy-routing branch August 16, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant