[GH-ISSUE #7118] Management protocol: notifications and game rules (vanilla's JSON-RPC pushes) #3148

Open
opened 2026-11-03 04:06:13 +07:00 by bsakaguchi · 6 comments
Owner

Originally created by @Akirabane on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7118

Originally assigned to: @Akirabane on GitHub.

🤖 Filed by both Akirabane's AI agent (Claude Code) and Akirabane himself, after his review.

Vanilla 26.3's management protocol (JSON-RPC over a WebSocket) pushes notifications to every connected client. Horizon serves the protocol (#5329, #5440, #5345, #5463, #5474, the settings in #6597) but never sends one. tools/test_management_protocol_parity.py says so: "the notifications vanilla sends meanwhile (server/started, server/saving...) are set aside: Horizon doesn't send them yet." rpc.discover already lists them (management_schema.rs).

This is separate from #6597 (the serversettings/* methods) and from #5147 (the /api/v1 control API).

What vanilla does

net.minecraft.server.jsonrpc.JsonRpcNotificationService (implements net.minecraft.server.notifications.NotificationService) broadcasts to every Connection of the ManagementServer, as a JSON-RPC notification without an id:

  • server/started, server/stopping, server/saving, server/saved, server/activity (at most one per 30 s);
  • players/joined, players/left (a player parameter);
  • operators/added|removed, allowlist/added|removed, bans/added|removed, ip_bans/added|removed;
  • gamerules/updated;
  • world/upgrade_started|progress|finished|failed;
  • the status heartbeat (status_heartbeat_interval).

Plan

Each step is its own pull request under about 500 lines, with unit tests on the frames written (the parity script runs on the maintainers' machines, so it records the notifications' names in its report and doesn't compare them yet):

  1. The broadcast itself (a registry of the authenticated connections and one notify), then server/started and server/stopping.
  2. server/saving, server/saved, players/joined, players/left.
  3. The list notifications (operators, allowlist, bans, IP bans), from every way a list changes (console, in-game commands, the protocol's own methods). Where vanilla calls the service is checked with javap first.
  4. gamerules and gamerules/update with gamerules/updated, then server/activity, the status heartbeat and the world upgrade notifications.

How each step is checked

Unit tests for the frames written (a client on a real socket, plain and TLS), the frame format and the order taken from vanilla's bytecode (JsonRPCUtils.createRequest, DedicatedServer.initServer and stopServer), and a check on a real server: connect a client to the management port, join or stop the server, see the frame. No bots and no benchmark are needed.

I'm taking step 1 first and will claim each next step before starting it.

Originally created by @Akirabane on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7118 Originally assigned to: @Akirabane on GitHub. > 🤖 Filed by both Akirabane's AI agent (Claude Code) and Akirabane himself, after his review. Vanilla 26.3's management protocol (JSON-RPC over a WebSocket) pushes **notifications** to every connected client. Horizon serves the protocol (#5329, #5440, #5345, #5463, #5474, the settings in #6597) but never sends one. `tools/test_management_protocol_parity.py` says so: "the notifications vanilla sends meanwhile (`server/started`, `server/saving`...) are set aside: Horizon doesn't send them yet." `rpc.discover` already lists them (`management_schema.rs`). This is separate from #6597 (the `serversettings/*` methods) and from #5147 (the `/api/v1` control API). ## What vanilla does `net.minecraft.server.jsonrpc.JsonRpcNotificationService` (implements `net.minecraft.server.notifications.NotificationService`) broadcasts to every `Connection` of the `ManagementServer`, as a JSON-RPC notification without an `id`: - `server/started`, `server/stopping`, `server/saving`, `server/saved`, `server/activity` (at most one per 30 s); - `players/joined`, `players/left` (a `player` parameter); - `operators/added|removed`, `allowlist/added|removed`, `bans/added|removed`, `ip_bans/added|removed`; - `gamerules/updated`; - `world/upgrade_started|progress|finished|failed`; - the status heartbeat (`status_heartbeat_interval`). ## Plan Each step is its own pull request under about 500 lines, with unit tests on the frames written (the parity script runs on the maintainers' machines, so it records the notifications' names in its report and doesn't compare them yet): 1. The broadcast itself (a registry of the authenticated connections and one `notify`), then `server/started` and `server/stopping`. 2. `server/saving`, `server/saved`, `players/joined`, `players/left`. 3. The list notifications (operators, allowlist, bans, IP bans), from every way a list changes (console, in-game commands, the protocol's own methods). Where vanilla calls the service is checked with `javap` first. 4. `gamerules` and `gamerules/update` with `gamerules/updated`, then `server/activity`, the status heartbeat and the world upgrade notifications. ## How each step is checked Unit tests for the frames written (a client on a real socket, plain and TLS), the frame format and the order taken from vanilla's bytecode (`JsonRPCUtils.createRequest`, `DedicatedServer.initServer` and `stopServer`), and a check on a real server: connect a client to the management port, join or stop the server, see the frame. No bots and no benchmark are needed. I'm taking step 1 first and will claim each next step before starting it.
Author
Owner

@Akirabane commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

Comment by Akirabane's AI agent (Claude Code, MAX), not by Akirabane personally.

<!-- gh-comment-id:6575879065 --> @Akirabane commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim > Comment by Akirabane's AI agent (Claude Code, MAX), not by Akirabane personally.
Author
Owner

@Akirabane commented on GitHub (Nov 2, 2026):

🤖 Agent: step 2 (saves and players joined/left) is starting; step 1 landed in #7121.

Comment by Akirabane's AI agent (Claude Code, MAX), not by Akirabane personally.

<!-- gh-comment-id:6576313534 --> @Akirabane commented on GitHub (Nov 2, 2026): 🤖 Agent: step 2 (saves and players joined/left) is starting; step 1 landed in #7121. > Comment by Akirabane's AI agent (Claude Code, MAX), not by Akirabane personally.
Author
Owner

@Akirabane commented on GitHub (Nov 2, 2026):

🤖 Agent: step 3 (the list notifications: operators, allowlist, bans, IP bans) is in #7198; step 2 landed in #7155.

Comment by Akirabane's AI agent (Claude Code, MAX), not by Akirabane personally.

<!-- gh-comment-id:6577343399 --> @Akirabane commented on GitHub (Nov 2, 2026): 🤖 Agent: step 3 (the list notifications: operators, allowlist, bans, IP bans) is in #7198; step 2 landed in #7155. > Comment by Akirabane's AI agent (Claude Code, MAX), not by Akirabane personally.
Author
Owner

@Akirabane commented on GitHub (Nov 2, 2026):

🤖 Agent: step 4 (the game rules: gamerules, gamerules/update, notification/gamerules/updated) is in #7220; step 3 landed in #7198. Step 5 (server/activity and the status heartbeat) follows; world/upgrade_* stays out until WorldUpgrader has its server side.

Comment by Akirabane's AI agent (Claude Code, MAX), not by Akirabane personally.

<!-- gh-comment-id:6577992162 --> @Akirabane commented on GitHub (Nov 2, 2026): 🤖 Agent: step 4 (the game rules: `gamerules`, `gamerules/update`, `notification/gamerules/updated`) is in #7220; step 3 landed in #7198. Step 5 (`server/activity` and the status heartbeat) follows; `world/upgrade_*` stays out until `WorldUpgrader` has its server side. > Comment by Akirabane's AI agent (Claude Code, MAX), not by Akirabane personally.
Author
Owner

@kira-horizon[bot] commented on GitHub (Nov 2, 2026):

Claimed by Akirabane on Discord (GitHub: Akirabane), to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #7118).

<!-- gh-comment-id:6578109480 --> @kira-horizon[bot] commented on GitHub (Nov 2, 2026): Claimed by `Akirabane` on Discord (GitHub: `Akirabane`), to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #7118). <!-- kira:work -->
Author
Owner

@Akirabane commented on GitHub (Nov 2, 2026):

🤖 Agent: summary of this issue, once #7248 has merged.

Delivered (the management protocol's notifications, as vanilla's JsonRpcNotificationService sends them, to every client connected to the supervisor):

Step Pull request What
1 #7121 the broadcast itself; server/started, server/stopping
2 #7155 server/saving, server/saved, players/joined, players/left
3 #7198 operators/*, allowlist/*, bans/*, ip_bans/* (added, removed), from every way a list changes
4 #7220, #7248 gamerules, gamerules/update, gamerules/updated; the answers and the notifications checked against vanilla
5 #7249 server/activity (once in thirty seconds), server/status (the heartbeat)

Same as vanilla, checked. tools/test_management_protocol_parity.py, run against the pinned vanilla 26.3 server, compares 110 exchanges over TLS (including the game rules' answers and errors) and the notifications of the lists and of the game rules, name by name and count by count: no difference after #7248. A manual run on a scratch dedicated server (see #7198) showed each list command telling once, and whitelist reload telling nothing.

Not compared to vanilla, so said plainly: server/saving and server/saved, players/joined and players/left (they need a save in progress or a player), server/activity and the heartbeat (they need a login and a timer); the error text of a game rule's value that is not a number (Not a number: …, from DFU's codec, not seen on vanilla); and the log line of gamerules/update, which names the rule by its short name.

Known limits.

  • The game's events reach the supervisor four times a second, so a notification comes up to about 250 ms after the event, and a clear of more than about 1000 entries at once can push unpolled events out of the game's buffer (one event per entry, as vanilla tells one notification per entry).
  • A save the game makes while it stops, and a list change while the game starts or stops, are not told (the supervisor isn't fetching the game's events then).

What is left. notification/world/upgrade_started, upgrade_progress, upgrade_finished and upgrade_failed. In vanilla Main builds an UpgradeProgress on the notification manager and Main.forceUpgrade runs WorldUpgrader at startup. #4774 ported the worker and only the Optimize World screen uses it; a dedicated server accepts --forceUpgrade, --eraseCache and --recreateRegionFiles and ignores them (dedicated.rs, preflight), and #4774 left the notification service out. So these four need --forceUpgrade wired on the dedicated server first. The serversettings/* methods are #6597.

Comment by Akirabane's AI agent (Claude Code, MAX), not by Akirabane personally.

<!-- gh-comment-id:6579391248 --> @Akirabane commented on GitHub (Nov 2, 2026): 🤖 Agent: summary of this issue, once #7248 has merged. **Delivered** (the management protocol's notifications, as vanilla's `JsonRpcNotificationService` sends them, to every client connected to the supervisor): | Step | Pull request | What | |---|---|---| | 1 | #7121 | the broadcast itself; `server/started`, `server/stopping` | | 2 | #7155 | `server/saving`, `server/saved`, `players/joined`, `players/left` | | 3 | #7198 | `operators/*`, `allowlist/*`, `bans/*`, `ip_bans/*` (`added`, `removed`), from every way a list changes | | 4 | #7220, #7248 | `gamerules`, `gamerules/update`, `gamerules/updated`; the answers and the notifications checked against vanilla | | 5 | #7249 | `server/activity` (once in thirty seconds), `server/status` (the heartbeat) | **Same as vanilla, checked.** `tools/test_management_protocol_parity.py`, run against the pinned vanilla 26.3 server, compares 110 exchanges over TLS (including the game rules' answers and errors) and the notifications of the lists and of the game rules, name by name and count by count: no difference after #7248. A manual run on a scratch dedicated server (see #7198) showed each list command telling once, and `whitelist reload` telling nothing. **Not compared to vanilla**, so said plainly: `server/saving` and `server/saved`, `players/joined` and `players/left` (they need a save in progress or a player), `server/activity` and the heartbeat (they need a login and a timer); the error text of a game rule's value that is not a number (`Not a number: …`, from DFU's codec, not seen on vanilla); and the log line of `gamerules/update`, which names the rule by its short name. **Known limits.** - The game's events reach the supervisor four times a second, so a notification comes up to about 250 ms after the event, and a `clear` of more than about 1000 entries at once can push unpolled events out of the game's buffer (one event per entry, as vanilla tells one notification per entry). - A save the game makes while it stops, and a list change while the game starts or stops, are not told (the supervisor isn't fetching the game's events then). **What is left.** `notification/world/upgrade_started`, `upgrade_progress`, `upgrade_finished` and `upgrade_failed`. In vanilla `Main` builds an `UpgradeProgress` on the notification manager and `Main.forceUpgrade` runs `WorldUpgrader` at startup. #4774 ported the worker and only the Optimize World screen uses it; a dedicated server accepts `--forceUpgrade`, `--eraseCache` and `--recreateRegionFiles` and ignores them (`dedicated.rs`, `preflight`), and #4774 left the notification service out. So these four need `--forceUpgrade` wired on the dedicated server first. The `serversettings/*` methods are #6597. > Comment by Akirabane's AI agent (Claude Code, MAX), not by Akirabane personally.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#3148
No description provided.