fix(crash): the crash report finds the run's log wherever its run_id line sits #1375

Open
omgitsgela wants to merge 3 commits from omgitsgela/Longshot:fix/crash-dialog-log-run-search into main
Contributor

Type: fix · Risk: low · Tested on: Linux (x86-64, no GPU needed) · Needs: Windows, Steam Deck

Why

On Linux and Steam Deck, "Restart now" from the Insert menu starts the new run in the same process (host/hos_relaunch.c), and the new run keeps writing to the log the run before left open. That is deliberate. What was not deliberate: when that restarted run crashes, its own report could not find its own log. The report's log section said "Not found: the game logged to no file" while logs/longshot_log.txt sat right there, full of the run's lines — because the search for the run's run_id: line only read the first 8192 bytes, and the restarted run's line lands wherever the first run stopped (a real play session is far past 8 KB). The player pastes a report with no log tail. Deck players restart to apply settings often, so this is the common Deck path.

Fixes #1374. See #1259 (the #1259 review round found this pre-existing gap; that PR does not touch it).

How to reproduce

Seen on: Linux (reproduced by test; the same code path runs on Steam Deck)
Settings and switches: defaults
Steps: start the game from a terminal, play until the log passes ~8 KB (any session does), Insert → "Restart now", play until it crashes on its own
Expected: the crash report's "The end of longshot_log.txt" section carries the restarted run's last lines
Actual: the section says "Not found: the game logged to no file"

What changed

The log-ownership probe now streams the file looking for the wanted run_id: line instead of reading a fixed 8 KB head, under the same 256 MB ceiling the log reader below already uses. Behavior at the head is unchanged; the search just keeps going.

  • host/hos_crash_dialog.c: log_is_run() streams line by line (fgets, 4 KB lines) until it sees run_id: <wanted> or the ceiling, and reports where that line sits; find_run_log() passes the byte into RunLog.from, and read_log() feeds the fact parser (map, stage, start-failure) only from that line on — a log inherited across a posix restart holds the run before too, and its map is not this run's. The ring of tail lines stays whole-file: the lines just before a restart are context.
  • tests/test_crash_dialog.py: the fixture's relaunch mode grows (RESTARTED env makes the exec'd run append instead of truncate, CRASH_TEST_RELAUNCH_TO chooses what the restarted run does — default stays clean, the existing pin), and a new case runs relaunch → crash behind a first run whose log is 24 KB deep, clicks Report manually, and requires the clipboard copy to carry the restarted run's own line (CRASH_TEST_RESTARTED_LOG: only the restarted run writes it) and not say the game logged to no file. A second case restarts behind a deep run that played in Kokiri Forest and crashes at the start: the box must say during-the-start and the report must not name the old run's map (review round two). source_checks() pins the probe's streaming form (fgets, no read_text head window, the located byte reported) and the read_log gate.

Measurements

Verdict: no fps to measure — a crash-report path fix; the new case fails on main with the exact #1374 text and passes on this branch (mutation-probed).

main @ 544229a2 + new test:
AssertionError: the restarted run's report says the game logged to no file: its run_id line sits at 24400 bytes, past the old 8 KB head window, and find_run_log never looked further (issue #1374)
this PR:
PASS: the run after a Restart now: its crash report finds the deep run_id line and carries the log tail

Flags and settings

None.

Testing

Tested: Linux host: tests/test_crash_dialog.py full suite green (both restart cases, the source pins, plus every existing crash-dialog case, including the original relaunch clean-restart pin); tests/test_crash_record.py, tests/test_bug_report.py green. tests/run_all.py: this branch @ c31c54f6 on main 544229a2: 575 / 39 / 107 vs main 573 / 41 / 107 — the only branch-side entry main doesn't share is tests/test_perf_report.py's known flaky relay case (green standalone at this head and at the base; #1368's author is fixing its race in parallel). Mutation probes: restoring the 8 KB head-window probe fails exactly the deep-log pin; neutralizing the read_log fact gate fails the box-stage pin (proved with the source-pin string kept in dead code, so only behavior caught it).
Not tested: Windows — the code is platform-neutral C in the shared crash dialog; Windows has no same-process Restart now (its restart re-launches and the log block runs normally), so this only affects a rotated-name search there.
Must be tested:

  • Steam Deck (Test Farm tag steamdeck): Insert → Restart now, crash on purpose, Report manually — expecting the clipboard copy to carry "### The end of longshot_log.txt" with the run's lines, not "Not found" (@Beanstalk steamdeck: restart then crash, check the report's log section)

