Skip to content

fix: honour Paper's login-phase refusal in the fake login cycle; record both debug directions - #180

Merged
minekube-ai-engineer[bot] merged 2 commits into
mainfrom
fix/spigot-login-refusal-and-debug-capture
Oct 28, 2026
Merged

minekube-ai-engineer[bot] merged 2 commits into
mainfrom
fix/spigot-login-refusal-and-debug-capture

Conversation

@minekube-ai-engineer

@minekube-ai-engineer minekube-ai-engineer Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

What this changes

Two defects in connect-spot's support-facing behaviour, both found while working the Paper 26.3
configuration-phase stall (internal case t_dc27dadd).

1. debug: true captured one direction only (fix(core)). On Paper 26.3 a successful join
produced exactly 25 Player -> Spigot lines and zero Spigot -> Player, which read as "the backend
sent nothing" for three support rounds. Two causes:

  • Paper names the outbound packet encoder outbound_config on the injected, configuration-capable
    connection and only uses encoder on the player-side path
    (net.minecraft.network.Connection#outboundHandlerName), so addBefore("encoder") never matched and
    the skip was logged at debug level only.
  • Both recorders shared one packet counter, so whichever direction spoke first consumed
    MAX_DEBUG_PACKET_COUNT and silenced the other one.

The outbound recorder now locates the encoder in the pipeline (configured name -> installed packet
encoder by class name -> any Netty message encoder), falls back to a pre-encoding object recorder at
the pipeline tail so a direction is never silently missing, and logs every non-obvious placement at
WARN. Each direction gets its own budget.

2. The fake login cycle kept driving Paper after Paper had refused the login (fix(spigot)). The
post-1.20.4 flow called callPlayerPreLoginEvents and then startClientVerification unconditionally.
When the pre-login call ends the connection (a refused AsyncPlayerPreLoginEvent, a
velocity-forwarding refusal), the connector was invoking verification on a dead connection. It now
stops before startClientVerification when the pre-login call returned no profile or the connection is
no longer open. Paper's own disconnect packet is not touched or rewritten.

Scope note (please read before reviewing the second commit)

A whitelist/ban kick is not decided inside callPlayerPreLoginEvents on Paper 26.3 - it is decided
in PlayerList#canPlayerLogin after startClientVerification, disconnectAsync'd from the login
listener's tick. So commit 2 cannot move that kick to the client, and it does not claim to: the
connector forwards that disconnect unchanged either way (measured below: exactly one 44-byte
Spigot -> Player packet carrying the whitelist message; no backend LoginSuccess). Commit 2 closes
the narrower connector-side race (verification invoked on a connection Paper already ended).

RED -> GREEN

Per-direction unit tests, run on the release-under-test code before the fixes (both files kept in the
PR):

:core:test   DebugAddonCaptureTest        4 tests completed, 3 failed
:spigot:test SpigotLoginRefusalTest       4 tests completed, 2 failed

after:
:core:test   DebugAddonCaptureTest        tests 5 failures 0
:spigot:test SpigotLoginRefusalTest       tests 4 failures 0

Lab verification (disposable pod, Paper 26.3 build 227, protocol-777 probe, production endpoint)

arm jar result
whitelist refusal 0.15.17 25 Player -> Spigot, 0 Spigot -> Player (the reported defect)
whitelist refusal this PR Spigot -> Player 1 = Paper's 44-byte login disconnect, hex 2b 00 29 22 "You are not whitelisted on this server!"; backend sent no LoginSuccess
normal join this PR join_game at +1.25 s, both directions recorded (20 inbound / 25 outbound lines)
AsyncPlayerPreLoginEvent denial control jar (debug fix only) startClientVerification completed logged 6 ms after the channel was already closed by Paper's refusal
AsyncPlayerPreLoginEvent denial this PR Paper ended the login during the pre-login events; not continuing the injection; same single 61-byte disconnect on the wire

Caveat carried forward (not fixed here)

On an endpoint that has a fallback (the Minekube browser hub), a backend refusal during login ends up
as a fallback redirect: the player is placed in the hub instead of being shown Paper's kick. That is
edge/fallback policy, not this plugin - the connector demonstrably forwards the refusal packet
unmodified. Tracked separately.

hermes-minekube added 2 commits October 28, 2026 06:01
… encoder

`debug: true` produced a one-sided dump on Paper 26.3: 25 `Player -> Spigot`
lines and zero `Spigot -> Player`, which read as "the backend sent nothing" for
three support rounds of the 26.3 configuration-stall case.

Two causes, both measured on Paper 26.3 (connect-spot 0.15.17, protocol-777
probe through a production endpoint):

* Paper names the outbound packet encoder `outbound_config` on the injected,
  configuration-capable connection and only uses `encoder` on the player-side
  path (net.minecraft.network.Connection#outboundHandlerName), so the recorder
  was never installed. The skip was logged at debug level, i.e. invisible.
* Both recorders shared one packet counter, so whichever direction spoke first
  consumed MAX_DEBUG_PACKET_COUNT and silenced the other one entirely.

The outbound recorder now locates the encoder in the pipeline itself (configured
name, then the installed packet encoder by class name, then any Netty message
encoder), falls back to a pre-encoding object recorder at the pipeline tail so
the direction is visible even from a degraded position, and reports every
non-obvious placement at WARN. Each direction gets its own budget.

Verified on the same Paper 26.3 pod: a whitelist-refused join now records
`Spigot -> Player 1` - Paper's 44-byte login disconnect carrying "You are not
whitelisted on this server!" - and a normal join records both directions
(20 inbound / 25 outbound lines).
…fusal

The post-1.20.4 fake login cycle called `callPlayerPreLoginEvents` and then
`startClientVerification` unconditionally, even when Paper had already ended the
connection inside the first call (a refused `AsyncPlayerPreLoginEvent`, a
velocity-forwarding refusal). Invoking verification on a connection Paper has
closed is a race the connector should not enter: its result is either a no-op or
a `LoginSuccess` written onto a refused login, and it contradicts the reason the
player is being kicked for.

The cycle now reports whether the login was handed over and stops before
`startClientVerification` when the pre-login call returned no profile or the
connection is no longer open. Paper's own disconnect packet is untouched.

Measured with a deny plugin on Paper 26.3 through a production endpoint:

* before: `callPlayerPreLoginEvents returned a profile` ->
  `startClientVerification completed` logged 6 ms *after* the channel had
  already been closed by Paper's refusal;
* after: `Paper ended the login during the pre-login events; not continuing the
  injection`, with the same single 61-byte disconnect on the wire.

Note for the record: a whitelist/ban refusal is *not* decided in the pre-login
call on Paper 26.3 - it happens in `PlayerList#canPlayerLogin` after
`startClientVerification` - so this change cannot move that kick to the client;
the connector forwards that disconnect unchanged either way (verified: exactly
one 44-byte `Spigot -> Player` packet carrying the whitelist message).
@minekube-ai-engineer
minekube-ai-engineer Bot merged commit 3d2e5c3 into main Oct 28, 2026
2 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