[GH-ISSUE #5682] Native mods: mod commands do not run from server consoles #1775

Closed
opened 2026-11-02 15:49:34 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @arismoko on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5682

Originally assigned to: @levzzz5154 on GitHub.

🤖 Filed by Aria's agent swarm, Dyna, not by Aria.

A registered native mod command can run from a player's chat, but the dedicated server console and the integrated server's owner console do not dispatch it to the mod. They fall through to the vanilla-only game dispatcher, which reports an unknown command. Vanilla routes console and player commands through Commands.performCommand with the appropriate command source.

Steps to reproduce

  1. Register a server command with native_register_commands and handle it in native_perform_command.
  2. Run the command as an allowed player and confirm the hook handles it.
  3. Run the same command from the dedicated server console. Also try the integrated server's owner console.

Expected: the registered command reaches a native mod with the correct command source and permission. Actual, from code inspection: both console paths call run_command directly and bypass perform_native_command. The existing hook takes a NativeServerPlayer, so a console source needs an explicit API design rather than a fabricated player.

On upstream main b6ac0602d, the dedicated path is game/dedicated.rs:1232,1247,1583-1586. The owner console path is game/integrated.rs:851,864-873. Player commands go through game/lan_actions.rs:2746,2779-2793,2826-2857 and game/native_server.rs:742-764. game/commands.rs:140-145 only checks client mod commands before using the vanilla dispatcher.

How to test

Use https://github.com/arismoko/horizon-machine-sample as the end-to-end route. Add a throwaway registered server command to the sample, then compare player chat, dedicated console and integrated owner-console execution. Check source, permissions and feedback. This report is based on code inspection on upstream main; that game test has not run there. On our fork, which keeps these console paths unchanged, a test mod's registered command answered "Unknown or incomplete command" from the console and ran from player chat.

Originally created by @arismoko on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5682 Originally assigned to: @levzzz5154 on GitHub. > 🤖 Filed by Aria's agent swarm, Dyna, not by Aria. A registered native mod command can run from a player's chat, but the dedicated server console and the integrated server's owner console do not dispatch it to the mod. They fall through to the vanilla-only game dispatcher, which reports an unknown command. Vanilla routes console and player commands through `Commands.performCommand` with the appropriate command source. ### Steps to reproduce 1. Register a server command with `native_register_commands` and handle it in `native_perform_command`. 2. Run the command as an allowed player and confirm the hook handles it. 3. Run the same command from the dedicated server console. Also try the integrated server's owner console. Expected: the registered command reaches a native mod with the correct command source and permission. Actual, from code inspection: both console paths call `run_command` directly and bypass `perform_native_command`. The existing hook takes a `NativeServerPlayer`, so a console source needs an explicit API design rather than a fabricated player. On upstream main `b6ac0602d`, the dedicated path is `game/dedicated.rs:1232,1247,1583-1586`. The owner console path is `game/integrated.rs:851,864-873`. Player commands go through `game/lan_actions.rs:2746,2779-2793,2826-2857` and `game/native_server.rs:742-764`. `game/commands.rs:140-145` only checks client mod commands before using the vanilla dispatcher. ### How to test Use https://github.com/arismoko/horizon-machine-sample as the end-to-end route. Add a throwaway registered server command to the sample, then compare player chat, dedicated console and integrated owner-console execution. Check source, permissions and feedback. This report is based on code inspection on upstream main; that game test has not run there. On our fork, which keeps these console paths unchanged, a test mod's registered command answered "Unknown or incomplete command" from the console and ran from player chat.
Author
Owner

@Detimes commented on GitHub (Nov 1, 2026):

🤖 Agent: comment by Detimes' AI agent (Claude Code, Sonnet 5.5), not by Detimes personally.

/claim

I run a dedicated server with a native mod and need its commands from the console (and later from tooling that sends console commands), so I'll take this. Plan, so a maintainer can object before I write it:

  • A new hook point native_perform_console_command(command, ran) (a new API number), beside native_perform_command. It has no player: the source is the server console, operator level 4. A mod sets ran when the command is its own.
  • Both console paths named in the report (dedicated: game/dedicated.rs, owner console: game/integrated.rs) offer a registered mod command to it before the vanilla dispatcher, and only commands a mod registered with native_register_commands; everything else goes to vanilla as today.
  • native_feedback inside it writes to the console log (and nothing else), as vanilla's console source does.
  • A usage with an operator level above 4 is not possible, so no change to the registered-usage rules; player-only helpers (native_acting_player, items) return nothing there.
  • Test: a unit test for the routing, and a real dedicated server with a throwaway mod bundle (built with horizon-mixins) whose command runs from the console and from a player's chat.

If you'd rather have a different shape (for example one hook for both sources with an explicit source argument), say so and I'll follow it.

<!-- gh-comment-id:6555559114 --> @Detimes commented on GitHub (Nov 1, 2026): 🤖 Agent: comment by Detimes' AI agent (Claude Code, Sonnet 5.5), not by Detimes personally. /claim I run a dedicated server with a native mod and need its commands from the console (and later from tooling that sends console commands), so I'll take this. Plan, so a maintainer can object before I write it: - A new hook point `native_perform_console_command(command, ran)` (a new API number), beside `native_perform_command`. It has no player: the source is the server console, operator level 4. A mod sets `ran` when the command is its own. - Both console paths named in the report (dedicated: `game/dedicated.rs`, owner console: `game/integrated.rs`) offer a registered mod command to it before the vanilla dispatcher, and only commands a mod registered with `native_register_commands`; everything else goes to vanilla as today. - `native_feedback` inside it writes to the console log (and nothing else), as vanilla's console source does. - A usage with an operator level above 4 is not possible, so no change to the registered-usage rules; player-only helpers (`native_acting_player`, items) return nothing there. - Test: a unit test for the routing, and a real dedicated server with a throwaway mod bundle (built with horizon-mixins) whose command runs from the console and from a player's chat. If you'd rather have a different shape (for example one hook for both sources with an explicit source argument), say so and I'll follow it.
Author
Owner

@levzzz5154 commented on GitHub (Nov 1, 2026):

/claim

<!-- gh-comment-id:6561708708 --> @levzzz5154 commented on GitHub (Nov 1, 2026): /claim
Author
Owner

@Detimes commented on GitHub (Nov 1, 2026):

🤖 Agent: comment by Detimes' AI agent (Claude Code, Sonnet 5.5), not by Detimes personally.

Our PR #5815 (merged) covers the dedicated server's console only. The single player owner's console (integrated.rs, owner_console_command) is not touched, so that half is free for you; I won't start on it. I'll unclaim once you confirm you have it.

<!-- gh-comment-id:6562009910 --> @Detimes commented on GitHub (Nov 1, 2026): 🤖 Agent: comment by Detimes' AI agent (Claude Code, Sonnet 5.5), not by Detimes personally. Our PR #5815 (merged) covers the dedicated server's console only. The single player owner's console (`integrated.rs`, `owner_console_command`) is not touched, so that half is free for you; I won't start on it. I'll unclaim once you confirm you have it.
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#1775
No description provided.