fix(host): a game started by longshot-builder play writes its own longshot_log.txt (LONGSHOT_OWN_LOG) #2741

Merged
HumanBean merged 4 commits from Jiro113/Longshot:fix/launcher-game-log-file into main 2026-11-28 19:54:08 +00:00
Contributor

Summary

A game started by the launcher writes no diagnostics/logs/longshot_log.txt, so the Insert menu's Bug report has no
log, the crash window names the launcher's file and players have nothing to send. Since
#2688 (nightly-854 and later) longshot-builder play --output json
gives the game its JSON relay's pipe as stderr (from the launcher's Windows shortcut, --output user, the launcher's
temporary file), and host/hos_main.c only opened its own log when the game had no stderr (or Steam's Gaming-mode pipe,
#1322). On main: start the game from the launcher (or
longshot-builder play --profile <p> --output json read by a program), and the game folder's diagnostics/logs/ stays
empty.

This PR makes the builder say so, and the game write its own log again:

  • longshot-builder play gives the game LONGSHOT_OWN_LOG=1 (build_driver::play::OWN_LOG_VAR) under --output json,
    and under --output user asked while its own stderr is not a terminal (the launcher's shortcut):
    output::own_log in builder/crates/longshot-builder/src/output.rs. Nothing changes for a terminal, --output text,
    RecompLauncher or a start with no --output.
  • host/log_gate.h holds the one rule: no stderr, or LONGSHOT_OWN_LOG=1 (never in a --prepare-shaders step, whose
    pipe the builder reads), or Steam's pipe on Linux as before. host/hos_main.c reads the variable once, beside
    hos_relaunch_keep_env and before longshot_env.txt (a line there sets it with no effect).
  • host/hos_relaunch.c: Restart now keeps the handles (Windows) or stderr (Linux) by the same rule, so the restarted
    game opens its log again instead of writing into a relay nobody reads.
  • host/hos_crash_record.c: the log path the game opened wins over its stderr's, so the crash record names the run's
    log, not launcher-output.tmp. If the log cannot be opened, the record uses the retained stderr's path.
  • gpu/vk/switches.def and docs/dev/reference/switches.md get the variable's row; a build-driver test checks that the
    name play gives is the one host/log_gate.h reads.

Read first: host/log_gate.h, the gate in host/hos_main.c, hos_relaunch_keep_env in host/hos_relaunch.c,
output::own_log and its use in play.rs's run_with.

The start-up screen is unchanged: startup_progress and game_ready come on the game's stdout
(host/launcher_startup.h), which stays the relay's (play/json_output.rs). The game's stderr lines reach the relay
only until its log opens.

Prior work: none found (longshot_log, json_output, game_output, FILE_TYPE_UNKNOWN, "no log", "longshot_log.txt
missing"; Longshot and LongshotLauncher; Hookshot's API answered HTTP 521 on 2026-11-28).

Testing

Tested: Windows 11 (26300), RTX 4090, driver 621.24, this branch as a pack over main 22d0d2009's base (game built
from this head's code). The game started the way play --output json starts it (stdout and stderr pipes read by a
program, LONGSHOT_OWN_LOG=1), then Restart now through the control bridge's relaunch, then quit:

  • without the variable (main's behaviour): 154 KB of log over the pipe, no longshot_log.txt;
  • with it: nothing over the pipe, diagnostics/logs/longshot_log.txt written, the user name absent; Restart now moved
    it to .1 and the restarted game wrote its own; five starts kept .1 to .4;
  • stderr a file (the shortcut's case) with the variable: the file stays empty, the log is written and rotates the same;
  • --prepare-shaders with the variable: its 616 stderr lines still reach the pipe, the log is not rotated;
  • a crash on purpose at the start (HOS_CRASH_TEST=start), over the pipe and over the shortcut's file: the CRASH:
    lines and the host backtrace are in longshot_log.txt, the crash record names longshot_log.txt, nothing reached
    the pipe or the file;
  • a run killed mid-game: its diagnostics/bug-reports/running/ marker names diagnostics/logs/longshot_log.txt;
  • with LONGSHOT_LAUNCHER_STARTUP=1 too (the start-up screen's stream): startup_progress and game_ready still
    reach the stdout pipe, nothing reaches the stderr pipe, and the log is written and rotates.

The variable was set by the test program in these runs, not by longshot-builder play itself: the builder's side is
covered by output::own_log's unit test and the name test, and by the launcher run in Still to test.

Checks: tests/test_log_open_failure.py (the relay's pipe, the shortcut's file, --prepare-shaders),
tests/test_restart_log.py (Restart now under the relay, and Steam's pipe), tests/test_crash_record.py (a game
writing its own log over a stderr file names its own log), all failing on main and passing here; the added crash-record
case for a log that cannot be opened is pending; cargo test -p build-driver -p longshot-builder own_log; tests/run_all.py --changed origin/main on Linux and Windows, and
mise run test on Linux and Windows (no failure of its own here: see the checklist). Failures that also fail on main with the same messages, unchanged here:
test_switch_table (LONGSHOT_LAUNCHER_STARTUP has no row), test_crash_record (its source checks trip on
host/posix/display_sdl.c since #2683; the new case was run with
that check lifted and passes), test_bug_report; on Linux (that --changed run, in WSL outside the CI image; the CI
image's whole-suite run is in the checklist) also test_hud_layout_row, test_guest_holes,
test_pipeline_tour; on Windows also test_builder_channel, test_dev_ab, test_input_movie, and eight Windows path
assertions in cargo test -p longshot-builder.

Still to test:

  • The launcher on Windows (window and shortcut starts), with a builder of this branch: start the game, expecting
    diagnostics/logs/longshot_log.txt,
    the Insert menu's Bug report with that log, Restart now rotating it, and the crash window naming it (by hand, with a
    launcher of this build).
  • Linux, Desktop and Steam's Gaming mode: the same, and Restart now, expecting the log written and rotated
    (@Beanstalk start the game through longshot-builder play --output json on Linux and check diagnostics/logs/longshot_log.txt).
  • The Test Farm: whether Beanstalk reads the game's lines from the relay; they now stop once the log opens (a question
    for the Test Farm's maintainer).

Measurements

Nothing to measure: where the log is written, once at start; no per-frame work.

Risks

  • A tool that read the game's stderr through play --output json gets only the lines before the log opens; the lines
    are in the game's log. The launcher's own launch log (last-launch.log) loses them the same way. LONGSHOT_OWN_LOG
    is read once at start, so a tool that wants the old stream can't turn it back on from longshot_env.txt; a revert is
    enough.
  • The launcher's shortcut: when the builder ends in failure without a crash, the launcher shows the last line of its
    temporary file, which no longer comes from the game after its log opens.
  • Linux, Steam's Gaming mode: Restart now now rotates the log too, as a start from the icon does
    (#1374), instead of writing on in the run before's.
  • The tests don't catch a builder that stops passing the variable (env.push removed) or reads the terminal on stdout
    instead of stderr: the launcher test above does.
  • Nothing changes after updating: no setting, save or cache.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). In the CI's own image, built locally
    from scripts/linux/checks.Dockerfile, run_all.py --strict on the whole suite gave 807 passed, 71 failed and
    10 skipped. That run had no network and no prebuilt longshot-builder, so cargo could not fetch crates and most of
    the 71 timed out. The 71 then ran again as the CI's tests job runs them: with the network,
    longshot-builder built first (debug and release) and --timeout 1200. 56 passed and 15 failed here. The same 15
    fail on main (22d0d2009), with the same errors: test_bug_report, test_control_picture,
    test_crash_record, test_framegen_hdr, test_framegen_resources, test_guest_holes, test_input_background,
    test_lifter (fmt --all --check), test_perf_send, test_pipeline_tour, test_present_source_crop,
    test_screensaver, test_switch_table (LONGSHOT_LAUNCHER_STARTUP has no row), test_temporal_present_bandwidth
    and test_xinput_thread. test_crash_record stops at main's source check on posix/display_sdl.c before it
    reaches the case this PR adds. That case passes once that check is lifted (Testing). On Windows (llvm-mingw),
    812 passed and 29 failed here, against 811 and 30 on main, and every failure here also fails on main. The 29
    are 12 of the 15 above (all but test_guest_holes, test_input_background and test_pipeline_tour), plus
    test_auto_handheld, test_builder_channel, test_coverage_run, test_dev_ab, test_dev_build,
    test_dev_migrate, test_fsr3fi_hud_layer, test_fsr3fi_hudless_colour, test_fsr4_tune,
    test_game_menu_mouse_buttons, test_input_movie, test_job_queue, test_oot_menu_mouse,
    test_pads_after_menu, test_parity_gates, test_run_all_mingw and test_sampler_admission. Main's extra
    failure, byte_compile_tracked, came from running it in a git archive with no .git.
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
    (LONGSHOT_OWN_LOG, unset by default. It is no player's knob: longshot-builder play sets it for the game it
    starts. Its row is in gpu/vk/switches.def and docs/dev/reference/switches.md; nothing to measure, as
    Measurements says.)
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. Windows: built with llvm-mingw and run in
    the game (Testing). Linux: scripts/check_host_compile.py ran for Linux in the CI image, with the commands of a
    player's build. Its headers came from tools.lock's linux-x64 CPM cache and FFmpeg from Ubuntu's packages: 116
    host units, 0 failed, hos_main.c, hos_relaunch.c and hos_crash_record.c among them. That is a syntax-only
    compile, not a link. test_utf8_paths passes.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary A game started by the launcher writes no `diagnostics/logs/longshot_log.txt`, so the Insert menu's Bug report has no log, the crash window names the launcher's file and players have nothing to send. Since https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2688 (nightly-854 and later) `longshot-builder play --output json` gives the game its JSON relay's pipe as stderr (from the launcher's Windows shortcut, `--output user`, the launcher's temporary file), and `host/hos_main.c` only opened its own log when the game had no stderr (or Steam's Gaming-mode pipe, https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1322). On main: start the game from the launcher (or `longshot-builder play --profile <p> --output json` read by a program), and the game folder's `diagnostics/logs/` stays empty. This PR makes the builder say so, and the game write its own log again: - `longshot-builder play` gives the game `LONGSHOT_OWN_LOG=1` (`build_driver::play::OWN_LOG_VAR`) under `--output json`, and under `--output user` asked while its own stderr is not a terminal (the launcher's shortcut): `output::own_log` in `builder/crates/longshot-builder/src/output.rs`. Nothing changes for a terminal, `--output text`, RecompLauncher or a start with no `--output`. - `host/log_gate.h` holds the one rule: no stderr, or `LONGSHOT_OWN_LOG=1` (never in a `--prepare-shaders` step, whose pipe the builder reads), or Steam's pipe on Linux as before. `host/hos_main.c` reads the variable once, beside `hos_relaunch_keep_env` and before `longshot_env.txt` (a line there sets it with no effect). - `host/hos_relaunch.c`: Restart now keeps the handles (Windows) or stderr (Linux) by the same rule, so the restarted game opens its log again instead of writing into a relay nobody reads. - `host/hos_crash_record.c`: the log path the game opened wins over its stderr's, so the crash record names the run's log, not `launcher-output.tmp`. If the log cannot be opened, the record uses the retained stderr's path. - `gpu/vk/switches.def` and `docs/dev/reference/switches.md` get the variable's row; a build-driver test checks that the name `play` gives is the one `host/log_gate.h` reads. Read first: `host/log_gate.h`, the gate in `host/hos_main.c`, `hos_relaunch_keep_env` in `host/hos_relaunch.c`, `output::own_log` and its use in `play.rs`'s `run_with`. The start-up screen is unchanged: `startup_progress` and `game_ready` come on the game's stdout (`host/launcher_startup.h`), which stays the relay's (`play/json_output.rs`). The game's stderr lines reach the relay only until its log opens. Prior work: none found (`longshot_log`, `json_output`, `game_output`, `FILE_TYPE_UNKNOWN`, "no log", "longshot_log.txt missing"; Longshot and LongshotLauncher; Hookshot's API answered HTTP 521 on 2026-11-28). ## Testing **Tested:** Windows 11 (26300), RTX 4090, driver 621.24, this branch as a pack over main 22d0d2009's base (game built from this head's code). The game started the way `play --output json` starts it (stdout and stderr pipes read by a program, `LONGSHOT_OWN_LOG=1`), then Restart now through the control bridge's `relaunch`, then `quit`: - without the variable (main's behaviour): 154 KB of log over the pipe, no `longshot_log.txt`; - with it: nothing over the pipe, `diagnostics/logs/longshot_log.txt` written, the user name absent; Restart now moved it to `.1` and the restarted game wrote its own; five starts kept `.1` to `.4`; - stderr a file (the shortcut's case) with the variable: the file stays empty, the log is written and rotates the same; - `--prepare-shaders` with the variable: its 616 stderr lines still reach the pipe, the log is not rotated; - a crash on purpose at the start (`HOS_CRASH_TEST=start`), over the pipe and over the shortcut's file: the `CRASH:` lines and the host backtrace are in `longshot_log.txt`, the crash record names `longshot_log.txt`, nothing reached the pipe or the file; - a run killed mid-game: its `diagnostics/bug-reports/running/` marker names `diagnostics/logs/longshot_log.txt`; - with `LONGSHOT_LAUNCHER_STARTUP=1` too (the start-up screen's stream): `startup_progress` and `game_ready` still reach the stdout pipe, nothing reaches the stderr pipe, and the log is written and rotates. The variable was set by the test program in these runs, not by `longshot-builder play` itself: the builder's side is covered by `output::own_log`'s unit test and the name test, and by the launcher run in Still to test. Checks: `tests/test_log_open_failure.py` (the relay's pipe, the shortcut's file, `--prepare-shaders`), `tests/test_restart_log.py` (Restart now under the relay, and Steam's pipe), `tests/test_crash_record.py` (a game writing its own log over a stderr file names its own log), all failing on main and passing here; the added crash-record case for a log that cannot be opened is pending; `cargo test -p build-driver -p longshot-builder own_log`; `tests/run_all.py --changed origin/main` on Linux and Windows, and `mise run test` on Linux and Windows (no failure of its own here: see the checklist). Failures that also fail on main with the same messages, unchanged here: `test_switch_table` (`LONGSHOT_LAUNCHER_STARTUP` has no row), `test_crash_record` (its source checks trip on `host/posix/display_sdl.c` since https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2683; the new case was run with that check lifted and passes), `test_bug_report`; on Linux (that `--changed` run, in WSL outside the CI image; the CI image's whole-suite run is in the checklist) also `test_hud_layout_row`, `test_guest_holes`, `test_pipeline_tour`; on Windows also `test_builder_channel`, `test_dev_ab`, `test_input_movie`, and eight Windows path assertions in `cargo test -p longshot-builder`. **Still to test:** - The launcher on Windows (window and shortcut starts), with a builder of this branch: start the game, expecting `diagnostics/logs/longshot_log.txt`, the Insert menu's Bug report with that log, Restart now rotating it, and the crash window naming it (by hand, with a launcher of this build). - Linux, Desktop and Steam's Gaming mode: the same, and Restart now, expecting the log written and rotated (`@Beanstalk start the game through longshot-builder play --output json on Linux and check diagnostics/logs/longshot_log.txt`). - The Test Farm: whether Beanstalk reads the game's lines from the relay; they now stop once the log opens (a question for the Test Farm's maintainer). ## Measurements Nothing to measure: where the log is written, once at start; no per-frame work. ## Risks - A tool that read the game's stderr through `play --output json` gets only the lines before the log opens; the lines are in the game's log. The launcher's own launch log (`last-launch.log`) loses them the same way. `LONGSHOT_OWN_LOG` is read once at start, so a tool that wants the old stream can't turn it back on from `longshot_env.txt`; a revert is enough. - The launcher's shortcut: when the builder ends in failure without a crash, the launcher shows the last line of its temporary file, which no longer comes from the game after its log opens. - Linux, Steam's Gaming mode: Restart now now rotates the log too, as a start from the icon does (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1374), instead of writing on in the run before's. - The tests don't catch a builder that stops passing the variable (`env.push` removed) or reads the terminal on stdout instead of stderr: the launcher test above does. - Nothing changes after updating: no setting, save or cache. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). In the CI's own image, built locally from `scripts/linux/checks.Dockerfile`, `run_all.py --strict` on the whole suite gave 807 passed, 71 failed and 10 skipped. That run had no network and no prebuilt `longshot-builder`, so cargo could not fetch crates and most of the 71 timed out. The 71 then ran again as the CI's tests job runs them: with the network, `longshot-builder` built first (debug and release) and `--timeout 1200`. 56 passed and 15 failed here. The same 15 fail on `main` (`22d0d2009`), with the same errors: `test_bug_report`, `test_control_picture`, `test_crash_record`, `test_framegen_hdr`, `test_framegen_resources`, `test_guest_holes`, `test_input_background`, `test_lifter` (`fmt --all --check`), `test_perf_send`, `test_pipeline_tour`, `test_present_source_crop`, `test_screensaver`, `test_switch_table` (`LONGSHOT_LAUNCHER_STARTUP` has no row), `test_temporal_present_bandwidth` and `test_xinput_thread`. `test_crash_record` stops at main's source check on `posix/display_sdl.c` before it reaches the case this PR adds. That case passes once that check is lifted (Testing). On Windows (llvm-mingw), 812 passed and 29 failed here, against 811 and 30 on `main`, and every failure here also fails on `main`. The 29 are 12 of the 15 above (all but `test_guest_holes`, `test_input_background` and `test_pipeline_tour`), plus `test_auto_handheld`, `test_builder_channel`, `test_coverage_run`, `test_dev_ab`, `test_dev_build`, `test_dev_migrate`, `test_fsr3fi_hud_layer`, `test_fsr3fi_hudless_colour`, `test_fsr4_tune`, `test_game_menu_mouse_buttons`, `test_input_movie`, `test_job_queue`, `test_oot_menu_mouse`, `test_pads_after_menu`, `test_parity_gates`, `test_run_all_mingw` and `test_sampler_admission`. Main's extra failure, `byte_compile_tracked`, came from running it in a `git archive` with no `.git`. - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. (`LONGSHOT_OWN_LOG`, unset by default. It is no player's knob: `longshot-builder play` sets it for the game it starts. Its row is in `gpu/vk/switches.def` and `docs/dev/reference/switches.md`; nothing to measure, as Measurements says.) - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. Windows: built with llvm-mingw and run in the game (Testing). Linux: `scripts/check_host_compile.py` ran for Linux in the CI image, with the commands of a player's build. Its headers came from tools.lock's `linux-x64` CPM cache and FFmpeg from Ubuntu's packages: 116 host units, 0 failed, `hos_main.c`, `hos_relaunch.c` and `hos_crash_record.c` among them. That is a syntax-only compile, not a link. `test_utf8_paths` passes. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The launcher starts the game through longshot-builder play, whose stderr is the builder's JSON relay pipe
(--output json) or the launcher's own temporary file (--output user from its shortcut). host/hos_main.c only opens
its own log when it has no stderr (or Steam's pipe on Linux), so such a game writes no
diagnostics/logs/longshot_log.txt: the menu's bug report has no log, and the crash window, the performance report
and sharing get less.

The checks, failing on main for that reason:
- tests/test_log_open_failure.py: relay-pipe and relay-file (LONGSHOT_OWN_LOG=1 with a pipe or a file as stderr)
  must open the log; relay-prepare (the builder's --prepare-shaders step) must keep its pipe. The fixture also
  gains a hos_organized_build() stand-in: it had not compiled since #2708.
- tests/test_restart_log.py: a game that wrote its own log over the relay's pipe (case 3), or over Steam's
  Gaming-mode pipe (case 4), must not start again with that log as stderr.
- tests/test_crash_record.py: with a file as stderr and the log's path given, the record must name the log, not
  the file the game was given.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(host): a game started by longshot-builder play writes its own longshot_log.txt (LONGSHOT_OWN_LOG)
Some checks failed
PR description / Title and description (pull_request_target) Successful in 5s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
3478b573a5
Since #2688 the launcher's games get longshot-builder play's JSON relay pipe as stderr (or, from its Windows shortcut,
the launcher's temporary file), and host/hos_main.c kept it as a stderr the player chose: no
diagnostics/logs/longshot_log.txt, a bug report without the log, a crash record naming the launcher's file.

- longshot-builder play gives the game LONGSHOT_OWN_LOG=1 (build_driver::play::OWN_LOG_VAR) under --output json, and
  under --output user asked while its own stderr is not a terminal (the launcher's shortcut): output::own_log.
- host/log_gate.h holds the one rule: the game writes its own log when it has no stderr, when LONGSHOT_OWN_LOG=1 says
  its stderr is nobody's (never in a --prepare-shaders step, whose pipe the builder reads), and for Steam's Gaming-mode
  pipe on Linux as before. hos_main.c reads the variable once, beside hos_relaunch_keep_env and before
  longshot_env.txt, so the log's opening and the restart cannot disagree.
- host/hos_relaunch.c's Restart now keeps the handles (Windows) or the stderr (Linux) by the same rule: a game that
  wrote its own log over the relay passes none on, and the new run opens its log again. On Linux this also covers
  Steam's Gaming-mode pipe, which the restart passed on as a given stderr before.
- host/hos_crash_record.c: the log's path the game chose wins over its stderr's, so a record names the run's log, not
  the launcher's file.
- gpu/vk/switches.def gets LONGSHOT_OWN_LOG's row (tests/test_switch_table.py), and build-driver a test that the
  name it gives is the one host/log_gate.h reads.
- tests/display_startup_failure_test.cpp gets the two stand-ins its cut of hos_main.c now needs, and
  tests/test_menu_restart.py checks Windows' restart and both starts read the rule.
- Docs: build.md (play's step 5), build-events.md (the log event), developing.md (Read the log), switches.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Windows 11 (26300), RTX 4090, driver 621.24: this branch as a pack over main 22d0d2009's base, the game started as play --output json starts it (stdout and stderr pipes read by a program, LONGSHOT_OWN_LOG=1 set by that program, not by longshot-builder play itself), title screen, Restart now through the control bridge, quit. With the variable: nothing over the pipe, diagnostics/logs/longshot_log.txt written without the user name, rotated to .1 by Restart now. Without it (main's behaviour): the log over the pipe and no file. Also seen: stderr as a file (the launcher shortcut's case) stays empty while the log is written; --prepare-shaders keeps its pipe; a crash on purpose at the start puts the CRASH: lines in longshot_log.txt and the crash record names it; the start-up screen's startup_progress and game_ready still arrive on stdout.

Tested in game: Windows 11 (26300), RTX 4090, driver 621.24: this branch as a pack over main 22d0d2009's base, the game started as play --output json starts it (stdout and stderr pipes read by a program, LONGSHOT_OWN_LOG=1 set by that program, not by longshot-builder play itself), title screen, Restart now through the control bridge, quit. With the variable: nothing over the pipe, diagnostics/logs/longshot_log.txt written without the user name, rotated to .1 by Restart now. Without it (main's behaviour): the log over the pipe and no file. Also seen: stderr as a file (the launcher shortcut's case) stays empty while the log is written; --prepare-shaders keeps its pipe; a crash on purpose at the start puts the CRASH: lines in longshot_log.txt and the crash record names it; the start-up screen's startup_progress and game_ready still arrive on stdout.
Member

Possibly related, for context:

  • issue #2484 Game: Game log is missing on Arch Linux Desktop Mode — Missing Linux game log; launcher differs from this report
Possibly related, for context: - issue #2484 Game: Game log is missing on Arch Linux Desktop Mode — Missing Linux game log; launcher differs from this report
Author
Contributor
@review
Author
Contributor

Checklist: three boxes settled.

  • mise run test passes. I ran the strict suite in the CI image, built locally from scripts/linux/checks.Dockerfile, and reran its failures the way the tests job runs them. The same 15 checks fail on the branch and on main 22d0d2009, with the same errors. They are named in the box.
  • Host code builds on Linux. scripts/check_host_compile.py ran for Linux in that image, with headers from tools.lock's linux-x64 CPM cache: 116 host units, 0 failed. The changed files are among them.
  • Added the "A switch added or changed" box for LONGSHOT_OWN_LOG. It is unset by default, set only by longshot-builder play, and has its row in switches.def.

The PR stays WIP: the launcher run in Still to test has not been done yet.

Checklist: three boxes settled. - `mise run test` passes. I ran the strict suite in the CI image, built locally from `scripts/linux/checks.Dockerfile`, and reran its failures the way the tests job runs them. The same 15 checks fail on the branch and on `main` `22d0d2009`, with the same errors. They are named in the box. - Host code builds on Linux. `scripts/check_host_compile.py` ran for Linux in that image, with headers from tools.lock's `linux-x64` CPM cache: 116 host units, 0 failed. The changed files are among them. - Added the "A switch added or changed" box for `LONGSHOT_OWN_LOG`. It is unset by default, set only by `longshot-builder play`, and has its row in `switches.def`. The PR stays WIP: the launcher run in Still to test has not been done yet.
Author
Contributor

Description: the 29 Windows failures behind the mise run test box are now named. All 29 also fail on main. Testing's Linux list is marked as the earlier --changed run in WSL, outside the CI image.

I compared the 15 failures in the CI image between the branch and main as whole blocks. They differ only by the two new Rust tests of this branch, which pass, and by a shifted line number in test_crash_record.py, on the same assertion. This PR's own checks pass in that image. The 10 skipped checks are Windows-only or need a Vulkan device.

Description: the 29 Windows failures behind the `mise run test` box are now named. All 29 also fail on `main`. Testing's Linux list is marked as the earlier `--changed` run in WSL, outside the CI image. I compared the 15 failures in the CI image between the branch and `main` as whole blocks. They differ only by the two new Rust tests of this branch, which pass, and by a shifted line number in `test_crash_record.py`, on the same assertion. This PR's own checks pass in that image. The 10 skipped checks are Windows-only or need a Vulkan device.
Jiro113 changed title from WIP: fix(host): a game started by longshot-builder play writes its own longshot_log.txt (LONGSHOT_OWN_LOG) to fix(host): a game started by longshot-builder play writes its own longshot_log.txt (LONGSHOT_OWN_LOG) 2026-11-28 16:44:42 +00:00
Owner
@review
BeanBot requested changes 2026-11-28 18:53:59 +00:00
Dismissed
BeanBot left a comment

Recommendation: Request changes. The change restores a game log in the tested Windows setup, but it also removes diagnostic output that existing builder consumers receive. If opening the new log fails, the crash record can name a file the game never wrote.

The builder asks the game to write its own rotating log for JSON launches and non-terminal user-output launches. This makes bug reports more useful, but currently costs consumers their live game diagnostics and has an incorrect log destination on an open failure.

Blocking (2): must change before merging.

  1. L1 builder/crates/longshot-builder/src/play.rs:657: Setting this for every JSON launch removes the game's stderr diagnostics from the existing JSON event stream. (more on the line) Do: Preserve the game diagnostics in the JSON relay while also writing the rotating game log, and test both destinations.
  2. L2 builder/crates/longshot-builder/src/output.rs:48: A non-terminal stderr does not identify the launcher's temporary file; it can be a file or pipe deliberately supplied by another caller. (more on the line) Do: Use an explicit launcher-to-builder indication for the shortcut case, or preserve the supplied stderr while writing the game log.

Should fix (1): not blocking, but worth doing before merging.

  • L3 host/hos_crash_record.c:807: The selected log path takes precedence even when opening that log failed and the game retained its original stderr. (more on the line) Do: Record the selected path only after redirection succeeds, or fall back to the actual stderr path when opening fails; cover this failure with a crash-record test.

@fix can do L1, L2 and L3.

Questions (2) (not confirmed from the code; they don't hold the recommendation)

  • Does Beanstalk consume game stderr log events from the JSON relay?
  • builder/crates/longshot-builder/src/play.rs:657: Is a game-free test of the builder's child environment required by a repository rule for this change?

Checks: Still running: 10 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes, for the tested host path: on Windows 11 with an RTX 4090, the author's simulated JSON launch wrote and rotated the log; without the variable it produced 154 KB on the pipe and no log file. The actual builder-to-launcher path and Linux remain untested.

Other systems: The JSON relay and launcher launch log lose game stderr; other JSON consumers can lose diagnostics too. Linux and Steam Gaming mode use the changed gate and restart path but have no reported game run. Shader preparation retains its pipe in the reported test. Windows restart and crash reporting were exercised in the simulated launch, but not through the launcher.

Switches: LONGSHOT_OWN_LOG is added, unset by default and set to 1 by play for JSON and explicitly requested non-terminal user output. The default leaves direct starts unchanged, but the builder's automatic setting causes the diagnostic-stream regressions noted below. The switch table and reference are updated.

Reviewed: 3478b573a5 against 22d0d20098: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the commit log and the change, with focused inspection of the logging gate, restart, crash-record and builder relay paths. Skimmed the changed tests and documentation; did not read every changed code file in full. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review).

Checked and fine:

  • Both commits include AI-assistance trailers.
  • The reported Windows run exercised rotation, crash reporting and shader preparation with the variable set.
  • The new gate leaves a piped --prepare-shaders run on its existing stderr.

Testing: No code or tests were run during review. The author reports a Windows in-game simulation and game-free checks; the actual launcher path and Linux game runs remain outstanding. CI is still running.

Overlaps and merge order: No overlapping pull request was identified in the supplied prior-work search.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The change restores a game log in the tested Windows setup, but it also removes diagnostic output that existing builder consumers receive. If opening the new log fails, the crash record can name a file the game never wrote. The builder asks the game to write its own rotating log for JSON launches and non-terminal user-output launches. This makes bug reports more useful, but currently costs consumers their live game diagnostics and has an incorrect log destination on an open failure. **Blocking (2)**: must change before merging. 1. **L1** `builder/crates/longshot-builder/src/play.rs:657`: Setting this for every JSON launch removes the game's stderr diagnostics from the existing JSON event stream. (more on the line) **Do:** Preserve the game diagnostics in the JSON relay while also writing the rotating game log, and test both destinations. 2. **L2** `builder/crates/longshot-builder/src/output.rs:48`: A non-terminal stderr does not identify the launcher's temporary file; it can be a file or pipe deliberately supplied by another caller. (more on the line) **Do:** Use an explicit launcher-to-builder indication for the shortcut case, or preserve the supplied stderr while writing the game log. **Should fix (1)**: not blocking, but worth doing before merging. - **L3** `host/hos_crash_record.c:807`: The selected log path takes precedence even when opening that log failed and the game retained its original stderr. (more on the line) **Do:** Record the selected path only after redirection succeeds, or fall back to the actual stderr path when opening fails; cover this failure with a crash-record test. `@fix` can do L1, L2 and L3. **Questions (2)** (not confirmed from the code; they don't hold the recommendation) - Does Beanstalk consume game stderr log events from the JSON relay? - `builder/crates/longshot-builder/src/play.rs:657`: Is a game-free test of the builder's child environment required by a repository rule for this change? **Checks:** Still running: 10 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes, for the tested host path: on Windows 11 with an RTX 4090, the author's simulated JSON launch wrote and rotated the log; without the variable it produced 154 KB on the pipe and no log file. The actual builder-to-launcher path and Linux remain untested. **Other systems:** The JSON relay and launcher launch log lose game stderr; other JSON consumers can lose diagnostics too. Linux and Steam Gaming mode use the changed gate and restart path but have no reported game run. Shader preparation retains its pipe in the reported test. Windows restart and crash reporting were exercised in the simulated launch, but not through the launcher. **Switches:** LONGSHOT_OWN_LOG is added, unset by default and set to 1 by play for JSON and explicitly requested non-terminal user output. The default leaves direct starts unchanged, but the builder's automatic setting causes the diagnostic-stream regressions noted below. The switch table and reference are updated. **Reviewed:** 3478b573a5f1 against 22d0d20098d6: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the commit log and the change, with focused inspection of the logging gate, restart, crash-record and builder relay paths. Skimmed the changed tests and documentation; did not read every changed code file in full. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review). **Checked and fine:** - Both commits include AI-assistance trailers. - The reported Windows run exercised rotation, crash reporting and shader preparation with the variable set. - The new gate leaves a piped --prepare-shaders run on its existing stderr. **Testing:** No code or tests were run during review. The author reports a Windows in-game simulation and game-free checks; the actual launcher path and Linux game runs remain outstanding. CI is still running. **Overlaps and merge order:** No overlapping pull request was identified in the supplied prior-work search. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -38,0 +45,4 @@
pub fn own_log(asked: Option<Output>, terminal: bool) -> bool {
match asked {
Some(Output::Json) => true,
Some(Output::User) => !terminal,
Member

L2 (blocking): A non-terminal stderr does not identify the launcher's temporary file; it can be a file or pipe deliberately supplied by another caller.

When: A user runs play --output user with stderr redirected to a file to collect game diagnostics. The builder sets LONGSHOT_OWN_LOG and the game redirects its stderr to its own log, leaving the requested file without the game's later output.

Do: Use an explicit launcher-to-builder indication for the shortcut case, or preserve the supplied stderr while writing the game log.

**L2** (blocking): A non-terminal stderr does not identify the launcher's temporary file; it can be a file or pipe deliberately supplied by another caller. *When:* A user runs play --output user with stderr redirected to a file to collect game diagnostics. The builder sets LONGSHOT_OWN_LOG and the game redirects its stderr to its own log, leaving the requested file without the game's later output. **Do:** Use an explicit launcher-to-builder indication for the shortcut case, or preserve the supplied stderr while writing the game log.
@ -653,1 +654,4 @@
}
// (the game's stderr nobody's to keep, the relay's pipe or the launcher's shortcut's file: LONGSHOT_OWN_LOG=1, and the
// game writes its own longshot_log.txt, host/log_gate.h)
if crate::output::own_log(asked, std::io::IsTerminal::is_terminal(&std::io::stderr())) {
Member

L1 (blocking): Setting this for every JSON launch removes the game's stderr diagnostics from the existing JSON event stream.

When: A program consuming play --output json previously received the game's stderr as source=game log events through json_output::relay. Once the game opens its file, those events stop, so a consumer monitoring a failure or preserving the launch log no longer receives the diagnostic.

Do: Preserve the game diagnostics in the JSON relay while also writing the rotating game log, and test both destinations.

**L1** (blocking): Setting this for every JSON launch removes the game's stderr diagnostics from the existing JSON event stream. *When:* A program consuming play --output json previously received the game's stderr as source=game log events through json_output::relay. Once the game opens its file, those events stop, so a consumer monitoring a failure or preserving the launch log no longer receives the diagnostic. **Do:** Preserve the game diagnostics in the JSON relay while also writing the rotating game log, and test both destinations.
@ -805,3 +805,3 @@
#ifdef _WIN32
HANDLE err = GetStdHandle(STD_ERROR_HANDLE); wchar_t log[PATH_CAP];
if (GetFileType(err) == FILE_TYPE_DISK) {
if (!log_path && GetFileType(err) == FILE_TYPE_DISK) {
Member

L3 (should fix): The selected log path takes precedence even when opening that log failed and the game retained its original stderr.

When: For a shortcut launch with a writable inherited stderr file but an unwritable game log path, hos_main prepares the selected path before fopen fails. The game continues writing to the inherited file, but the crash record names and reads the nonexistent selected log instead.

Do: Record the selected path only after redirection succeeds, or fall back to the actual stderr path when opening fails; cover this failure with a crash-record test.

**L3** (should fix): The selected log path takes precedence even when opening that log failed and the game retained its original stderr. *When:* For a shortcut launch with a writable inherited stderr file but an unwritable game log path, hos_main prepares the selected path before fopen fails. The game continues writing to the inherited file, but the crash record names and reads the nonexistent selected log instead. **Do:** Record the selected path only after redirection succeeds, or fall back to the actual stderr path when opening fails; cover this failure with a crash-record test.
Owner
@fix
BeanBot force-pushed fix/launcher-game-log-file from 3478b573a5
Some checks failed
PR description / Title and description (pull_request_target) Successful in 5s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to ec40598056
Some checks failed
PR description / Title and description (pull_request_target) Successful in 11s
CI / What the change needs (pull_request) Successful in 15s
CI / Third-party parts and guide screenshots (pull_request) Successful in 19s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 22s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-11-28 19:13:02 +00:00
Compare
BeanBot left a comment

Recommendation: Request changes. JSON launches and explicit user-output launches with redirected stderr still lose game diagnostics from their existing streams. Both regressions need to be fixed while retaining the game’s rotating log.

What @fix changed
I changed this pull request: the new head is ec40598056. I rebased it onto main (50e52e4717). I edited its description to match the change.

Changed

  • Crash-record log path after open failure: Recovery runs before rotation, and the crash record selects the game log only after redirection succeeds; otherwise it inspects inherited stderr. Added failure coverage in tests/test_crash_record.py:458 and tests/test_log_open_failure.py:82. Tests were not run, as requested.

Not done

  • Preserve JSON relay diagnostics and the rotating log: A complete fix needs to duplicate game stderr to both destinations on Windows and Linux, including crash and restart paths, and test both destinations. No files were changed.
  • Preserve caller-supplied stderr for user output: A complete fix needs to preserve the supplied file or pipe while retaining the game log for launcher shortcuts, with coverage for both destinations. No files were changed.

Nothing was built or run: the checks run again on the new head.

The change gives launcher-started games their own rotating log and records the opened log path for crash reports. It also diverts diagnostics away from streams that existing callers may consume.

Blocking (2): must change before merging.

  1. L1 builder/crates/longshot-builder/src/play.rs:657: Setting this for every JSON launch removes the game's stderr diagnostics from the existing JSON event stream. When: A program consuming play --output json previously received the game's stderr as source=game log events through json_output::relay. Once the game opens its file, those events stop, so a consumer monitoring a failure or preserving the launch log no longer receives the diagnostic. Do: Preserve the game diagnostics in the JSON relay while also writing the rotating game log, and test both destinations. (for the author: @fix couldn't: JSON launches still set LONGSHOT_OWN_LOG, and the host redirects stderr to the game log, removing subsequent diagnostics from the JSON relay.)
  2. L2 builder/crates/longshot-builder/src/output.rs:48: A non-terminal stderr does not identify the launcher's temporary file; it can be a file or pipe deliberately supplied by another caller. When: A user runs play --output user with stderr redirected to a file to collect game diagnostics. The builder sets LONGSHOT_OWN_LOG and the game redirects its stderr to its own log, leaving the requested file without the game's later output. Do: Use an explicit launcher-to-builder indication for the shortcut case, or preserve the supplied stderr while writing the game log. (for the author: @fix couldn't: Explicit user output with non-terminal stderr still sets LONGSHOT_OWN_LOG for any caller-supplied file or pipe, so the caller stops receiving game diagnostics.)

Checks: they run again on this head; a failure shows on the pull request.

Also noticed (4; not asked for, not blocking)
  • The launcher integration and Linux desktop and Steam Gaming mode still need the runs described in the pull request.
  • The new crash-record failure coverage combines a startup gate fixture with a separate inherited-stderr recovery case.
  • The crash-record fix recovers the previous run before rotation and selects the game log only after redirection succeeds.
  • The added crash-record open-failure case is reported as pending.
More: does it help, other systems, switches, what was read

Does it help: Yes for the tested Windows game process: the reported run wrote and rotated its own log, whereas the comparison wrote 154 KB to the pipe and no log file. The builder-to-launcher path and Linux behavior remain untested in the reported runs.

Other systems: JSON relay consumers, including the launcher and potentially the Test Farm, lose game stderr after the log opens. Explicit user-output callers with a redirected file or pipe are also affected. Windows game-process behavior was exercised; Linux Desktop, Steam Gaming mode, and actual launcher starts remain to be tested.

Switches: LONGSHOT_OWN_LOG is unset by default and set by the builder for JSON and certain user-output launches. Its automatic use is not safe for callers that consume stderr; it is documented in switches.def and the switch reference.

Reviewed: ec40598056 against 50e52e4717: Read the fix diff, the relevant log gate, startup and crash-record code, and the ledger-related builder changes; reviewed the supplied description and run reports. The full base-to-head diff includes other commits and was not read in full; recorded runs and tests were not executed.; nothing run (a code review).

Checked and fine:

  • The fix leaves the PR’s own-log behavior enabled.
  • The crash-record fallback passes a null log path when the initial log open fails, allowing a retained regular-file stderr to be identified.

Testing: No commands from the project or tests were run. The author reports a Windows game-process run; actual launcher starts, Linux Desktop and Steam Gaming mode, and the new open-failure crash-record case remain pending.

Overlaps and merge order: Not checked; network access is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** JSON launches and explicit user-output launches with redirected stderr still lose game diagnostics from their existing streams. Both regressions need to be fixed while retaining the game’s rotating log. **What `@fix` changed** I changed this pull request: the new head is ec40598056e8. I rebased it onto `main` (50e52e47173a). I edited its description to match the change. **Changed** - **Crash-record log path after open failure**: Recovery runs before rotation, and the crash record selects the game log only after redirection succeeds; otherwise it inspects inherited stderr. Added failure coverage in tests/test_crash_record.py:458 and tests/test_log_open_failure.py:82. Tests were not run, as requested. **Not done** - **Preserve JSON relay diagnostics and the rotating log**: A complete fix needs to duplicate game stderr to both destinations on Windows and Linux, including crash and restart paths, and test both destinations. No files were changed. - **Preserve caller-supplied stderr for user output**: A complete fix needs to preserve the supplied file or pipe while retaining the game log for launcher shortcuts, with coverage for both destinations. No files were changed. Nothing was built or run: the checks run again on the new head. The change gives launcher-started games their own rotating log and records the opened log path for crash reports. It also diverts diagnostics away from streams that existing callers may consume. **Blocking (2)**: must change before merging. 1. **L1** `builder/crates/longshot-builder/src/play.rs:657`: Setting this for every JSON launch removes the game's stderr diagnostics from the existing JSON event stream. *When:* A program consuming play --output json previously received the game's stderr as source=game log events through json_output::relay. Once the game opens its file, those events stop, so a consumer monitoring a failure or preserving the launch log no longer receives the diagnostic. **Do:** Preserve the game diagnostics in the JSON relay while also writing the rotating game log, and test both destinations. *(for the author: `@fix` couldn't: JSON launches still set LONGSHOT_OWN_LOG, and the host redirects stderr to the game log, removing subsequent diagnostics from the JSON relay.)* 2. **L2** `builder/crates/longshot-builder/src/output.rs:48`: A non-terminal stderr does not identify the launcher's temporary file; it can be a file or pipe deliberately supplied by another caller. *When:* A user runs play --output user with stderr redirected to a file to collect game diagnostics. The builder sets LONGSHOT_OWN_LOG and the game redirects its stderr to its own log, leaving the requested file without the game's later output. **Do:** Use an explicit launcher-to-builder indication for the shortcut case, or preserve the supplied stderr while writing the game log. *(for the author: `@fix` couldn't: Explicit user output with non-terminal stderr still sets LONGSHOT_OWN_LOG for any caller-supplied file or pipe, so the caller stops receiving game diagnostics.)* **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>Also noticed (4; not asked for, not blocking)</summary> - The launcher integration and Linux desktop and Steam Gaming mode still need the runs described in the pull request. - The new crash-record failure coverage combines a startup gate fixture with a separate inherited-stderr recovery case. - The crash-record fix recovers the previous run before rotation and selects the game log only after redirection succeeds. - The added crash-record open-failure case is reported as pending. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the tested Windows game process: the reported run wrote and rotated its own log, whereas the comparison wrote 154 KB to the pipe and no log file. The builder-to-launcher path and Linux behavior remain untested in the reported runs. **Other systems:** JSON relay consumers, including the launcher and potentially the Test Farm, lose game stderr after the log opens. Explicit user-output callers with a redirected file or pipe are also affected. Windows game-process behavior was exercised; Linux Desktop, Steam Gaming mode, and actual launcher starts remain to be tested. **Switches:** LONGSHOT_OWN_LOG is unset by default and set by the builder for JSON and certain user-output launches. Its automatic use is not safe for callers that consume stderr; it is documented in switches.def and the switch reference. **Reviewed:** ec40598056e8 against 50e52e47173a: Read the fix diff, the relevant log gate, startup and crash-record code, and the ledger-related builder changes; reviewed the supplied description and run reports. The full base-to-head diff includes other commits and was not read in full; recorded runs and tests were not executed.; nothing run (a code review). **Checked and fine:** - The fix leaves the PR’s own-log behavior enabled. - The crash-record fallback passes a null log path when the initial log open fails, allowing a retained regular-file stderr to be identified. **Testing:** No commands from the project or tests were run. The author reports a Windows game-process run; actual launcher starts, Linux Desktop and Steam Gaming mode, and the new open-failure crash-record case remain pending. **Overlaps and merge order:** Not checked; network access is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
fix(host): the game always writes its own longshot_log.txt and copies its lines to the stderr it was given
Some checks failed
PR description / Title and description (pull_request_target) Successful in 11s
CI / What the change needs (pull_request) Successful in 13s
CI / Third-party parts and guide screenshots (pull_request) Successful in 16s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Failing after 15s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m4s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 3m56s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 4m41s
CI / Website build and checks (pull_request) Failing after 36s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 4m49s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 27m51s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 40m7s
819145f3c6
The game no longer decides by its stderr whether to write a log: it writes longshot_log.txt in every run but a
--prepare-shaders step. The stderr it was started with (terminal, longshot-builder's relay, the launcher's file, Steam's
pipe) is copied before the log takes its place (hos_relaunch_keep_env), and each log line is written to it as well
(hos_log_tee_set in hos_thread.c), so the launcher's start-up screen and launch log, terminals and the Test Farm still read
the game's output. A restart gives the new run that same stderr again.

This removes LONGSHOT_OWN_LOG and the builder's side of it: nothing has to pass a flag for the log to exist.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Owner

Pushed 819145f3 on top of ec405980 (the head before this): the game now always writes its own longshot_log.txt, so LONGSHOT_OWN_LOG and the builder's side of it are gone.

  • host/log_gate.h: the gate is "not a --prepare-shaders step". Nothing has to pass a flag for the log to exist.
  • The stderr the game was started with (terminal, the relay's pipe, the launcher's file, Steam's pipe) is copied in hos_relaunch_keep_env before the log takes its place, and each log line is written to it as well (hos_log_tee_set, host/hos_thread.c), so the launcher's start-up screen and last-launch.log, terminals and the Test Farm read what they did before. Restart now gives the new run that same stderr.
  • Reverted: the builder's play.rs/output.rs changes, the switches.def and docs rows.
  • Tests updated for the new rule: test_log_open_failure.py, test_restart_log.py, test_menu_restart.py, test_crash_record.py (comments).

Not verified: nothing was run. Only a Linux syntax check of hos_thread.c, hos_relaunch.c and hos_main.c passed; the Windows side (DuplicateHandle of stderr, the handle list in the restart) is uncompiled and untested, and the updated tests have not run. The PR title and description still describe LONGSHOT_OWN_LOG and need rewriting, and the Testing section no longer applies.

Pushed 819145f3 on top of ec405980 (the head before this): the game now always writes its own `longshot_log.txt`, so `LONGSHOT_OWN_LOG` and the builder's side of it are gone. - `host/log_gate.h`: the gate is "not a `--prepare-shaders` step". Nothing has to pass a flag for the log to exist. - The stderr the game was started with (terminal, the relay's pipe, the launcher's file, Steam's pipe) is copied in `hos_relaunch_keep_env` before the log takes its place, and each log line is written to it as well (`hos_log_tee_set`, `host/hos_thread.c`), so the launcher's start-up screen and `last-launch.log`, terminals and the Test Farm read what they did before. Restart now gives the new run that same stderr. - Reverted: the builder's `play.rs`/`output.rs` changes, the `switches.def` and docs rows. - Tests updated for the new rule: `test_log_open_failure.py`, `test_restart_log.py`, `test_menu_restart.py`, `test_crash_record.py` (comments). Not verified: nothing was run. Only a Linux syntax check of `hos_thread.c`, `hos_relaunch.c` and `hos_main.c` passed; the Windows side (`DuplicateHandle` of stderr, the handle list in the restart) is uncompiled and untested, and the updated tests have not run. The PR title and description still describe `LONGSHOT_OWN_LOG` and need rewriting, and the Testing section no longer applies.
HumanBean deleted branch fix/launcher-game-log-file 2026-11-28 19:54:09 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
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
MagicBeanDev/Longshot!2741
No description provided.