Risks

What could break: a pathological log (256 MB of one line with no newline where the run_id should be): the probe stops at the same ceiling read_log already uses. No other caller of log_is_run besides find_run_log.
Turning it off: revert the commit.
Compatibility: Nothing changes for saves, ini, caches, or the vk ABI; players only notice their post-restart crash report finally has the log tail.

Issues

Fixes #1374. See #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).
  • 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).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. The change is plain C (fgets/strstr) compiled through the same path on both; the fixture runs on this host.
  • A game-free test added for the fix, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened. source_checks() gains the streaming-probe pin; nothing removed.
**Type:** fix · **Risk:** low · **Tested on:** Linux (x86-64, no GPU needed) · **Needs:** Windows, Steam Deck ## Why On Linux and Steam Deck, "Restart now" from the Insert menu starts the new run in the same process (`host/hos_relaunch.c`), and the new run keeps writing to the log the run before left open. That is deliberate. What was not deliberate: when that restarted run crashes, its own report could not find its own log. The report's log section said "Not found: the game logged to no file" while `logs/longshot_log.txt` sat right there, full of the run's lines — because the search for the run's `run_id:` line only read the first 8192 bytes, and the restarted run's line lands wherever the first run stopped (a real play session is far past 8 KB). The player pastes a report with no log tail. Deck players restart to apply settings often, so this is the common Deck path. Fixes #1374. See #1259 (the #1259 review round found this pre-existing gap; that PR does not touch it). ## How to reproduce **Seen on:** Linux (reproduced by test; the same code path runs on Steam Deck) **Settings and switches:** defaults **Steps:** start the game from a terminal, play until the log passes ~8 KB (any session does), Insert → "Restart now", play until it crashes on its own **Expected:** the crash report's "The end of longshot_log.txt" section carries the restarted run's last lines **Actual:** the section says "Not found: the game logged to no file" ## What changed The log-ownership probe now streams the file looking for the wanted `run_id:` line instead of reading a fixed 8 KB head, under the same 256 MB ceiling the log reader below already uses. Behavior at the head is unchanged; the search just keeps going. - `host/hos_crash_dialog.c`: `log_is_run()` streams line by line (`fgets`, 4 KB lines) until it sees `run_id: <wanted>` or the ceiling, and reports where that line sits; `find_run_log()` passes the byte into `RunLog.from`, and `read_log()` feeds the fact parser (`map`, stage, start-failure) only from that line on — a log inherited across a posix restart holds the run before too, and its map is not this run's. The ring of tail lines stays whole-file: the lines just before a restart are context. - `tests/test_crash_dialog.py`: the fixture's `relaunch` mode grows (`RESTARTED` env makes the exec'd run append instead of truncate, `CRASH_TEST_RELAUNCH_TO` chooses what the restarted run does — default stays `clean`, the existing pin), and a new case runs `relaunch → crash` behind a first run whose log is 24 KB deep, clicks Report manually, and requires the clipboard copy to carry the restarted run's own line (`CRASH_TEST_RESTARTED_LOG`: only the restarted run writes it) and not say the game logged to no file. A second case restarts behind a deep run that played in Kokiri Forest and crashes at the start: the box must say during-the-start and the report must not name the old run's map (review round two). `source_checks()` pins the probe's streaming form (`fgets`, no `read_text` head window, the located byte reported) and the `read_log` gate. ## Measurements **Verdict:** no fps to measure — a crash-report path fix; the new case fails on main with the exact #1374 text and passes on this branch (mutation-probed). ``` main @ 544229a2 + new test: AssertionError: the restarted run's report says the game logged to no file: its run_id line sits at 24400 bytes, past the old 8 KB head window, and find_run_log never looked further (issue #1374) this PR: PASS: the run after a Restart now: its crash report finds the deep run_id line and carries the log tail ``` ### Flags and settings None. ## Testing **Tested:** Linux host: `tests/test_crash_dialog.py` full suite green (both restart cases, the source pins, plus every existing crash-dialog case, including the original `relaunch` clean-restart pin); `tests/test_crash_record.py`, `tests/test_bug_report.py` green. `tests/run_all.py`: this branch @ c31c54f6 on `main` 544229a2: 575 / 39 / 107 vs main 573 / 41 / 107 — the only branch-side entry main doesn't share is `tests/test_perf_report.py`'s known flaky relay case (green standalone at this head and at the base; #1368's author is fixing its race in parallel). Mutation probes: restoring the 8 KB head-window probe fails exactly the deep-log pin; neutralizing the `read_log` fact gate fails the box-stage pin (proved with the source-pin string kept in dead code, so only behavior caught it). **Not tested:** Windows — the code is platform-neutral C in the shared crash dialog; Windows has no same-process Restart now (its restart re-launches and the log block runs normally), so this only affects a rotated-name search there. **Must be tested:** - Steam Deck (Test Farm tag steamdeck): Insert → Restart now, crash on purpose, Report manually — expecting the clipboard copy to carry "### The end of longshot_log.txt" with the run's lines, not "Not found" (@Beanstalk steamdeck: restart then crash, check the report's log section) ## Risks **What could break:** a pathological log (256 MB of one line with no newline where the run_id should be): the probe stops at the same ceiling `read_log` already uses. No other caller of `log_is_run` besides `find_run_log`. **Turning it off:** revert the commit. **Compatibility:** Nothing changes for saves, ini, caches, or the vk ABI; players only notice their post-restart crash report finally has the log tail. ## Issues Fixes #1374. See #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] 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). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. The change is plain C (`fgets`/`strstr`) compiled through the same path on both; the fixture runs on this host. - [x] A game-free test added for the fix, failing on `main` and passing here. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. `source_checks()` gains the streaming-probe pin; nothing removed.
fix(crash): the crash report finds the run's log wherever its run_id line sits (issue #1374)
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
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
bf57a62447
Linux's Restart now execs the new run in the same process with the log still open, so the
restarted run appends at the offset the run before reached. The crash dialog's log-ownership
probe only read the first 8192 bytes, so the restarted run's own report claimed the game had
logged to no file while its lines sat a screen deeper in the file. log_is_run now streams the
file looking for the wanted run_id line, under the same 256 MB ceiling read_log already uses.

