[PR #879] [MERGED] Server thread: run the agent's commands, give and time on the server #2881

Closed
opened 2026-11-02 15:59:50 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: feat/server-thread-agent-commands


📝 Commits (1)

  • 60bc15a Run the agent's commands, give and time on the server thread

📊 Changes

3 files changed (+77 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/game/agent.rs (+7 -0)
📝 crates/horizon-client/src/game/control.rs (+16 -1)
📝 crates/horizon-client/src/game/integrated.rs (+54 -0)

📄 Description

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

Part of #731 (making the server thread the default): "control give, time and the agent's command run on the server as the world's owner (owner_console_command), in the owner's level". This ports that piece of b9f3821f onto the current server thread. It leaves out sync_hub_settings, which #845 supersedes.

What was wrong

On the server thread, the window is a client of the server:

  • The agent's command went out as the owner's chat. Its reply was {"ok": true} with no output, so a harness that reads a command's feedback failed. lan_e2e trials is one: it reads data get output.
  • Control give and time changed only the window's copy of the world.

Fix

Game::owner_console_command, on the server thread, does what single player's console does without one (as_console):

  • runs the command as the world's owner, in the owner's level (it enters that level and goes back after);
  • sends the feedback to the owner's chat and returns it to the agent;
  • runs level teleports and admin feedback the way a guest's command does.

The agent's command uses it, give runs give @s ITEM COUNT through it, and time sets the server's clock too.

Checks

Check Result
lan_e2e --server-thread --check trials FAIL on main (the host's data get came back as just {"ok": true}), PASS here
lan_e2e --server-thread: feedback, commands, sleep, portals PASS. portals covers the owner's commands while the owner is in the End.
By hand on the server thread: give dirt 5 the window holds 5 dirt, and data get entity @s Inventory shows them
By hand on the server thread: time 6000 the window's day_time reads 6031 a few ticks later
  • Workspace clippy -D warnings and fmt are clean.

This only changes the agent and control paths on the server thread. Per the coordinator, I skipped parity.py --changed; CI parity covers the other harnesses.

🤖 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/879 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/server-thread-agent-commands` --- ### 📝 Commits (1) - [`60bc15a`](https://github.com/horizon-rust/horizon/commit/60bc15a63ede1a7ca624ea8921eb6d32fc37463e) Run the agent's commands, give and time on the server thread ### 📊 Changes **3 files changed** (+77 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/agent.rs` (+7 -0) 📝 `crates/horizon-client/src/game/control.rs` (+16 -1) 📝 `crates/horizon-client/src/game/integrated.rs` (+54 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part of #731 (making the server thread the default): "control `give`, `time` and the agent's `command` run on the server as the world's owner (owner_console_command), in the owner's level". This ports that piece of b9f3821f onto the current server thread. It leaves out `sync_hub_settings`, which #845 supersedes. ## What was wrong On the server thread, the window is a client of the server: - The agent's `command` went out as the owner's chat. Its reply was `{"ok": true}` with no output, so a harness that reads a command's feedback failed. lan_e2e `trials` is one: it reads `data get` output. - Control `give` and `time` changed only the window's copy of the world. ## Fix `Game::owner_console_command`, on the server thread, does what single player's console does without one (`as_console`): - runs the command as the world's owner, in the owner's level (it enters that level and goes back after); - sends the feedback to the owner's chat and returns it to the agent; - runs level teleports and admin feedback the way a guest's command does. The agent's `command` uses it, `give` runs `give @s ITEM COUNT` through it, and `time` sets the server's clock too. ## Checks | Check | Result | | --- | --- | | lan_e2e `--server-thread --check trials` | FAIL on main (the host's `data get` came back as just `{"ok": true}`), PASS here | | lan_e2e `--server-thread`: feedback, commands, sleep, portals | PASS. portals covers the owner's commands while the owner is in the End. | | By hand on the server thread: `give dirt 5` | the window holds 5 dirt, and `data get entity @s Inventory` shows them | | By hand on the server thread: `time 6000` | the window's day_time reads 6031 a few ticks later | - Workspace clippy `-D warnings` and fmt are clean. This only changes the agent and control paths on the server thread. Per the coordinator, I skipped `parity.py --changed`; CI parity covers the other harnesses. 🤖 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 15:59:50 +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#2881
No description provided.