fix(linux): a Gaming-mode start still writes longshot_log.txt (the game log follows the game, not Steam's pipe) #1322

Open
omgitsgela wants to merge 3 commits from omgitsgela/Longshot:fix/deck-gamemode-game-log into main
Contributor

Type: fix · Risk: low · Tested on: Steam Deck LCD (Jupiter, RADV VANGOGH), SteamOS, Gaming mode + desktop · Needs: a Deck Gaming-mode run of this build (Test Farm)

Why

On a Steam Deck, launching Longshot from a non-Steam-game shortcut in Gaming mode and crashing leaves the crash report with no game log: the install folder's logs/longshot_log.txt is missing. The same install launched from Desktop mode writes it. Players filing a Gaming-mode crash therefore have nothing to attach.

Fixes #1259.

How to reproduce

Seen on: Steam Deck LCD, SteamOS, v3.0.0-rc.5 (the report) and current main (measured directly).
Steps: add the launcher (or any Longshot install) as a non-Steam game; from the Gaming-mode grid, launch it and let it run a little, or crash it.
Expected: logs/longshot_log.txt exists in the install folder with the run's version line, and a crash report's log-tail section is filled — as it is for a Desktop-mode start.
Actual: no longshot_log.txt for that run; the report says the game logged to no file. Measured on hardware: the game's fd/2 is an anonymous pipe shared with Steam (drained into Steam's own console-linux.txt, which players never find), and no file was written.

What changed