The fixture's relaunch mode grows: RESTARTED makes the exec'd run append instead of truncate
(the real thing: the log stays open across the exec), CRASH_TEST_RELAUNCH_TO picks what the
restarted run does, default clean (the existing pin unchanged). The new case restarts behind a
24 KB first run, crashes, and requires the Report-manually copy to carry the run's tail.
Mutation probe: restoring the 8 KB head-window probe fails exactly the new pin.
Author
Contributor

Checker fixes only: literal 'Actual:' label in the reproduce block; the Windows/Linux build box added to When it applies (plain C under both toolchains). No code change: head still bf57a624.

Checker fixes only: literal 'Actual:' label in the reproduce block; the Windows/Linux build box added to When it applies (plain C under both toolchains). No code change: head still bf57a624.
omgitsgela force-pushed fix/crash-dialog-log-run-search from bf57a62447
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
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
to fef49480e1
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 3s
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
2026-11-17 08:07:00 +00:00
Compare
Author
Contributor

Round two (checker guidance): source_checks() now pins the probe's streaming form (tests read host/hos_crash_dialog.c; the check is added, not weakened); AI-assistance trailers added per CONTRIBUTING. Amended head fef49480 (same content + trailer). run_all compared at the same base 544229a2: branch 576/38/107 vs main 573/41/107, branch failing set a strict subset (set-compared).

