[PR #98] [MERGED] Logs and crash reports: game, launcher, CLI and MCP #2325

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

📋 Pull Request Information

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

Base: main ← Head: feat/logs-crash-reports


📝 Commits (3)

  • 1569572 Game logs and crash reports; launcher crash notice; logs in the CLIs and MCP
  • 744b61e Crash stacks start at the panicking frame, without the build machine's paths; multi-line log messages as log4j writes them
  • 66c6bd6 F3 + C writes a crash report

📊 Changes

38 files changed (+1844 additions, -100 deletions)

View changed files

📝 Cargo.lock (+38 -0)
📝 crates/horizon-client/Cargo.toml (+3 -0)
📝 crates/horizon-client/src/audio.rs (+3 -3)
📝 crates/horizon-client/src/bin/horizon-ctl/commands.rs (+5 -0)
📝 crates/horizon-client/src/bin/horizon-ctl/launch.rs (+1 -30)
📝 crates/horizon-client/src/bin/horizon-ctl/main.rs (+104 -0)
📝 crates/horizon-client/src/bin/horizon-ctl/mcp.rs (+16 -0)
📝 crates/horizon-client/src/chat.rs (+2 -0)
➕ crates/horizon-client/src/crash.rs (+614 -0)
📝 crates/horizon-client/src/game.rs (+25 -21)
📝 crates/horizon-client/src/game/backdrop.rs (+1 -1)
📝 crates/horizon-client/src/game/debug_keys.rs (+3 -5)
📝 crates/horizon-client/src/game/dedicated.rs (+6 -0)
📝 crates/horizon-client/src/game/functions.rs (+1 -1)
📝 crates/horizon-client/src/game/growth.rs (+3 -3)
📝 crates/horizon-client/src/game/packs.rs (+2 -2)
📝 crates/horizon-client/src/game/persist.rs (+1 -1)
📝 crates/horizon-client/src/game/remote.rs (+6 -4)
📝 crates/horizon-client/src/gfx.rs (+11 -2)
📝 crates/horizon-client/src/lan/hub.rs (+1 -1)

...and 18 more files

📄 Description

What changed

Game logs, like vanilla's. The game writes logs/latest.log in its home (HORIZON_HOME, else the platform data folder horizon; the dedicated server in its own folder, as vanilla's does). The format and rotation follow 26.3's log4j config (client-1.21.2.xml from the version manifest): [HH:mm:ss] [thread/LEVEL]: message, rolled over at start when non-empty and when the day changes to logs/<yyyy-mm-dd>-<n>.log.gz, dated by the old file's last write, seven a day (DefaultRolloverStrategy, newest = highest index). Every eprintln! in the game now goes through the log facade (new logging module) and still prints the same text on stderr. Chat lines are logged as [CHAT] …. A second game in the same folder logs to stderr only (a logs/.lock file: Windows locks are mandatory, so latest.log itself stays readable). Other crates only reach the file at ERROR (the Vulkan loader's WARN chatter stays out).

Crash reports. A main-thread panic (hook) or an error returned from main writes crash-reports/crash-<yyyy-mm-dd_HH.MM.SS>-client.txt laid out like vanilla's CrashReport: comment, time, description, error, stack (std::backtrace forced on, trimmed to start at the panicking frame, build-machine paths removed), -- Head --, then -- System Details --: Horizon version (release tag when run from a launcher install), Minecraft 26.3, OS + version, CPU, memory, GPU adapter (wgpu AdapterInfo: name, backend, type, driver), render settings, resource packs, world or server, and the last 50 log lines. The path is printed on stderr; the game exits non-zero (101 for a panic, 1 for an error). Panics on other threads are logged like vanilla's uncaught-exception handler. F3 + C held ten seconds (vanilla's debug crash, from #90) now ends the game with a real report, described "Manually triggered debug crash" with the stack where it was raised (the world is saved first, as before); the game keeps the error that ends it as an error rather than a string so main can tell. Debug builds also crash on purpose with HORIZON_DEBUG_CRASH=SECONDS (ignored in release builds).

Launcher. When the game it started exits non-zero, or a crash report appears during that run, the Play page shows Horizon crashed with the error, the report path, and Open report, Copy report, Open logs folder, Report on Discord (links.json's invite) with a line asking to attach the report, plus Dismiss. Settings gets a Logs row with Open.

CLI and MCP (read-only). horizon-launcher logs [--lines N] [--crash] [--json] and the launcher MCP tool logs; horizon-ctl logs [--lines N] [--crash] (local, no game needed) and its MCP tool logs. Default 100 lines; --crash gives the newest report. horizon-ctl now shares game_home()/data_dir() with the game.

Docs: launcher README (commands, tools, a "Logs and crash reports" section) and docs/native-client.md. Nothing is sent anywhere.

Screenshots

On ludodesktop (vscreen, lavapipe), in /home/ludovic/code/horizon-parity/screenshots/logs-crash-reports/:

  • launcher-crash-notice.png: the notice after the debug crash
  • launcher-copied.png: after Copy report (the clipboard held the report: checked with wl-paste)
  • launcher-settings-logs.png: the Logs row
  • example-crash-report.txt: a real report from the end-to-end run (HORIZON_DEBUG_CRASH panic)
  • f3c-warning.png, example-f3c-crash-report.txt: F3 + C held through horizon-ctl in a world, the countdown, and its report

How tested

  • Unit tests: rollover naming and the 8th-archive shift, log line format, startup archiving and the second-instance lock (logging); report layout, file name, a real panic through a hook, stack trimming and path shortening (crash); horizon-ctl logs (tail, --lines, errors, --crash); launcher crash-report lookup / summary / tail, and an integration test running horizon-launcher logs (text, --json, --crash).
  • cargo test -p horizon-client on the Mac mini, after merging main: all pass (396 lib, 22 game, 15 horizon-ctl, integration). Launcher cargo test: all pass.
  • cargo fmt, cargo clippy --all-targets -D warnings (game and launcher), python tools/check_public_tree.py.
  • End to end on Linux (HORIZON_NO_AUDIO=1, scratch dir, HORIZON_HOME in /tmp, vscreen): the game started directly with HORIZON_DEBUG_CRASH exits 101 and writes the report; a second run archives the first log as 2026-10-14-1.log.gz, a third as -2; a --frames 30 run exits 0 with no report. F3 + C held (horizon-ctl key F3 down, key c down) in a new world: the countdown, then exit 1 and a "Manually triggered debug crash" report with World: E2E (saves/E2E). The launcher (debug build, a fake install of the debug game in HORIZON_LAUNCHER_HOME) started the game, which crashed; the notice appeared with the report's error, Copy report filled the clipboard. horizon-launcher logs, logs --crash, horizon-ctl logs, both MCP logs tools returned the files' content.

Note: the launcher only creates a window on vscreen with Mesa's lavapipe (VK_DRIVER_FILES=…/lvp_icd.x86_64.json); without it gpui fails with PlatformNotSupported on the headless compositor (unrelated to this change).

🤖 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/98 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/logs-crash-reports` --- ### 📝 Commits (3) - [`1569572`](https://github.com/horizon-rust/horizon/commit/1569572ba0e2148417e43e0675b40a14308799ef) Game logs and crash reports; launcher crash notice; logs in the CLIs and MCP - [`744b61e`](https://github.com/horizon-rust/horizon/commit/744b61efc36f7d0aff90b4058e25982d58111a8c) Crash stacks start at the panicking frame, without the build machine's paths; multi-line log messages as log4j writes them - [`66c6bd6`](https://github.com/horizon-rust/horizon/commit/66c6bd6b13e7e041045d63053d36bd4052598c73) F3 + C writes a crash report ### 📊 Changes **38 files changed** (+1844 additions, -100 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+38 -0) 📝 `crates/horizon-client/Cargo.toml` (+3 -0) 📝 `crates/horizon-client/src/audio.rs` (+3 -3) 📝 `crates/horizon-client/src/bin/horizon-ctl/commands.rs` (+5 -0) 📝 `crates/horizon-client/src/bin/horizon-ctl/launch.rs` (+1 -30) 📝 `crates/horizon-client/src/bin/horizon-ctl/main.rs` (+104 -0) 📝 `crates/horizon-client/src/bin/horizon-ctl/mcp.rs` (+16 -0) 📝 `crates/horizon-client/src/chat.rs` (+2 -0) ➕ `crates/horizon-client/src/crash.rs` (+614 -0) 📝 `crates/horizon-client/src/game.rs` (+25 -21) 📝 `crates/horizon-client/src/game/backdrop.rs` (+1 -1) 📝 `crates/horizon-client/src/game/debug_keys.rs` (+3 -5) 📝 `crates/horizon-client/src/game/dedicated.rs` (+6 -0) 📝 `crates/horizon-client/src/game/functions.rs` (+1 -1) 📝 `crates/horizon-client/src/game/growth.rs` (+3 -3) 📝 `crates/horizon-client/src/game/packs.rs` (+2 -2) 📝 `crates/horizon-client/src/game/persist.rs` (+1 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+6 -4) 📝 `crates/horizon-client/src/gfx.rs` (+11 -2) 📝 `crates/horizon-client/src/lan/hub.rs` (+1 -1) _...and 18 more files_ </details> ### 📄 Description ## What changed **Game logs, like vanilla's.** The game writes `logs/latest.log` in its home (`HORIZON_HOME`, else the platform data folder `horizon`; the dedicated server in its own folder, as vanilla's does). The format and rotation follow 26.3's log4j config (`client-1.21.2.xml` from the version manifest): `[HH:mm:ss] [thread/LEVEL]: message`, rolled over at start when non-empty and when the day changes to `logs/<yyyy-mm-dd>-<n>.log.gz`, dated by the old file's last write, seven a day (DefaultRolloverStrategy, newest = highest index). Every `eprintln!` in the game now goes through the `log` facade (new `logging` module) and still prints the same text on stderr. Chat lines are logged as `[CHAT] …`. A second game in the same folder logs to stderr only (a `logs/.lock` file: Windows locks are mandatory, so latest.log itself stays readable). Other crates only reach the file at ERROR (the Vulkan loader's WARN chatter stays out). **Crash reports.** A main-thread panic (hook) or an error returned from `main` writes `crash-reports/crash-<yyyy-mm-dd_HH.MM.SS>-client.txt` laid out like vanilla's CrashReport: comment, time, description, error, stack (`std::backtrace` forced on, trimmed to start at the panicking frame, build-machine paths removed), `-- Head --`, then `-- System Details --`: Horizon version (release tag when run from a launcher install), Minecraft 26.3, OS + version, CPU, memory, GPU adapter (wgpu AdapterInfo: name, backend, type, driver), render settings, resource packs, world or server, and the last 50 log lines. The path is printed on stderr; the game exits non-zero (101 for a panic, 1 for an error). Panics on other threads are logged like vanilla's uncaught-exception handler. F3 + C held ten seconds (vanilla's debug crash, from #90) now ends the game with a real report, described "Manually triggered debug crash" with the stack where it was raised (the world is saved first, as before); the game keeps the error that ends it as an error rather than a string so main can tell. Debug builds also crash on purpose with `HORIZON_DEBUG_CRASH=SECONDS` (ignored in release builds). **Launcher.** When the game it started exits non-zero, or a crash report appears during that run, the Play page shows **Horizon crashed** with the error, the report path, and *Open report*, *Copy report*, *Open logs folder*, *Report on Discord* (links.json's invite) with a line asking to attach the report, plus *Dismiss*. Settings gets a **Logs** row with *Open*. **CLI and MCP (read-only).** `horizon-launcher logs [--lines N] [--crash] [--json]` and the launcher MCP tool `logs`; `horizon-ctl logs [--lines N] [--crash]` (local, no game needed) and its MCP tool `logs`. Default 100 lines; `--crash` gives the newest report. horizon-ctl now shares `game_home()`/`data_dir()` with the game. Docs: launcher README (commands, tools, a "Logs and crash reports" section) and docs/native-client.md. Nothing is sent anywhere. ## Screenshots On ludodesktop (vscreen, lavapipe), in `/home/ludovic/code/horizon-parity/screenshots/logs-crash-reports/`: - `launcher-crash-notice.png`: the notice after the debug crash - `launcher-copied.png`: after Copy report (the clipboard held the report: checked with wl-paste) - `launcher-settings-logs.png`: the Logs row - `example-crash-report.txt`: a real report from the end-to-end run (HORIZON_DEBUG_CRASH panic) - `f3c-warning.png`, `example-f3c-crash-report.txt`: F3 + C held through horizon-ctl in a world, the countdown, and its report ## How tested - Unit tests: rollover naming and the 8th-archive shift, log line format, startup archiving and the second-instance lock (`logging`); report layout, file name, a real panic through a hook, stack trimming and path shortening (`crash`); `horizon-ctl logs` (tail, `--lines`, errors, `--crash`); launcher crash-report lookup / summary / tail, and an integration test running `horizon-launcher logs` (text, `--json`, `--crash`). - `cargo test -p horizon-client` on the Mac mini, after merging main: all pass (396 lib, 22 game, 15 horizon-ctl, integration). Launcher `cargo test`: all pass. - `cargo fmt`, `cargo clippy --all-targets -D warnings` (game and launcher), `python tools/check_public_tree.py`. - End to end on Linux (HORIZON_NO_AUDIO=1, scratch dir, HORIZON_HOME in /tmp, vscreen): the game started directly with `HORIZON_DEBUG_CRASH` exits 101 and writes the report; a second run archives the first log as `2026-10-14-1.log.gz`, a third as `-2`; a `--frames 30` run exits 0 with no report. F3 + C held (horizon-ctl `key F3 down`, `key c down`) in a new world: the countdown, then exit 1 and a "Manually triggered debug crash" report with `World: E2E (saves/E2E)`. The launcher (debug build, a fake install of the debug game in HORIZON_LAUNCHER_HOME) started the game, which crashed; the notice appeared with the report's error, Copy report filled the clipboard. `horizon-launcher logs`, `logs --crash`, `horizon-ctl logs`, both MCP `logs` tools returned the files' content. Note: the launcher only creates a window on vscreen with Mesa's lavapipe (`VK_DRIVER_FILES=…/lvp_icd.x86_64.json`); without it gpui fails with PlatformNotSupported on the headless compositor (unrelated to this change). 🤖 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:54:58 +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#2325
No description provided.