fix(builder): on Linux a game started by the launcher has its lines in longshot_log.txt again #3130
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3130
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:fix/linux-launcher-game-log"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
On Linux, a game started with the Launcher's Play button leaves an empty
longshot_log.txt: at most the builder's own lines, none of the game's. So the Insert menu's Bug report sends empty logs and cannot say where the player is.How to see it on main: on Linux, start the game from the Launcher (or
longshot-builder play --profile <p> --output json) and openlongshot_log.txtin the game folder's logs folder. By the code, every nightly from 1007 on has this. A player's bug report from nightly-1041 had two logs of 172 bytes each, one builder line in each.Why: #2822 made the log the builder's: it copies what reaches its standard error into the file. With
--output json,json_output::Output::attachgave the game a standard error pipe of its own (since #2688), so the game's lines became JSON events and never reached the log. Windows does not show it, because its sandbox starts the game with its own pipes and writes the game's standard error to the builder's.What changes:
attachtakes only the game's standard output, where the start-up events are. The game's standard error is left alone, so it reaches the log and the builder's standard error. That is whatsandbox.mdalready says, and what Windows already does.build-events.mdis updated.The log is also finished before
after_gameruns, where it was finished after: the crash record and its report are written from the log, and would miss the game's last lines (BeanBot's L1).#2741 fixed a similar loss before #2822. Prior work for this one: none found (
json_output,StderrTee,redacting_tee,longshot_log, "game log", "empty log"; Longshot and LongshotLauncher).Read first:
Output::attachinbuilder/crates/longshot-builder/src/play/json_output.rs, thenstartinplay.rs(the tee,attach, and where the tee is dropped).Testing
The real game has not run with this change. The fault is on Linux only and this PC has no Linux game build; a Windows run does not go through the changed line. Opened without a game run (
--force) at the request of the person I work for.Tested:
longshot-builderplaying a profile with--output json, a shell script standing in for the game that writes two lines to its standard error (one_copy.rs's setup, changed in a throwaway copy). main @6318f4056:longshot_log.txtis empty and both lines are JSON events. This PR's first version,5784b19c7: both lines are inlongshot_log.txt, andgame_startedstill arrives as an event.the_games_stderr_reaches_its_logruns a builder process and a game process: the game's standard error line must be in the log, and itsgame_readyon the builder's standard output. On Linux (WSL), the test's commit alone (main's code) fails with an empty log; with the fix it passes, 20 of 20 runs. On Windows it passes with the fix.tests/game_log.rs, Linux) plays a profile with the real builder and--output json; the script in the game's place writes a line, then a last line with no end, and exits 1. Both must be inlongshot_log.txt, and the crash record must have seen the last one (log_tail_fatal: yes). On Linux (WSL): the test's commit alone (main's code) fails, the log being empty; with the fix it passes, 20 of 20 runs; with the fix but the log finished after the record, it fails (log_tail_fatal: no).cargo test -p longshot-builder: all pass butinstalled_versions_reuse_their_own_builds_with_one_profile(one_copy.rs:149), which fails the same way on main6318f4056(mods_recorded, from #3105).cargo clippy -p longshot-builder --all-targets --no-deps -D warningsis clean.cargo test -p build-corepassed on the first version; its clippy failure on main is not touched.cargo test -p longshot-builder: 84 of 84. Clippy as above: clean.run_all.py, on the first version: 836 of 837 pass. The one failure istest_run_all_junit, because thetest_utf8_pathsit runs fails on main since #3093. An earlier run that stopped after 273 checks (too long a command line) had 2 failures whose names were not kept.super::note_lines) for the run only. It is not in this PR.6318f4056. The branch is now onf2cd2f4b3, which changes nothing underbuilder/; they were not run again there.Not run:
test_utf8_pathsandtest_cursor_hidden_linux(they fail on main, other code), andtest_lifterbut forlongshot-builder's tests and clippy above.Still to test:
longshot_log.txt, and the report naming the map (by hand)Measurements
Nothing to measure in the game: this changes which pipe the game's log lines take, on Linux with
--output jsononly. One thread of the builder and the JSON wrapping of each log line go; no game or renderer code changes. The effect is the log's content, in Testing.Risks
last-launch.logon Linux no longer keeps the game's log lines once the game is running: they come as plain standard error, which the Launcher records only until then. Until the game is running it still has them.longshot_log.txthas all of them, as on Windows. Reports that only attachlast-launch.logwill show less.--output jsonthat took the game's standard error fromlogevents (sourcegame,streamstderr) gets it on the builder's standard error instead.--output text) comes after the log is finished, so it is on the standard error but no longer at the end oflongshot_log.txt. This is so on Windows too.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (Not run whole:test_lifterran only forlongshot-builder; see Testing.)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Possibly related, for context:
@review
Recommendation: Request changes. The Linux pipe change restores game lines to the log in the stand-in run, but crash reporting can read the log before the tee has finished writing it. The real launcher and game path still needs a Linux run.
The builder now sends the game's stderr through its existing redacting log tee while continuing to forward startup events from stdout. This restores the intended log on Linux, but changes the JSON output contract and can leave crash reports with an incomplete log.
Blocking (1): must change before merging.
builder/crates/longshot-builder/src/play/json_output.rs:16: The newly routed game stderr can still be pending in the tee when crash reporting reads the log. (more on the line) Do: Finish and drop the stderr tee after the game exits and before after_game reads the log; cover that ordering with a test using final stderr output.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
@fixcan do L1.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the stand-in: on Linux, the reported base run produced an empty log and the head run recorded both stderr lines while retaining game_started. The real game and launcher have not yet been tested.
Other systems: The change affects JSON play on Linux and changes where consumers receive game stderr; the description notes the loss of post-start lines from the Launcher's last-launch.log. Windows uses its sandbox relay and passed the reported builder tests, but its real launcher path has not been run. GPU rendering, saves, audio and input are not changed by the diff.
Switches: No player or developer switches added, changed or removed. The test adds two process-role environment variables, used only by the test.
Reviewed:
5784b19c74against6318f4056e: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, both changed files in full, both commits, and the relevant play, log tee and crash-report paths. Skimmed the surrounding builder code and the reported runs. docs/review-checklist.md and the sibling Tooling AGENTS.md were absent; the network was unavailable.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no commands from the project, builds or tests were run. The author reports Linux stand-in and Windows builder test results; CI was still running.
Overlaps and merge order: No overlapping pull request found in the supplied material; the network was closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -18,3 +16,1 @@thread::Builder::new().spawn(move || relay(stdout, "stdout"))?,thread::Builder::new().spawn(move || relay(stderr, "stderr"))?,]))game.stdout(Stdio::from(out));L1 (blocking): The newly routed game stderr can still be pending in the tee when crash reporting reads the log.
When: On Linux JSON play, the game writes its final diagnostics and exits. Player::start calls after_game before dropping _stderr_tee, while the tee pumps asynchronously; after_run can therefore read and send a log missing those diagnostics, or read it before its capped tail is joined.
Do: Finish and drop the stderr tee after the game exits and before after_game reads the log; cover that ordering with a test using final stderr output.
5784b19c74f16f3038e2f16f3038eanswers the review, and the branch is rebased onto mainf2cd2f4b3(no conflicts; that commit changes nothing underbuilder/).L1 is right, and fixed.
Player::startcalledafter_gamebefore the log was finished. The log is now finished first:stderr_teeis dropped after the channel ends and beforeafter_game.The new test
tests/game_log.rs(Linux) plays a profile with the real builder and--output json. A script stands in for the game: it writes a line, thenFATAL: the last linewith no line end, and exits 1. Both must be in the log, and the crash record must saylog_tail_fatal: yes.On Linux (WSL):
log_tail_fatal: nocargo test -p longshot-builderand its clippy, before the rebase:installed_versions_reuse_their_own_builds_with_one_profile, which fails the same way on main6318f4056. Clippy clean.One effect, now under Risks: with
--output text, the builder's own message about a crash comes after the log is finished. It is still on the standard error, but no longer at the end oflongshot_log.txt.L2 is still open. The real game has not run on Linux with this, so it stays WIP.
#2484 (missing log on Arch) is v3.1.1, from before #2822, so it is not this fault.
@review
Recommendation: Approve. The code is ready: only testing is left (a run of the change itself). The tee now finishes before crash reporting reads the log, and the stand-in game tests exercise the missing and final lines. The real Linux launcher and game path still needs a run. Recommend approval; not approved on the forge.
Linux games started through the launcher should again put their stderr in longshot_log.txt while startup events remain on the JSON stream. The change also finishes the log before crash reporting; the launcher’s last-launch.log retains fewer game lines after startup.
Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)
Since the last review (on
5784b19c74)Resolved: L1 (The newly routed game stderr can still be pending in the tee when crash reporting reads th…)
Still open: L2 (The real Linux launcher and game path has not been checked.)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven for the real game. The author reports the stand-in game test passed 20 of 20 Linux runs with the fix and failed on main; the real Linux launcher and game have not been run.
Other systems: Windows uses its sandbox relay and the tee is now finished before crash reporting there too; the author reports 84 builder tests passed with a separate main-branch compile fix applied. Linux launcher startup progress and bug reports still need a real-game check. JSON consumers no longer receive game stderr as log events.
Switches: No production switches added, changed or removed.
Reviewed:
f16f3038e2againstf2cd2f4b34: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the full diff, json_output.rs and game_log.rs, and the relevant play.rs and game_log.rs paths. The full play.rs and build-events.md output was truncated; other related code and recorded runs were skimmed. No docs/review-checklist.md was present.; nothing run (a code review).Checked and fine:
Testing: No commands that run project code were executed. The author reports Linux stand-in and Windows builder tests; CI is still running.
Overlaps and merge order: None identified in the supplied record.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
WIP: fix(builder): on Linux a game started by the launcher has its lines in longshot_log.txt againto fix(builder): on Linux a game started by the launcher has its lines in longshot_log.txt again