[PR #6114] [MERGED] Clicked commands ask first, as vanilla's sendUnattendedCommand does #6658

Closed
opened 2026-11-03 06:24:30 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6114
Author: @4404c
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: secure-chat/confirm-command


📝 Commits (2)

  • ad5de29 Clicked commands ask first, as sendUnattendedCommand does
  • 38c0c6d horizon-ctl: the command confirmation takes the keys

📊 Changes

11 files changed (+346 additions, -25 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+18 -0)
📝 crates/horizon-client/src/game/chat.rs (+1 -2)
📝 crates/horizon-client/src/game/control.rs (+7 -0)
📝 crates/horizon-client/src/game/net_harness.rs (+20 -5)
📝 crates/horizon-client/src/game/pad_menu.rs (+1 -1)
📝 crates/horizon-client/src/game/remote_chat.rs (+194 -10)
📝 crates/horizon-command/src/lib.rs (+19 -0)
📝 crates/horizon-command/src/network.rs (+50 -0)
📝 docs/microsoft-account.md (+3 -1)
📝 tools/port_map/client-002.tsv (+5 -5)
📝 tools/secure_chat_client_e2e.py (+28 -1)

📄 Description

🤖 Opened by 4404c's AI agent (Claude Code, Opus 5.5), not by 4404c personally.

What and why

Fixes #6080.

A command the player didn't type (a clicked chat line, a book, a dialog's button) went straight to the server. On a server that enforces secure chat, a clicked /msg was refused and the player wasn't told why. This ports ClientPacketListener.sendUnattendedCommand's checks and confirmations:

  • no issue: it goes unsigned, as before;
  • a parse error, or a command only elevated permissions can run: ConfirmScreen, and Run Command sends it;
  • a message argument: never sent from there. The button puts it in the chat box, or copies it when a screen is open behind, so the player reads and sends it themselves.

The tree parse now keeps the packet's restricted flag (Node.restricted), which verifyCommand's second parse needs. The net harness learns .click and .answer, and horizon-ctl key stops at the open confirmation.

Known differences, in the ledger: a clicked book or dialog is already closed when the confirmation opens, so answering no doesn't return to it (and the second button says Cancel, not Back); the chat box doesn't put a kept draft before the command. Keyboard focus on the buttons (Tab, arrows, Enter) isn't there, as in the link confirmation beside it.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

ClientPacketListener.sendUnattendedCommand, verifyCommand, isValidCommand, openSendConfirmationWindow, openCommandSendConfirmationWindow, openSignedCommandSendConfirmationWindow (read with tools/rea_vanilla.py).

Harness: tools/secure_chat_client_e2e.py against vanilla 26.3's server on Windows, passing online and offline. It now clicks commands: list goes without asking; an unknown command asks and reaches the server on yes; stop asks for permissions online (the script makes the player an op there; offline it's a parse error) and doesn't run on no; msg asks, ends up in the chat box and never reaches the server.

Also driven through horizon-ctl in a scratch single player world, with screenshots: a click on a chat line opens it, and Escape, Back, Copy to Clipboard and Run Command each do what they should. Not tried with a physical mouse and keyboard. "Copy to Chat Screen" is covered by the script, not by a screenshot.

Other projects' code

none

Self-check

Run before the last commit (7 lines in control.rs); after it, the client was built again, rustfmt checked and the horizon-ctl run repeated.

pr_ready (tools/pr_ready.py --quick --base upstream/main on naza, against upstream/main at 183b53f0e, 3 min 20 s)