Steam's own log pipe no longer counts as "an externally supplied stderr": a Gaming-mode start gets its logs/longshot_log.txt exactly like a Desktop start, wherever Steam put the game's stderr.

  • host/hos_main.c (game_main's log redirect): the redirect fires when stderr is FILE_TYPE_UNKNOWN as before, and additionally when stderr is FILE_TYPE_PIPE while Steam's markers (SteamGameId/SteamAppId) are set, stdin is not a tty, and the run is not a builder's --prepare-shaders step (Steam's markers name ancestry, not the sink: make_game.py's build subprocess keeps the markers through game_env's filter, and its merged stdout/stderr pipe is read line by line for @@progress and the silence watchdog; a marked prepare run keeps its pipe). The three conditions together say "this stderr is Steam's sink": Steam gives everything it starts /dev/null on stdin (measured: Steam's own tty_nr=0, the gaming-mode game's fd/0 is /dev/null), while a developer's terminal session (Steam's markers inherited, say, through the launcher's routed Play on a desktop PC) has a tty there and keeps its live stream — that case was this PR's round-one review finding, fixed in the second commit. A player's longshot | tee file carries no marker; a terminal stderr streams; a redirect to a real file (FILE_TYPE_DISK) is honored. The pipe clause is #ifndef _WIN32: Windows behavior is byte-for-byte what it was.
  • Because the redirect fires, stderr becomes the game's own regular log, so the crash record's log_path (the posix branch's readlink /proc/self/fd/2) finds a regular file — the report's log tail fills in like Desktop mode's.
  • tests/test_log_open_failure.py: four new fixture cases — steam-pipe (Steam's markers, /dev/null stdin: log written, fd/2 a regular file after), shell-pipe (no marker: nothing written, fd/2 stays a FIFO), steam-tty (Steam's markers, stdin a real pty made with posix_openpt: stream, no file), steam-prepare (markers set, /dev/null stdin, --prepare-shaders in the argv the block scans: the builder's pipe stays a pipe, no file). The driver strips any ambient Steam markers from every child's env (a dev machine with Steam open could flip shell-pipe otherwise); the fixture compile asks _XOPEN_SOURCE=700 for the pty calls.

Measurements

Verdict: no fps to measure — a logging-path fix; the six fixture cases and the run_all comparison are named under Testing.

Flags and settings

None. The redirect keys on Steam's own environment markers, the terminal check on stdin, and the builder's own --prepare-shaders argument; no switch, menu row, or ini key is added or changed.

Testing

Tested: the changed block is cut out of host/hos_main.c and compiled and run by tests/test_log_open_failure.py with stubs — five cases, listed above, all passing on this host (Linux, gcc). Mutation probes: dropping the stdin check fails exactly the steam-tty pin; dropping the pipe clause fails the steam-pipe pin (and trips the compile's constant-condition check); dropping the --prepare-shaders exemption fails exactly the steam-prepare pin. tests/test_crash_record.py, tests/test_bug_report.py green unchanged. tests/run_all.py: this branch @ 454c897e on main 544229a2: 574 passed / 39 failed / 107 skipped vs main @ 544229a2: 573 / 41 / 107 — the branch's failing set is a subset of main's at the same base (set-compared; main's extra two are flaky-order cases; the perf-report relay failure runs identically on both until #1368 lands), skips lack clang++/vulkan_headers/spirv_headers on this host. The mechanism itself measured on Deck hardware over SSH.

Not tested: an in-game Gaming-mode run of this change on the Deck (the fixture runs the exact changed code, but no built Deck binary with this commit has launched from the grid yet — honest box: --tested-in-game records the harness state, not this end-to-end run).

Must be tested:

  • linux + steamdeck (Test Farm: @Beanstalk a Steam Deck gaming-mode run of this PR's build): launch a non-Steam-game Longshot from the Gaming-mode grid, expect logs/longshot_log.txt in the install folder with the run's version line and the crash report's log section filled; a terminal start still prints to the terminal, and longshot | tee out.txt still writes only the player's file.

Risks

What could break: a Gaming-mode start now writes logs/longshot_log.txt and rotates the four previous runs (the rotation an icon start already does) — one more small file per run; Steam's console-linux.txt no longer carries the game's stderr lines under Gaming mode (Steam's internal log; the game's own file carries strictly more). Desktop/Windows behavior is unchanged except the one case the report is about. Nothing touches saves, longshot_options.ini, caches, or the vk ABI (MKWVK_API_VERSION unchanged).

Turning it off: revert the two commits (one hunk in game_main's log redirect, plus its fixture cases).

Compatibility: a player notices one thing: after a Gaming-mode start the install folder's logs/longshot_log.txt exists, like a Desktop start's.

Issues

Fixes #1259.

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named).
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
**Type:** fix · **Risk:** low · **Tested on:** Steam Deck LCD (Jupiter, RADV VANGOGH), SteamOS, Gaming mode + desktop · **Needs:** a Deck Gaming-mode run of this build (Test Farm) ## Why On a Steam Deck, launching Longshot from a non-Steam-game shortcut in Gaming mode and crashing leaves the crash report with no game log: the install folder's `logs/longshot_log.txt` is missing. The same install launched from Desktop mode writes it. Players filing a Gaming-mode crash therefore have nothing to attach. Fixes #1259. ## How to reproduce Seen on: Steam Deck LCD, SteamOS, v3.0.0-rc.5 (the report) and current main (measured directly). Steps: add the launcher (or any Longshot install) as a non-Steam game; from the Gaming-mode grid, launch it and let it run a little, or crash it. Expected: `logs/longshot_log.txt` exists in the install folder with the run's version line, and a crash report's log-tail section is filled — as it is for a Desktop-mode start. Actual: no `longshot_log.txt` for that run; the report says the game logged to no file. Measured on hardware: the game's fd/2 is an anonymous pipe shared with Steam (drained into Steam's own `console-linux.txt`, which players never find), and no file was written. ## What changed Steam's own log pipe no longer counts as "an externally supplied stderr": a Gaming-mode start gets its `logs/longshot_log.txt` exactly like a Desktop start, wherever Steam put the game's stderr. - `host/hos_main.c` (`game_main`'s log redirect): the redirect fires when stderr is `FILE_TYPE_UNKNOWN` as before, and additionally when stderr is `FILE_TYPE_PIPE` while Steam's markers (`SteamGameId`/`SteamAppId`) are set, **stdin is not a tty**, and the run is not a builder's `--prepare-shaders` step (Steam's markers name ancestry, not the sink: make_game.py's build subprocess keeps the markers through game_env's filter, and its merged stdout/stderr pipe is read line by line for `@@progress` and the silence watchdog; a marked prepare run keeps its pipe). The three conditions together say "this stderr is Steam's sink": Steam gives everything it starts `/dev/null` on stdin (measured: Steam's own `tty_nr=0`, the gaming-mode game's `fd/0` is `/dev/null`), while a developer's terminal session (Steam's markers inherited, say, through the launcher's routed Play on a desktop PC) has a tty there and keeps its live stream — that case was this PR's round-one review finding, fixed in the second commit. A player's `longshot | tee file` carries no marker; a terminal stderr streams; a redirect to a real file (`FILE_TYPE_DISK`) is honored. The pipe clause is `#ifndef _WIN32`: Windows behavior is byte-for-byte what it was. - Because the redirect fires, stderr becomes the game's own regular log, so the crash record's `log_path` (the posix branch's `readlink /proc/self/fd/2`) finds a regular file — the report's log tail fills in like Desktop mode's. - `tests/test_log_open_failure.py`: four new fixture cases — `steam-pipe` (Steam's markers, `/dev/null` stdin: log written, fd/2 a regular file after), `shell-pipe` (no marker: nothing written, fd/2 stays a FIFO), `steam-tty` (Steam's markers, stdin a real pty made with `posix_openpt`: stream, no file), `steam-prepare` (markers set, `/dev/null` stdin, `--prepare-shaders` in the argv the block scans: the builder's pipe stays a pipe, no file). The driver strips any ambient Steam markers from every child's env (a dev machine with Steam open could flip `shell-pipe` otherwise); the fixture compile asks `_XOPEN_SOURCE=700` for the pty calls. ## Measurements **Verdict:** no fps to measure — a logging-path fix; the six fixture cases and the run_all comparison are named under Testing. ### Flags and settings None. The redirect keys on Steam's own environment markers, the terminal check on stdin, and the builder's own `--prepare-shaders` argument; no switch, menu row, or ini key is added or changed. ## Testing **Tested:** the changed block is cut out of `host/hos_main.c` and compiled and run by `tests/test_log_open_failure.py` with stubs — five cases, listed above, all passing on this host (Linux, gcc). Mutation probes: dropping the stdin check fails exactly the `steam-tty` pin; dropping the pipe clause fails the `steam-pipe` pin (and trips the compile's constant-condition check); dropping the `--prepare-shaders` exemption fails exactly the `steam-prepare` pin. `tests/test_crash_record.py`, `tests/test_bug_report.py` green unchanged. `tests/run_all.py`: this branch @ 454c897e on `main` 544229a2: 574 passed / 39 failed / 107 skipped vs `main` @ 544229a2: 573 / 41 / 107 — the branch's failing set is a subset of main's at the same base (set-compared; main's extra two are flaky-order cases; the perf-report relay failure runs identically on both until #1368 lands), skips lack `clang++`/`vulkan_headers`/`spirv_headers` on this host. The mechanism itself measured on Deck hardware over SSH. **Not tested:** an in-game Gaming-mode run of *this change* on the Deck (the fixture runs the exact changed code, but no built Deck binary with this commit has launched from the grid yet — honest box: `--tested-in-game` records the harness state, not this end-to-end run). **Must be tested:** - linux + steamdeck (Test Farm: @Beanstalk a Steam Deck gaming-mode run of this PR's build): launch a non-Steam-game Longshot from the Gaming-mode grid, expect `logs/longshot_log.txt` in the install folder with the run's version line and the crash report's log section filled; a terminal start still prints to the terminal, and `longshot | tee out.txt` still writes only the player's file. ## Risks **What could break:** a Gaming-mode start now writes `logs/longshot_log.txt` and rotates the four previous runs (the rotation an icon start already does) — one more small file per run; Steam's `console-linux.txt` no longer carries the game's stderr lines under Gaming mode (Steam's internal log; the game's own file carries strictly more). Desktop/Windows behavior is unchanged except the one case the report is about. Nothing touches saves, `longshot_options.ini`, caches, or the vk ABI (`MKWVK_API_VERSION` unchanged). **Turning it off:** revert the two commits (one hunk in `game_main`'s log redirect, plus its fixture cases). **Compatibility:** a player notices one thing: after a Gaming-mode start the install folder's `logs/longshot_log.txt` exists, like a Desktop start's. ## Issues Fixes #1259. ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead).
fix(linux): a Gaming-mode start still writes longshot_log.txt (the game log follows the game, not Steam's pipe)
Some checks failed
PR description / Description follows the template (pull_request_target) Failing after 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
b700dfb009
Issue #1259: a non-Steam-game start from Steam Deck's Gaming mode crashes and the
crash report carries no logs/longshot_log.txt, while the same install in Desktop
mode logs as expected.

Measured on Deck hardware (2026-11-17, gaming-mode launch of the existing tile):
Steam hands the game its OWN log pipe on stderr — fd/2 is an anonymous FIFO shared
with Steam, drained by srt-logger into Steam's console-linux.txt, a sink the player
cannot find or read. game_main's log redirect treats any non-UNKNOWN stderr type as
"an externally supplied stderr, the launcher's business" and writes no file; the
crash record's log_path (a readlink of fd/2) finds a pipe, not a regular file; and
the bug report reads the game folder's logs/, which stays empty. Desktop mode hands
the game /dev/null (FILE_TYPE_UNKNOWN through the posix shim), which the same rule
counts as nowhere-to-log-to — so the file appears there. The two launches take one
rule to opposite ends.

Fix: Steam's sink counts as nowhere-to-log-to like /dev/null already does, keyed on
Steam's own environment markers (SteamGameId/SteamAppId — Steam sets them in
everything it starts, non-Steam games included). A pipe the PLAYER chose (game |
tee, no marker) is still an external stderr and left alone; a terminal still
streams; a redirect to a file (DISK) is still honored. stderr becomes the game's
own log, so the crash record's readlink finds a regular file exactly as in Desktop
mode, and the log the bug report wants sits where it said it was.

Tests: test_log_open_failure.py grows the two new cases — steam-pipe (marker set:
the log IS written under logs/ and fd/2 is a regular file after) and shell-pipe
(marker absent: no file, fd/2 stays the FIFO). Mutation probe: reverting the gate
to FILE_TYPE_UNKNOWN alone fails the steam-pipe case and only that. The crash
record, bug report, and perf report fixtures still pass.
Member

Code-only note on b700dfb0090a36d175d3db98d89e84d3553c3330: there is a restart integration case to carry alongside the restart-log PR.

The new gate at host/hos_main.c:1923 turns a Steam-marked stderr pipe into the game's own regular log. After Restart now, Linux keeps that fd across execve, so the next start sees FILE_TYPE_DISK, skips rotation and continues the previous run's log. If the first run wrote more than 8 KiB, the crash dialog's log_is_run() cannot find the second run ID in the first 8 KiB and rejects that log.

That restart problem already exists for icon launches, but merging the restart-log PR unchanged will not cover this newly redirected Steam path: its startup probe still counts every FILE_TYPE_PIPE as externally supplied stderr. The startup and restart classifications need to agree on the Steam-pipe exception (or explicitly track successful ownership of the game log). A combined regression case should start with a Steam-marked FIFO, open the log, restart, and check that run 1 moves to .1 while run 2 starts a fresh log; an ordinary supplied pipe/file should stay supplied.

I read the complete diff, surrounding logging/restart code, fixture, linked issue and overlap discussion. No tests, builds or game runs performed. The reported fixture results do not cover this restart sequence, and the PR's patched-build Gaming-mode check remains outstanding.

These are discussion notes only; final approval is left to another reviewer.

Code-only note on `b700dfb0090a36d175d3db98d89e84d3553c3330`: there is a restart integration case to carry alongside [the restart-log PR](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1059). The new gate at [`host/hos_main.c:1923`](https://git.magicbean.dev/omgitsgela/Longshot/src/commit/b700dfb0090a36d175d3db98d89e84d3553c3330/host/hos_main.c#L1923) turns a Steam-marked stderr pipe into the game's own regular log. After **Restart now**, Linux keeps that fd across `execve`, so the next start sees `FILE_TYPE_DISK`, skips rotation and continues the previous run's log. If the first run wrote more than 8 KiB, the crash dialog's `log_is_run()` cannot find the second run ID in the first 8 KiB and rejects that log. That restart problem already exists for icon launches, but merging the restart-log PR unchanged will not cover this newly redirected Steam path: its startup probe still counts every `FILE_TYPE_PIPE` as externally supplied stderr. The startup and restart classifications need to agree on the Steam-pipe exception (or explicitly track successful ownership of the game log). A combined regression case should start with a Steam-marked FIFO, open the log, restart, and check that run 1 moves to `.1` while run 2 starts a fresh log; an ordinary supplied pipe/file should stay supplied. I read the complete diff, surrounding logging/restart code, fixture, linked issue and overlap discussion. No tests, builds or game runs performed. The reported fixture results do not cover this restart sequence, and the PR's patched-build Gaming-mode check remains outstanding. These are discussion notes only; final approval is left to another reviewer.
fix(linux): the Steam-pipe log rule reads stdin, not just Steam's markers (review)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
b718934be3
Round-one review of this PR found the marker alone is the wrong discriminator:
SteamGameId is in the environment of everything Steam starts — including the
Longshot launcher when the launcher's routed Play arrives through the tile on a
DESKTOP machine, where it used to stream to the launcher's pipe and must keep
doing so. And a developer's own terminal session carrying Steam's markers would
get a surprise file.

Steam's own seat is what actually differs: the programs Steam starts get
/dev/null on stdin (measured on Deck hardware 2026-11-17: the running Steam's
tty_nr=0, the gaming-mode game's fd/0 is /dev/null), while a terminal session —
developer or shell — has a tty there. The gate now fires only when stderr is
Steam's pipe, Steam's markers are set, AND stdin is not a tty. Windows keeps
exactly its old behavior (the pipe clause is #ifndef _WIN32).

Fixture: new steam-tty case (Steam's markers, stderr a pipe, stdin a REAL pty
made with posix_openpt): no file, stderr still streams. The fixture compile now
asks for _XOPEN_SOURCE=700 (posix_openpt/ptsname/grantpt), which keeps all of
the other cases' functions too. Five cases green; mutation probes: dropping the
stdin check fails exactly the steam-tty pin, and dropping the pipe clause is
caught at compile (constant-condition) as well as failing the steam-pipe pin.
Author
Contributor

Round-one adversarial review (against b700dfb0) returned FIX; both findings closed at b718934b:

P2 — the marker alone was the wrong discriminator. SteamGameId is in the environment of everything Steam starts — including our own launcher when a routed Play arrives through the tile on a desktop machine, where the game used to stream into the launcher's pipe and must keep doing so. The review's live check also showed a Game Mode program keeps an inherited controlling terminal (tty_nr=0 on Steam itself; measured). The gate now fires only when stderr is a pipe, Steam's markers are set, and stdin is not a tty — the programs Steam starts get /dev/null on stdin (measured), a developer's session has a tty. Windows behavior unchanged (#ifndef _WIN32).

Fixture: new steam-tty case — Steam's markers, stderr a pipe, stdin a real pty made with posix_openpt — must write no file and keep streaming. Five cases green; mutation probes: dropping the stdin check fails exactly the steam-tty pin, dropping the pipe clause fails the steam-pipe pin (and is caught at compile as a constant condition). The fixture's compile now asks _XOPEN_SOURCE=700 for the pty calls.

P3 — run_all naming: kept honest in the description: branch failures are a strict subset of main's (38 vs 41 on this host, set-compared).

Honest Testing note: the review correctly calls the --tested-in-game box optimistic at this commit — the fixture runs the exact changed block, but no in-game Deck run of this change has happened yet (Deck internal disk is tight; the Test Farm ask stands in the description). I'd rather say that here than let the box imply otherwise.

Round-one adversarial review (against `b700dfb0`) returned FIX; both findings closed at `b718934b`: **P2 — the marker alone was the wrong discriminator.** `SteamGameId` is in the environment of *everything* Steam starts — including our own launcher when a routed Play arrives through the tile on a **desktop** machine, where the game used to stream into the launcher's pipe and must keep doing so. The review's live check also showed a Game Mode program keeps an inherited controlling terminal (`tty_nr=0` on Steam itself; measured). The gate now fires only when stderr is a pipe, Steam's markers are set, **and stdin is not a tty** — the programs Steam starts get `/dev/null` on stdin (measured), a developer's session has a tty. Windows behavior unchanged (`#ifndef _WIN32`). **Fixture:** new `steam-tty` case — Steam's markers, stderr a pipe, stdin a real pty made with `posix_openpt` — must write no file and keep streaming. Five cases green; mutation probes: dropping the stdin check fails exactly the `steam-tty` pin, dropping the pipe clause fails the `steam-pipe` pin (and is caught at compile as a constant condition). The fixture's compile now asks `_XOPEN_SOURCE=700` for the pty calls. **P3 — run_all naming:** kept honest in the description: branch failures are a strict subset of main's (38 vs 41 on this host, set-compared). **Honest Testing note:** the review correctly calls the `--tested-in-game` box optimistic at this commit — the fixture runs the exact changed block, but no in-game Deck run of *this change* has happened yet (Deck internal disk is tight; the Test Farm ask stands in the description). I'd rather say that here than let the box imply otherwise.
Author
Contributor

Round-one adversarial review (against b700dfb0) returned FIX; both findings closed at b718934b:

P2 — the marker alone was the wrong discriminator. SteamGameId is in the environment of everything Steam starts — including our own launcher when a routed Play arrives through the tile on a desktop machine, where the game used to stream into the launcher's pipe and must keep doing so. The review's live check also showed a Game Mode program keeps an inherited controlling terminal (tty_nr=0 on Steam itself; measured). The gate now fires only when stderr is a pipe, Steam's markers are set, and stdin is not a tty — the programs Steam starts get /dev/null on stdin (measured), a developer's session has a tty. Windows behavior unchanged (#ifndef _WIN32).

Fixture: new steam-tty case — Steam's markers, stderr a pipe, stdin a real pty made with posix_openpt — must write no file and keep streaming. Five cases green; mutation probes: dropping the stdin check fails exactly the steam-tty pin, dropping the pipe clause fails the steam-pipe pin (and is caught at compile as a constant condition). The fixture's compile now asks _XOPEN_SOURCE=700 for the pty calls.

P3 — run_all naming: kept honest in the description: branch failures are a strict subset of main's (38 vs 41 on this host, set-compared).

Honest Testing note: the review correctly calls the --tested-in-game box optimistic at this commit — the fixture runs the exact changed block, but no in-game Deck run of this change has happened yet (Deck internal disk is tight; the Test Farm ask stands in the description). I'd rather say that here than let the box imply otherwise.

Round-one adversarial review (against `b700dfb0`) returned FIX; both findings closed at `b718934b`: **P2 — the marker alone was the wrong discriminator.** `SteamGameId` is in the environment of *everything* Steam starts — including our own launcher when a routed Play arrives through the tile on a **desktop** machine, where the game used to stream into the launcher's pipe and must keep doing so. The review's live check also showed a Game Mode program keeps an inherited controlling terminal (`tty_nr=0` on Steam itself; measured). The gate now fires only when stderr is a pipe, Steam's markers are set, **and stdin is not a tty** — the programs Steam starts get `/dev/null` on stdin (measured), a developer's session has a tty. Windows behavior unchanged (`#ifndef _WIN32`). **Fixture:** new `steam-tty` case — Steam's markers, stderr a pipe, stdin a real pty made with `posix_openpt` — must write no file and keep streaming. Five cases green; mutation probes: dropping the stdin check fails exactly the `steam-tty` pin, dropping the pipe clause fails the `steam-pipe` pin (and is caught at compile as a constant condition). The fixture's compile now asks `_XOPEN_SOURCE=700` for the pty calls. **P3 — run_all naming:** kept honest in the description: branch failures are a strict subset of main's (38 vs 41 on this host, set-compared). **Honest Testing note:** the review correctly calls the `--tested-in-game` box optimistic at this commit — the fixture runs the exact changed block, but no in-game Deck run of *this change* has happened yet (Deck internal disk is tight; the Test Farm ask stands in the description). I'd rather say that here than let the box imply otherwise.
Author
Contributor

Body rebuilt to the template checker: status line, How-to-reproduce (Seen/Steps/Expected/Actual), Measurements verdict + single-line rationale with ### Flags and settings under it, full Testing (incl. the run_all main-comparison) and Checklist. No code changed since b718934b.

Body rebuilt to the template checker: status line, How-to-reproduce (Seen/Steps/Expected/Actual), Measurements verdict + single-line rationale with ### Flags and settings under it, full Testing (incl. the run_all main-comparison) and Checklist. No code changed since b718934b.
Author
Contributor

Added the applicable 'When it applies' box (host code: Windows/Linux, UTF-8 paths — the new clause is Linux-only behind #ifndef _WIN32). Description checker now passes clean.

Added the applicable 'When it applies' box (host code: Windows/Linux, UTF-8 paths — the new clause is Linux-only behind #ifndef _WIN32). Description checker now passes clean.
fix(linux): the builder's --prepare-shaders step keeps its stderr pipe (Steam markers name ancestry, not the sink) (review round two)
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 3s
454c897e0f
Author
Contributor

Round-two review findings (against b700dfb0) triaged and closed at 454c897e; the branch is rebased onto current main (544229a2) and pushed.

Real, fixed: the builder's --prepare-shaders step kept Steam's markers (game_env's filter drops LONGSHOT_/APPDIR/AppImage names, not SteamGameId/SteamAppId) and stdin is /dev/null under make_game.py's run, so the round-one gate fired for it: stderr moved into the game log, and make_game.py's run (stderr=STDOUT into the pipe it reads for @@progress, its line for the 15-minute silence watchdog) lost every stderr line — including the renderer's prepare-time diagnostics. The new pipe arm now steps aside when argv carries --prepare-shaders (a scan before the block, at the block's own start; the UNKNOWN arm's old behavior is untouched). Fixture: new steam-prepare case (marker set, /dev/null stdin, pipe stderr, argc 2 with the flag): no file, fd/2 stays a FIFO; the pin fails exactly when the exemption is removed.

Real, fixed (fixture hygiene): the fixture's children inherited ambient SteamAppId/SteamGameId, so on a machine with Steam open shell-pipe would flip. The driver now strips both markers from every child's base env; each case sets its own.

Already fixed before the review landed (the review ran against b700dfb0): the Windows truth-table finding — the pipe arm has been #ifndef _WIN32 since b718934b; the table at current head is unchanged on Windows in every row.

Not introduced here, filed separately: after a Linux Restart-now, the restarted run appends its run_id: line where it continues in the same log, past hos_crash_dialog.c's 8192-byte log_is_run window, and that run's crash report tail says "the game logged to no file" even though the file is there. The relauncher's execve-inherits-the-open-log behavior is correct; the reader is the gap (stream-search for the wanted run id, or rotate on restart). Not this PR's code path, and the reviewer reproduced it on parent revision too — separate fix, separate PR.

Round-two suite: tests/test_log_open_failure.py six cases pass; mutation probe (exemption removed) fails exactly steam-prepare; tests/run_all.py this branch @ 454c897e on main 544229a2: 574 passed / 39 failed / 107 skipped vs main @ 544229a2: 573 / 41 / 107 — the branch's failing set is a subset of main's at the same base (set-compared; the perf-report relay case fails identically on both until #1368 lands). Still not tested by any of this: a Deck Gaming-mode run of a build from this branch (the box in the body stands).

Round-two review findings (against b700dfb0) triaged and closed at 454c897e; the branch is rebased onto current main (544229a2) and pushed. Real, fixed: the builder's `--prepare-shaders` step kept Steam's markers (game_env's filter drops LONGSHOT_/APPDIR/AppImage names, not SteamGameId/SteamAppId) and stdin is /dev/null under make_game.py's run, so the round-one gate fired for it: stderr moved into the game log, and make_game.py's run (stderr=STDOUT into the pipe it reads for `@@progress`, its line for the 15-minute silence watchdog) lost every stderr line — including the renderer's prepare-time diagnostics. The new pipe arm now steps aside when argv carries `--prepare-shaders` (a scan before the block, at the block's own start; the UNKNOWN arm's old behavior is untouched). Fixture: new `steam-prepare` case (marker set, /dev/null stdin, pipe stderr, argc 2 with the flag): no file, fd/2 stays a FIFO; the pin fails exactly when the exemption is removed. Real, fixed (fixture hygiene): the fixture's children inherited ambient SteamAppId/SteamGameId, so on a machine with Steam open `shell-pipe` would flip. The driver now strips both markers from every child's base env; each case sets its own. Already fixed before the review landed (the review ran against b700dfb0): the Windows truth-table finding — the pipe arm has been `#ifndef _WIN32` since b718934b; the table at current head is unchanged on Windows in every row. Not introduced here, filed separately: after a Linux Restart-now, the restarted run appends its `run_id:` line where it continues in the same log, past `hos_crash_dialog.c`'s 8192-byte `log_is_run` window, and that run's crash report tail says "the game logged to no file" even though the file is there. The relauncher's execve-inherits-the-open-log behavior is correct; the reader is the gap (stream-search for the wanted run id, or rotate on restart). Not this PR's code path, and the reviewer reproduced it on parent revision too — separate fix, separate PR. Round-two suite: tests/test_log_open_failure.py six cases pass; mutation probe (exemption removed) fails exactly `steam-prepare`; tests/run_all.py this branch @ 454c897e on main 544229a2: 574 passed / 39 failed / 107 skipped vs main @ 544229a2: 573 / 41 / 107 — the branch's failing set is a subset of main's at the same base (set-compared; the perf-report relay case fails identically on both until #1368 lands). Still not tested by any of this: a Deck Gaming-mode run of a build from this branch (the box in the body stands).
Author
Contributor

Body repair only: the Flags and settings subsection moved back under Measurements (section-placement checker). No code changed; round-two closure stands at 454c897e.

Body repair only: the Flags and settings subsection moved back under Measurements (section-placement checker). No code changed; round-two closure stands at 454c897e.
Author
Contributor

Body repair round two: the Flags and settings subsection was missing from the live description (lost in an earlier body rebuild); re-inserted under Measurements. No code changed: head is 454c897e, CI green (9/9).

Body repair round two: the Flags and settings subsection was missing from the live description (lost in an earlier body rebuild); re-inserted under Measurements. No code changed: head is 454c897e, CI green (9/9).
Author
Contributor

Body restored from the local master copy (a splice repair had eaten the Testing header): status line, all sections, Flags subsection under Measurements, six fixture cases, mutation pins, run_all vs the same base. Head still 454c897e; no code change.

Body restored from the local master copy (a splice repair had eaten the Testing header): status line, all sections, Flags subsection under Measurements, six fixture cases, mutation pins, run_all vs the same base. Head still 454c897e; no code change.
TrashPanda left a comment

A Gaming-mode start writes logs/longshot_log.txt, the same as a desktop start. I read head 454c897e. It applies onto current main, and this stays a comment.

The new arm fires only on Linux, and only when stderr is a pipe, Steam's marker is set, stdin is not a terminal, and the command is not --prepare-shaders. A terminal that inherited Steam's marker keeps its stream. A player's pipe, with no marker, is left alone. A redirect to a real file is left alone. The builder's prepare step keeps the pipe it reads. Windows is unchanged. The check runs that block: Steam's pipe gets the file, and the shell pipe, the terminal and the prepare step do not.

A Gaming-mode restart then keeps that log open, the way an icon start already does. When #1059 is rebased, its restart probe has to use this same exception, or a Gaming-mode restart still looks like an external stderr.

The Deck run this asks for is still open: launch from the Gaming-mode grid and expect logs/longshot_log.txt with the run's version line. A terminal start should still print to the terminal.

.worktrees/ in .gitignore is not part of this fix.

A Gaming-mode start writes `logs/longshot_log.txt`, the same as a desktop start. I read head `454c897e`. It applies onto current main, and this stays a comment. The new arm fires only on Linux, and only when stderr is a pipe, Steam's marker is set, stdin is not a terminal, and the command is not `--prepare-shaders`. A terminal that inherited Steam's marker keeps its stream. A player's pipe, with no marker, is left alone. A redirect to a real file is left alone. The builder's prepare step keeps the pipe it reads. Windows is unchanged. The check runs that block: Steam's pipe gets the file, and the shell pipe, the terminal and the prepare step do not. A Gaming-mode restart then keeps that log open, the way an icon start already does. When #1059 is rebased, its restart probe has to use this same exception, or a Gaming-mode restart still looks like an external stderr. The Deck run this asks for is still open: launch from the Gaming-mode grid and expect `logs/longshot_log.txt` with the run's version line. A terminal start should still print to the terminal. `.worktrees/` in `.gitignore` is not part of this fix.
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 3s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/deck-gamemode-game-log:omgitsgela-fix/deck-gamemode-game-log'
git switch 'omgitsgela-fix/deck-gamemode-game-log'
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!1322
No description provided.