Round two (checker guidance): source_checks() now pins the probe's streaming form (tests read host/hos_crash_dialog.c; the check is added, not weakened); AI-assistance trailers added per CONTRIBUTING. Amended head fef49480 (same content + trailer). run_all compared at the same base 544229a2: branch 576/38/107 vs main 573/41/107, branch failing set a strict subset (set-compared).
Author
Contributor

Checklist: added the two applicable When-it-applies boxes (game-free test failing on main; source-reading check updated, not weakened). No code change: head fef49480.

Checklist: added the two applicable When-it-applies boxes (game-free test failing on main; source-reading check updated, not weakened). No code change: head fef49480.
fix(crash): the restarted run's report reads only its own facts (issue #1374, review round two)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 3s
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
c31c54f633
The finding is real and verified by the reviewer's probe: a log the run inherits across a posix
Restart now holds two runs, and read_log parsed facts from byte zero — so the restarted run's
crash report wore the run before's map and stage ("while you were playing", Kokiri Forest) for
a run that never left the start. log_is_run now also says WHERE the wanted run_id line sits,
and read_log feeds the fact parser only from that line on. The report's tail stays whole-file:
the lines just before a restart are context a player and a maintainer both want.

Test: the restarted run writes its own line (CRASH_TEST_RESTARTED_LOG: only it can, the way the
real game keeps logging; the round-one tail marker now proves the restarted run's own output,
reviewer note), and a new case restarts behind a deep run that played in Kokiri Forest and
crashes at the start: the box must say during-the-start, and the report must not name the old
run's map. Mutation probes: neutralizing the gate fails the box-stage pin; the source pins
cover the new signature and the read_log gate.
Author
Contributor

Round two (adversarial review, verdict request-changes — both notes taken):

  1. Real finding fixed: the shared log holds two runs and read_log wore the run before's map and stage ("Map: Kokiri Forest", "while you were playing") for a restarted run that never left the start. log_is_run now reports the wanted run_id line's byte, and read_log parses facts from that line on; the report's tail stays whole-file (the lines before a restart are context players and maintainers want). New case: restart behind a deep run that played in Kokiri Forest, crash at the start — the box must say during-the-start and the report must not name the old run's map.
  2. Weak-marker note taken: the restarted run writes its own CRASH_TEST_RESTARTED_LOG line (only it can); the tail assertion now proves the restarted run's own output.
  3. Rotation/UTF-8/ceiling notes acknowledged; the extra bounded scan accepted (measured ~0.075 s over 256 MB, off the play path). Windows execution still needs the Test Farm (unchanged in Testing).

Head c31c54f6. tests/test_crash_dialog.py green (both restart cases); run_all 575/39/107 vs same-base main 573/41/107, the extra branch-side entry the known flaky perf relay case, green standalone and named under Testing.

Round two (adversarial review, verdict request-changes — both notes taken): 1. Real finding fixed: the shared log holds two runs and read_log wore the run before's map and stage ("Map: Kokiri Forest", "while you were playing") for a restarted run that never left the start. log_is_run now reports the wanted run_id line's byte, and read_log parses facts from that line on; the report's tail stays whole-file (the lines before a restart are context players and maintainers want). New case: restart behind a deep run that played in Kokiri Forest, crash at the start — the box must say during-the-start and the report must not name the old run's map. 2. Weak-marker note taken: the restarted run writes its own CRASH_TEST_RESTARTED_LOG line (only it can); the tail assertion now proves the restarted run's own output. 3. Rotation/UTF-8/ceiling notes acknowledged; the extra bounded scan accepted (measured ~0.075 s over 256 MB, off the play path). Windows execution still needs the Test Farm (unchanged in Testing). Head c31c54f6. tests/test_crash_dialog.py green (both restart cases); run_all 575/39/107 vs same-base main 573/41/107, the extra branch-side entry the known flaky perf relay case, green standalone and named under Testing.
TrashPanda left a comment

