[PR #4691] [CLOSED] Game: renew a refused session through the launcher, and Sign in again #5781

Closed
opened 2026-11-03 05:14:57 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4691
Author: @martipops
Created: 10/30/2026
Status: ❌ Closed

Base: main ← Head: feature/game-session-renewal


📝 Commits (10+)

  • 6e1ac28 Add launcher-owned account status and forced session renewal
  • f0a0674 Show account status and refresh actions in the launcher
  • 501c9ab Handle completed sign-in only once while polling the launcher
  • 3fab32c Give launcher account states semantic colors and icons
  • 0dab146 Show profile heads, auth progress, and targeted re-sign-in in the launcher
  • dc6d372 Let a running game renew its session through the launcher CLI
  • af5ac52 Launcher auth: answer review nits
  • 134b6f1 Merge upstream main into launcher auth status
  • 05bd452 Renew a refused session through the launcher and offer Sign in again
  • 6f31083 Only run the launcher and read sessions the game can trust

📊 Changes

27 files changed (+2292 additions, -98 deletions)

View changed files

📝 crates/horizon-client-render/src/auth.rs (+257 -1)
📝 crates/horizon-client/src/game/remote.rs (+3 -0)
📝 crates/horizon-client/src/multiplayer.rs (+94 -2)
📝 crates/horizon-client/src/net.rs (+27 -1)
📝 crates/horizon-client/src/reconnect.rs (+1 -0)
📝 docs/launcher-commands.md (+22 -0)
📝 docs/microsoft-account.md (+61 -0)
📝 launcher/lang/de.json (+27 -2)
📝 launcher/lang/es.json (+27 -2)
📝 launcher/lang/fr.json (+27 -2)
📝 launcher/lang/pl.json (+27 -2)
📝 launcher/lang/ru.json (+27 -2)
📝 launcher/lang/uk.json (+27 -2)
📝 launcher/lang/zh.json (+27 -2)
📝 launcher/src/account.rs (+155 -16)
➕ launcher/src/account/session.rs (+320 -0)
📝 launcher/src/account/tests.rs (+329 -0)
📝 launcher/src/backend.rs (+9 -0)
📝 launcher/src/cli.rs (+65 -3)
📝 launcher/src/cli_tools.rs (+12 -3)

...and 7 more files

📄 Description

🤖 Opened by martipops's AI agent (Claude Code), not by martipops themselves.

Stacked on #4250. Until that merges, this diff includes its commits; the two new ones are
"Renew a refused session through the launcher and offer Sign in again", "Only run the launcher
and read sessions the game can trust" and "Log a session renewal and a needed sign-in".

Suggested label: feature

What and why

A game started from the launcher holds the session it was given at launch. When that token
expires during a long session, online-mode servers refuse the join ("Invalid session"), and the
player had to quit and relaunch. Now:

  • When the session service refuses the game's token while joining, the game asks the launcher
    that started it (HORIZON_LAUNCHER_EXE, account session <uuid> from #4250) for a renewed
    session, keeps it per account for later joins (splitscreen players' accounts too) and retries
    the join once.
  • When the launcher says the account needs a browser sign-in, the Disconnected screen says so and
    offers Sign in again. That runs account sign-in --for <uuid>, which refuses any other
    Microsoft account, opens the sign-in page and shows the code in the game.
  • The token never leaves the launcher except as the usual read-once session file.

Trust

HORIZON_LAUNCHER_EXE comes from the environment (raised in #4250's review). The game only runs
an absolute path to a file named horizon-launcher, and only reads (and deletes) a session file
inside its own sessions folder, so a bad answer can't point it at another file.

Validation

pr_ready (tools/pr_ready.py --quick --base upstream/main on Mac, against upstream/main at dc35e7817, 5 min 52 s)

Check Result
Scope ⚠️ 27 files, +2296 −98; 2270 lines of code: over 500, split it if it can ship in parts; mixes game, launcher
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 481 passed (22 s)
rustfmt ✅ (3 s)
clippy ✅ (56 s)
tests: horizon-client, horizon-client-render ✅ 1772 passed (3 min 26 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅
launcher clippy ✅ (30 s)
launcher tests ✅ 316 passed (28 s)
Parity ➖ 65 affected, to run in CI (--quick): arrow, block_entity_tickers, block_removal, block_tint, block_transformer, cauldron, chest_pair, command_exec, composter, container_title, crafter, cursor_death and 53 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Scope counts #4250's commits too; this PR's own three commits are about 440 lines.

  • tools/test_online_mode_parity.py, against vanilla 26.3's online-mode server and Horizon's:
    a refused token the launcher renews joins on the second try (join refused, join accepted,
    verified); a launcher that answers "sign in required" gives the Sign in again message after
    one refused join.
    python3 tools/parity.py online_mode: PASS, 51 of 51 checks (63 s).
  • auth::tests: renewal, sign-in-required, no launcher, a session file outside the sessions
    folder (neither read nor deleted), and the launcher path check.
  • Real account, macOS: an instance wrapper replaced the launcher's access token with a junk one
    before the game started. Joining an online-mode server showed "Renewing your session...", the
    launcher renewed through Microsoft, and the join went through. The log said "the launcher
    renewed the refused session".
  • Not run: Windows, and the Sign in again path with a real revoked sign-in.

🤖 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/4691 **Author:** [@martipops](https://github.com/martipops) **Created:** 10/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feature/game-session-renewal` --- ### 📝 Commits (10+) - [`6e1ac28`](https://github.com/horizon-rust/horizon/commit/6e1ac28831c185526e23b18fdaa93c3e43fecd25) Add launcher-owned account status and forced session renewal - [`f0a0674`](https://github.com/horizon-rust/horizon/commit/f0a06742eae0d65939f5332118bbb0358673c6c3) Show account status and refresh actions in the launcher - [`501c9ab`](https://github.com/horizon-rust/horizon/commit/501c9abbfec6b57e8c918b7b68516179902ad799) Handle completed sign-in only once while polling the launcher - [`3fab32c`](https://github.com/horizon-rust/horizon/commit/3fab32c08a78c774f5ee18dbcce1a5b93f74da2a) Give launcher account states semantic colors and icons - [`0dab146`](https://github.com/horizon-rust/horizon/commit/0dab1469acb99459a799d4d26eaf908901bfb3db) Show profile heads, auth progress, and targeted re-sign-in in the launcher - [`dc6d372`](https://github.com/horizon-rust/horizon/commit/dc6d372db87cb8f7731ad32a39fc6dcbcc10e308) Let a running game renew its session through the launcher CLI - [`af5ac52`](https://github.com/horizon-rust/horizon/commit/af5ac52ace26ba8ff6fd5cee788064833784a9fd) Launcher auth: answer review nits - [`134b6f1`](https://github.com/horizon-rust/horizon/commit/134b6f1a4221250c4fa5d9bab3150d393021bf3f) Merge upstream main into launcher auth status - [`05bd452`](https://github.com/horizon-rust/horizon/commit/05bd452e8ac1f5fb6a7479fc2f5d184bf90d56d6) Renew a refused session through the launcher and offer Sign in again - [`6f31083`](https://github.com/horizon-rust/horizon/commit/6f31083376c30ec8c4e355d94ce530ea5941de1e) Only run the launcher and read sessions the game can trust ### 📊 Changes **27 files changed** (+2292 additions, -98 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/auth.rs` (+257 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+3 -0) 📝 `crates/horizon-client/src/multiplayer.rs` (+94 -2) 📝 `crates/horizon-client/src/net.rs` (+27 -1) 📝 `crates/horizon-client/src/reconnect.rs` (+1 -0) 📝 `docs/launcher-commands.md` (+22 -0) 📝 `docs/microsoft-account.md` (+61 -0) 📝 `launcher/lang/de.json` (+27 -2) 📝 `launcher/lang/es.json` (+27 -2) 📝 `launcher/lang/fr.json` (+27 -2) 📝 `launcher/lang/pl.json` (+27 -2) 📝 `launcher/lang/ru.json` (+27 -2) 📝 `launcher/lang/uk.json` (+27 -2) 📝 `launcher/lang/zh.json` (+27 -2) 📝 `launcher/src/account.rs` (+155 -16) ➕ `launcher/src/account/session.rs` (+320 -0) 📝 `launcher/src/account/tests.rs` (+329 -0) 📝 `launcher/src/backend.rs` (+9 -0) 📝 `launcher/src/cli.rs` (+65 -3) 📝 `launcher/src/cli_tools.rs` (+12 -3) _...and 7 more files_ </details> ### 📄 Description > 🤖 Opened by martipops's AI agent (Claude Code), not by martipops themselves. **Stacked on #4250.** Until that merges, this diff includes its commits; the two new ones are "Renew a refused session through the launcher and offer Sign in again", "Only run the launcher and read sessions the game can trust" and "Log a session renewal and a needed sign-in". **Suggested label:** `feature` ## What and why A game started from the launcher holds the session it was given at launch. When that token expires during a long session, online-mode servers refuse the join ("Invalid session"), and the player had to quit and relaunch. Now: - When the session service refuses the game's token while joining, the game asks the launcher that started it (`HORIZON_LAUNCHER_EXE`, `account session <uuid>` from #4250) for a renewed session, keeps it per account for later joins (splitscreen players' accounts too) and retries the join once. - When the launcher says the account needs a browser sign-in, the Disconnected screen says so and offers **Sign in again**. That runs `account sign-in --for <uuid>`, which refuses any other Microsoft account, opens the sign-in page and shows the code in the game. - The token never leaves the launcher except as the usual read-once session file. ## Trust `HORIZON_LAUNCHER_EXE` comes from the environment (raised in #4250's review). The game only runs an absolute path to a file named `horizon-launcher`, and only reads (and deletes) a session file inside its own `sessions` folder, so a bad answer can't point it at another file. ## Validation **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on Mac, against upstream/main at dc35e7817, 5 min 52 s) | Check | Result | | --- | --- | | Scope | ⚠️ 27 files, +2296 −98; 2270 lines of code: over 500, split it if it can ship in parts; mixes game, launcher | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 481 passed (22 s) | | rustfmt | ✅ (3 s) | | clippy | ✅ (56 s) | | tests: horizon-client, horizon-client-render | ✅ 1772 passed (3 min 26 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ | | launcher clippy | ✅ (30 s) | | launcher tests | ✅ 316 passed (28 s) | | Parity | ➖ 65 affected, to run in CI (--quick): arrow, block_entity_tickers, block_removal, block_tint, block_transformer, cauldron, chest_pair, command_exec, composter, container_title, crafter, cursor_death and 53 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Scope counts #4250's commits too; this PR's own three commits are about 440 lines. - `tools/test_online_mode_parity.py`, against vanilla 26.3's online-mode server and Horizon's: a refused token the launcher renews joins on the second try (join refused, join accepted, verified); a launcher that answers "sign in required" gives the Sign in again message after one refused join. `python3 tools/parity.py online_mode`: PASS, 51 of 51 checks (63 s). - `auth::tests`: renewal, sign-in-required, no launcher, a session file outside the sessions folder (neither read nor deleted), and the launcher path check. - Real account, macOS: an instance wrapper replaced the launcher's access token with a junk one before the game started. Joining an online-mode server showed "Renewing your session...", the launcher renewed through Microsoft, and the join went through. The log said "the launcher renewed the refused session". - Not run: Windows, and the Sign in again path with a real revoked sign-in. 🤖 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 05:14:57 +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#5781
No description provided.