Skip to content

fix(spigot): keep handling LOGIN_START after stripping a handshake marker - #183

Merged
minekube-ai-engineer[bot] merged 1 commit into
mainfrom
fix/spigot-handshake-marker-login-start
Nov 24, 2026
Merged

minekube-ai-engineer[bot] merged 1 commit into
mainfrom
fix/spigot-handshake-marker-login-start

Conversation

@minekube-ai-engineer

Copy link
Copy Markdown

Source: Discord ask-support thread · "Issue with online-mode: true" — reporter Sul3 / in-game R6vibin.

Symptom

Paper 26.3, online-mode=true, enforce-secure-profile=false, connect-spigot 0.15.18, endpoint offlineModeHeader: "false". A Forge/NeoForge launcher profile always lands in the browser hub; a plain vanilla 26.3 profile joins fine, and online-mode=false joins fine.

Edge (connect-proxy, connectorVersion 0.15.18, connectorMinecraftVersion 26.3): the tunnel opens and dies 20–34 ms later —

endpoint connect session completed {result: backend_disconnect, errorClass: backend_connect,
                                    backendDuration: 20.320879ms / 33.950727ms, fallbackUsed: false}
could not handle tunnel session, closing tunnel {errorClass: backend_connect}
failed to connect player to endpoint, falling back to browser {error: internal_error}

Paper logs only the two lines [connect] Connect tunneled player <name> disconnected and <name> (/172.16.x.x:0) lost connection: Disconnected — no logged in as, no disconnect reason.

Root cause

The Forge client's handshake carries a \0FORGE marker in the hostname. With BungeeCord forwarding disabled the connector strips that data (the "BungeeCord mode disabled but hostname contained forwarding data" branch), rebuilds the handshake for 1.20.2+, fires it — and then removed itself from the pipeline (removeSelf()), copied over from the BungeeCord-forwarding branch where it is correct.

On the forwarding-disabled path Connect owns the login: the fake offline login cycle (spoofedUUID → callPlayerPreLoginEvents → startClientVerification) runs when LOGIN_START arrives, i.e. the packet after the handshake. With the handler already gone, LOGIN_START went straight to the server, no profile was injected, and Paper (online-mode=true) started its own encryption handshake into the tunnel. The edge cannot answer an encryption request, so the backend connection was closed within ~20 ms — before any client round trip — and the player was sent to the hub.

That is also why online-mode=false works on the same stack: the server asks for no encryption, so the missing injection never matters. The strip itself is fine; only the discarded pipeline slot is the defect.

Fix

Keep the connector installed after stripping forwarding data from a hostname. Only the BungeeCord-forwarding path — where the server owns the login — leaves the pipeline, and it still honours ProtocolSupport (which needs the connector to stay, or the player is kicked with "unexpected hello packet").

The handshake decision is now a tested seam (HandshakeView / handleHandshake) so both the hostname the server receives and the connector's pipeline decision are covered; ClassNames needs a live server and cannot be exercised from a unit test.

Evidence

Disposable pod: Paper 26.3-49 + connect-spigot + the endpoint's connector config, real tunnel through the production edge, synthetic 26.3 client (protocol 777) with only the handshake hostname changed.

run jar handshake hostname result
RED 0.15.18 host\0FORGE backend_disconnect / backend_connect 21.67059 ms, browser fallback; Paper: Connect tunneled player HProbeRed4 disconnected + lost connection: Disconnected
control 0.15.18 host result: success, backendDuration 510.938064 ms, joined and stayed in PLAY
discriminator 0.15.18, online-mode=false host\0FORGE Connect tunneled player logged in as HProbeOff — stayed 20 s. The marker alone is harmless; the skipped injection is the defect
GREEN this PR host\0FORGE result: success, backendDuration 1.775680597 s, no fallback; Paper: Connect tunneled player logged in as HProbeFix (UUID: …), joined the game
control this PR host result: success, Connect tunneled player logged in as HProbeCtl2, stayed in PLAY

Tests

  • SpigotHandshakeStripTest (new) drives the production decision: a marker is stripped and the connector stays installed, a clean handshake is passed through unchanged, BungeeCord forwarding still injects the player data and leaves the pipeline, ProtocolSupport still keeps it.
  • Reintroducing the 0.15.18 behaviour (a stopAfterHandshake() on the strip path) fails exactly keepsTheConnectorInstalledWhenItStripsAForwardingMarker(), so the regression guard is red on the defect.
  • ./gradlew :core:test :api:test :spigot:check :spigot:shadowJar green in a sandbox pod (433 tests).

@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9608271b-72b7-49f6-89a9-d1b4033c934c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@minekube-ai-engineer
minekube-ai-engineer Bot merged commit 43f852f into main Nov 24, 2026
3 checks passed
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.

0 participants