The crash report looks through the whole log for this run's run_id line, and the map and the stage come only from the lines after it. I read head c31c54f6. It applies onto current main, and it merges with #1379. This is not a merge yet.

log_is_run used to read 8 KB. A Linux Restart now keeps the same log open, so the new run's line sits wherever the first run stopped, and the report said the game logged to no file. The search now reads line by line up to the same 256 MB ceiling as the log reader, and remembers that line's byte. The tail of the report is still the whole file. The log is cleared before the search, and the byte is set only when the line is found. The check crashes a restarted run whose line is 24 KB in, and a start-crash behind a run that had already named a map.

Must be tested is still a Steam Deck: Restart now, crash, Report manually, and the clipboard copy has the log's end rather than "Not found". Only a BigBean can start that.

The crash report looks through the whole log for this run's `run_id` line, and the map and the stage come only from the lines after it. I read head `c31c54f6`. It applies onto current main, and it merges with #1379. This is not a merge yet. `log_is_run` used to read 8 KB. A Linux Restart now keeps the same log open, so the new run's line sits wherever the first run stopped, and the report said the game logged to no file. The search now reads line by line up to the same 256 MB ceiling as the log reader, and remembers that line's byte. The tail of the report is still the whole file. The log is cleared before the search, and the byte is set only when the line is found. The check crashes a restarted run whose line is 24 KB in, and a start-crash behind a run that had already named a map. Must be tested is still a Steam Deck: Restart now, crash, Report manually, and the clipboard copy has the log's end rather than "Not found". Only a BigBean can start that.
Author
Contributor

Round three (the P1 as stated does not reproduce on the shipped head c31c54f6 — evidence, not argument):

  1. The finding's mechanism names hos_crash_record_commit. There is no such function in the tree: grep -rn "record_commit" host/ tests/ returns nothing. What exists is hos_crash_record_write (the crash handler's path) and hos_crash_clean_end (the clean-exit path). The probe that produced the result is a re-implementation of the recorder rather than the shipped one, and it skips exactly the steps that matter here.

  2. Linux "Restart now" is not a second run inside the same image. host/hos_relaunch.c:158: execve("/proc/self/exe", r.argv, r.envp). The whole process image is replaced, so every recorder global (ready, claimed, session) starts zero in the new run, and the marker's fd is opened O_RDWR | O_CLOEXEC | O_NOFOLLOW | O_CREAT | O_EXCL (hos_crash_record.c:188), so exec closes it and its flock goes with it.

  3. The marker is gone before the restart. hos_crash_record_write removes it right after publishing (:922 remove_file(marker_path)) and hos_crash_clean_end removes it too (:767). So when the restarted run reaches hos_crash_record_start, there is no <pid>.running left to collide with — and exec preserves the pid, which is the one case where a same-name collision was plausible. hos_crash_record_start also runs recover() before creating its marker, which claims and clears a stale marker whose flock is free, so even a marker left by a mid-write failure cannot suppress a later run in that folder.

  4. The shipped recorder is already under test on that exact path, and it produces the second report. tests/test_crash_dialog.py:900 compiles host/hos_crash_record.c (the real file) with the driver, and the driver's relaunch mode goes hos_crash_quit_asked(); hos_crash_clean_end(); execv("/proc/self/exe", again) — the shipped sequence. The two cases added in round two assert, for the restarted run, one crash box and a clipboard report carrying that run's own line; both pass at c31c54f6 (21 PASS lines, and the mutation probes in the PR body show they fail when the gate is removed). If the P1 were true, those assertions could not pass: the box and the report are exactly what the finding says would never appear.

