[PR #1095] [MERGED] Server thread: the owner's commands run with the hub in place #3044

Closed
opened 2026-11-02 16:01:03 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1095
Author: @ludovic111
Created: 10/21/2026
Status: ✅ Merged
Merged: 10/21/2026
Merged by: @ludovic111

Base: main ← Head: fix/hub-default-game-mode


📝 Commits (1)

  • 87d5cd2 Server thread: the owner's commands run with the hub in place

📊 Changes

1 file changed (+13 additions, -8 deletions)

View changed files

📝 crates/horizon-client/src/game/integrated.rs (+13 -8)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What and why

With single player on its server thread (--server-thread, the plan of #1072), the window's agent and control commands run on the server as the world's owner (owner_console_command). That function ran the command inside as_guest with the hub taken out of self.lan, so:

  • selectors saw only the owner: team join parity_allies @a left the guest out, and friendly fire off still hurt a teammate;
  • defaultgamemode never reached the hub (set_default_game_mode writes self.lan's hub config), so guests joined in the world's old mode (creative in lan_e2e), and their E opened the creative inventory.

The hub is now back in self.lan while the command runs, exactly as run_guest_commands does for a guest's own command (enter_guest, put the hub back, run, take it, leave_guest, sync_all_effects). Only the server thread runs this function. The in-frame world and LAN guests are unchanged.

This is a #1072 prerequisite. It was sync_hub_settings in b9f3821f on the kept fix/server-thread-default branch; this version fixes the selectors too.

Proof

tools/lan_e2e.py --server-thread on the Mac mini (offscreen, --profile fast):

check main this branch
self ❌ wait-for screen inventory: … the screen is creative ✅
crafting ❌ same ✅
pvp ❌ friendly fire off still hurts (guest hits teammate) ✅
all 39 checks 35/39 38/39 (swings fails at random on the server thread: no face of block … is visible from here; it passed on this branch in a separate run, and on main)

Self-check

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 7e0b20237, 4 min 27 s)

Check Result
Scope ✅ 1 files, +13 −8
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (5 s)
clippy ✅ (42 s)
tests: horizon-client ✅ 1053 passed (3 min 34 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 238 affected, to run in CI (--quick): arrow, block_particles, block_removal, command_exec, composter, crafter, datafix, decoration, decoration_region, dedicated_server, delta, density and 226 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Parity: CI's parity job runs the affected harnesses. None of them uses the server thread, which this code is limited to.

Part of #1072.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/1095 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/hub-default-game-mode` --- ### 📝 Commits (1) - [`87d5cd2`](https://github.com/horizon-rust/horizon/commit/87d5cd27c147dfdbc83d588c5533297e1cfb70a8) Server thread: the owner's commands run with the hub in place ### 📊 Changes **1 file changed** (+13 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/integrated.rs` (+13 -8) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What and why With single player on its server thread (`--server-thread`, the plan of #1072), the window's agent and control commands run on the server as the world's owner (`owner_console_command`). That function ran the command inside `as_guest` with the hub taken out of `self.lan`, so: - selectors saw only the owner: `team join parity_allies @a` left the guest out, and friendly fire off still hurt a teammate; - `defaultgamemode` never reached the hub (`set_default_game_mode` writes `self.lan`'s hub config), so guests joined in the world's old mode (creative in `lan_e2e`), and their `E` opened the creative inventory. The hub is now back in `self.lan` while the command runs, exactly as `run_guest_commands` does for a guest's own command (`enter_guest`, put the hub back, run, take it, `leave_guest`, `sync_all_effects`). Only the server thread runs this function. The in-frame world and LAN guests are unchanged. This is a #1072 prerequisite. It was `sync_hub_settings` in b9f3821f on the kept `fix/server-thread-default` branch; this version fixes the selectors too. ## Proof `tools/lan_e2e.py --server-thread` on the Mac mini (offscreen, `--profile fast`): | check | main | this branch | | --- | --- | --- | | self | ❌ `wait-for screen inventory: … the screen is creative` | ✅ | | crafting | ❌ same | ✅ | | pvp | ❌ `friendly fire off still hurts (guest hits teammate)` | ✅ | | all 39 checks | 35/39 | 38/39 (`swings` fails at random on the server thread: `no face of block … is visible from here`; it passed on this branch in a separate run, and on main) | ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 7e0b20237, 4 min 27 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +13 −8 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (5 s) | | clippy | ✅ (42 s) | | tests: horizon-client | ✅ 1053 passed (3 min 34 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 238 affected, to run in CI (--quick): arrow, block_particles, block_removal, command_exec, composter, crafter, datafix, decoration, decoration_region, dedicated_server, delta, density and 226 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Parity: CI's parity job runs the affected harnesses. None of them uses the server thread, which this code is limited to. Part of #1072. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 16:01:03 +07:00
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#3044
No description provided.