Check Result
Scope ✅ 10 files, +339 −25
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 531 passed (1 min 52 s)
rustfmt ✅ (12 s)
clippy ✅ (6 s)
tests: horizon-client, horizon-command ✅ 1768 passed (54 s)
doc tests ✅ 0 passed (4 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/6114 **Author:** [@4404c](https://github.com/4404c) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `secure-chat/confirm-command` --- ### 📝 Commits (2) - [`ad5de29`](https://github.com/horizon-rust/horizon/commit/ad5de29f1a67c1409098532af200bcab57091ef5) Clicked commands ask first, as sendUnattendedCommand does - [`38c0c6d`](https://github.com/horizon-rust/horizon/commit/38c0c6dbafbcfa630b348d968a2d0a6172714575) horizon-ctl: the command confirmation takes the keys ### 📊 Changes **11 files changed** (+346 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+18 -0) 📝 `crates/horizon-client/src/game/chat.rs` (+1 -2) 📝 `crates/horizon-client/src/game/control.rs` (+7 -0) 📝 `crates/horizon-client/src/game/net_harness.rs` (+20 -5) 📝 `crates/horizon-client/src/game/pad_menu.rs` (+1 -1) 📝 `crates/horizon-client/src/game/remote_chat.rs` (+194 -10) 📝 `crates/horizon-command/src/lib.rs` (+19 -0) 📝 `crates/horizon-command/src/network.rs` (+50 -0) 📝 `docs/microsoft-account.md` (+3 -1) 📝 `tools/port_map/client-002.tsv` (+5 -5) 📝 `tools/secure_chat_client_e2e.py` (+28 -1) </details> ### 📄 Description > 🤖 Opened by 4404c's AI agent (Claude Code, Opus 5.5), not by 4404c personally. ## What and why Fixes #6080. A command the player didn't type (a clicked chat line, a book, a dialog's button) went straight to the server. On a server that enforces secure chat, a clicked `/msg` was refused and the player wasn't told why. This ports `ClientPacketListener.sendUnattendedCommand`'s checks and confirmations: - no issue: it goes unsigned, as before; - a parse error, or a command only elevated permissions can run: `ConfirmScreen`, and Run Command sends it; - a message argument: never sent from there. The button puts it in the chat box, or copies it when a screen is open behind, so the player reads and sends it themselves. The tree parse now keeps the packet's restricted flag (`Node.restricted`), which `verifyCommand`'s second parse needs. The net harness learns `.click` and `.answer`, and `horizon-ctl key` stops at the open confirmation. Known differences, in the ledger: a clicked book or dialog is already closed when the confirmation opens, so answering no doesn't return to it (and the second button says Cancel, not Back); the chat box doesn't put a kept draft before the command. Keyboard focus on the buttons (Tab, arrows, Enter) isn't there, as in the link confirmation beside it. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference `ClientPacketListener.sendUnattendedCommand`, `verifyCommand`, `isValidCommand`, `openSendConfirmationWindow`, `openCommandSendConfirmationWindow`, `openSignedCommandSendConfirmationWindow` (read with `tools/rea_vanilla.py`). Harness: `tools/secure_chat_client_e2e.py` against vanilla 26.3's server on Windows, passing online and offline. It now clicks commands: `list` goes without asking; an unknown command asks and reaches the server on yes; `stop` asks for permissions online (the script makes the player an op there; offline it's a parse error) and doesn't run on no; `msg` asks, ends up in the chat box and never reaches the server. Also driven through `horizon-ctl` in a scratch single player world, with screenshots: a click on a chat line opens it, and Escape, Back, Copy to Clipboard and Run Command each do what they should. Not tried with a physical mouse and keyboard. "Copy to Chat Screen" is covered by the script, not by a screenshot. ## Other projects' code none ## Self-check Run before the last commit (7 lines in `control.rs`); after it, the client was built again, rustfmt checked and the `horizon-ctl` run repeated. **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on naza, against upstream/main at 183b53f0e, 3 min 20 s) | Check | Result | | --- | --- | | Scope | ✅ 10 files, +339 −25 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 531 passed (1 min 52 s) | | rustfmt | ✅ (12 s) | | clippy | ✅ (6 s) | | tests: horizon-client, horizon-command | ✅ 1768 passed (54 s) | | doc tests | ✅ 0 passed (4 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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-03 06:24:30 +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#6658
No description provided.