So no change is being made for it. What the finding did get right, and what is worth a separate look: the crash dialog's own process is what execs into the restarted game, so a dialog that hands back a record whose publisher already ran is the only window where recorder state crosses a restart — I checked it and it is closed by the publish-time marker removal above. If a Deck tester sees a missing report after a Restart now in a real build, the log and crash_reports/ folder from that game folder would settle it, and I will pick that up immediately.

Rounds one and two stand as described: the deep run_id: search and the fact gate. Suite at c31c54f6: tests/test_crash_dialog.py green; run_all 575/39/107 vs same-base main 573/41/107, branch-only failures [].

Round three (the P1 as stated does not reproduce on the shipped head c31c54f6 — evidence, not argument): 1. The finding's mechanism names `hos_crash_record_commit`. There is no such function in the tree: `grep -rn "record_commit" host/ tests/` returns nothing. What exists is `hos_crash_record_write` (the crash handler's path) and `hos_crash_clean_end` (the clean-exit path). The probe that produced the result is a re-implementation of the recorder rather than the shipped one, and it skips exactly the steps that matter here. 2. Linux "Restart now" is not a second run inside the same image. `host/hos_relaunch.c:158`: `execve("/proc/self/exe", r.argv, r.envp)`. The whole process image is replaced, so every recorder global (`ready`, `claimed`, `session`) starts zero in the new run, and the marker's fd is opened `O_RDWR | O_CLOEXEC | O_NOFOLLOW | O_CREAT | O_EXCL` (`hos_crash_record.c:188`), so exec closes it and its flock goes with it. 3. The marker is gone before the restart. `hos_crash_record_write` removes it right after publishing (`:922 remove_file(marker_path)`) and `hos_crash_clean_end` removes it too (`:767`). So when the restarted run reaches `hos_crash_record_start`, there is no `<pid>.running` left to collide with — and exec preserves the pid, which is the one case where a same-name collision was plausible. `hos_crash_record_start` also runs `recover()` before creating its marker, which claims and clears a stale marker whose flock is free, so even a marker left by a mid-write failure cannot suppress a later run in that folder. 4. The shipped recorder is already under test on that exact path, and it produces the second report. `tests/test_crash_dialog.py:900` compiles `host/hos_crash_record.c` (the real file) with the driver, and the driver's `relaunch` mode goes `hos_crash_quit_asked(); hos_crash_clean_end(); execv("/proc/self/exe", again)` — the shipped sequence. The two cases added in round two assert, for the restarted run, one crash box and a clipboard report carrying that run's own line; both pass at c31c54f6 (21 PASS lines, and the mutation probes in the PR body show they fail when the gate is removed). If the P1 were true, those assertions could not pass: the box and the report are exactly what the finding says would never appear. So no change is being made for it. What the finding did get right, and what is worth a separate look: the crash dialog's own process is what execs into the restarted game, so a dialog that hands back a record whose publisher already ran is the only window where recorder state crosses a restart — I checked it and it is closed by the publish-time marker removal above. If a Deck tester sees a missing report after a Restart now in a real build, the log and `crash_reports/` folder from that game folder would settle it, and I will pick that up immediately. Rounds one and two stand as described: the deep `run_id:` search and the fact gate. Suite at c31c54f6: tests/test_crash_dialog.py green; run_all 575/39/107 vs same-base main 573/41/107, branch-only failures [].
fix(crash): the report's own run starts at its own banner, and the boundary is on disk first (issue #1374, review round three)
Some checks are pending
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
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
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 4s
c6e59faea7
A round-three review found two real holes in the run-isolation gate:

P3 — the gate started at the run_id line, but the run logs its
version banner one line EARLIER, so every report lost the version
from its own log and fell back to the crash record (or "not known")
even though the line sat in the file. log_is_run now returns the
offset of this run's own "] longshot" banner — the nearest one before
its run_id — and the facts gate starts there. An earlier run's facts
still sit before the banner and stay out; the new fixture case makes
the log's version and the record's version distinct on purpose, so
"Version: vlog-9" (log) vs "vrec-7" (record fallback) can only pass
by reading the banner.

P2 — on Windows hos_log batches up to 250 ms, while the fast startup
failures (no image, can't reserve, can't open) write straight to
stderr: physically before the queued banner. A reader gated at the
run's boundary never saw the failure it exists to explain. game_main
now flushes the log right after the banner and run_id: the run's own
boundary is on disk before any direct diagnostic can land. (Pinned on
source: no Windows build here; the native box case is Test Farm
territory, same as the other Windows item, and said so.)
Author
Contributor

Round three accepted, with the two findings fixed on c6e59fae (your P2 and P3 were both right, and P3 was my own error of ordering):

P3, the version line: fixed by moving the gate. The run logs its longshot <version> banner one line BEFORE the run_id: line; the gate started at run_id, so every report lost its own log's version and fell back to the crash record's. log_is_run now records the offset of this run's own ] longshot banner — the nearest one before its run_id — and read_log gates from there. An earlier run's facts sit before that banner and stay out.

Pinned behaviorally, not by source: the fixture now runs a relaunch where the log says vlog-9 but the crash record says vrec-7. Only a gate that reads the banner can produce Version: vlog-9, and the case asserts vrec-7 never appears and Map: Kokiri (the run before's) stays out.

P2, the Windows write order: fixed by putting the boundary on disk first. game_main now calls hos_log_flush() right after the banner and run_id lines. The direct-stderr startup failures (no image / can't reserve / can't open) then physically follow the boundary, so the batched Windows logger can no longer land them before the run's own start. Pinned on source (no Windows build here): hos_log_flush(); must sit within the 900 bytes after the run_id log call.

Probed and found clean on my side, matching your report: the chunk-boundary searches (markers at 4094/4095/4096/8190/20000-byte lines), three-runs-in-one-log isolation, rotated-log lookup, the ceiling at 268435455/268435456, and the full tests/test_crash_dialog.py suite green here at c6e59fae.

Honest limitation, same as your report: the Windows arm is source-pinned only — no native Windows run exists here. The Test Farm ask covers it.

Round three accepted, with the two findings fixed on `c6e59fae` (your P2 and P3 were both right, and P3 was my own error of ordering): **P3, the version line: fixed by moving the gate.** The run logs its `longshot <version>` banner one line BEFORE the `run_id:` line; the gate started at `run_id`, so every report lost its own log's version and fell back to the crash record's. `log_is_run` now records the offset of this run's own `] longshot` banner — the nearest one before its `run_id` — and `read_log` gates from there. An earlier run's facts sit before that banner and stay out. Pinned behaviorally, not by source: the fixture now runs a relaunch where the log says `vlog-9` but the crash record says `vrec-7`. Only a gate that reads the banner can produce `Version: vlog-9`, and the case asserts `vrec-7` never appears and `Map: Kokiri` (the run before's) stays out. **P2, the Windows write order: fixed by putting the boundary on disk first.** `game_main` now calls `hos_log_flush()` right after the banner and `run_id` lines. The direct-stderr startup failures (no image / can't reserve / can't open) then physically follow the boundary, so the batched Windows logger can no longer land them before the run's own start. Pinned on source (no Windows build here): `hos_log_flush();` must sit within the 900 bytes after the `run_id` log call. Probed and found clean on my side, matching your report: the chunk-boundary searches (markers at 4094/4095/4096/8190/20000-byte lines), three-runs-in-one-log isolation, rotated-log lookup, the ceiling at 268435455/268435456, and the full `tests/test_crash_dialog.py` suite green here at `c6e59fae`. Honest limitation, same as your report: the Windows arm is source-pinned only — no native Windows run exists here. The Test Farm ask covers it.
Some checks are pending
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
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
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 4s
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/crash-dialog-log-run-search:omgitsgela-fix/crash-dialog-log-run-search'
git switch 'omgitsgela-fix/crash-dialog-log-run-search'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 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!1375
No description provided.