tooling: report the startup exit code and last presented frame #3178
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3178
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3176"
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?
@lambirou on GitHub · 2026-11-27 20:26 UTC · original
lambirou:codex/exit-code-trace→main· +474 −0 · 5 files · 2 commits · merged 2026-11-27 22:25 UTCChanges
Adds
tools/startup/exit_report.py, a bounded reader for the existing startup logs that answers one question: how did the run end, and what was the last presented frame?It reports the
EXIT_PROCESScode, one of six fixed labels (clean exit,nonzero exit,exception stop,timeout,stopped by request,missing exit event), the end time, the highestx2w-d3d12 heartbeatpresent sample and the lastx2w-render presented surface. It never copies input paths, module names, raw addresses, exception parameters or free-form text.Validation
The synthetic check covers a clean exit, a nonzero exit, an exception stop, a timeout, a stop-file request, a missing exit event, filtered first-chance events, hostile paths and addresses, the highest present sample and the JSON form.
Limits
The tool is a receipt, not a fix. It distinguishes a nonzero exit from an exception stop and correlates it with the last present, but it does not identify the runtime or title code path that called
ExitProcess. That needs a breakpoint or a runtime hook. The current 307.6 s run was not available locally, so the checked results are synthetic.Refs #870.
Review update (2026-11-27,
e67aa6ed)Both findings are fixed.
_read_logsnow reads each file once, caps it at 16 MiB, andsummarizeparses exactly those lines. The second uncapped read is gone.finished.txtis parsed after the other logs, so its exit code and end time are authoritative over an earlierevents.txtduplicate.The synthetic check adds the 17 MiB heartbeat-after-cap control, a conflicting
finished.txt/events.txtexit pair, an out-of-order heartbeat split across files, and a counted second-chance0x80000003.startup_exit_report_check,docs_links_checkandbidi_controls_checkpass. CI is running one67aa6ed.@pigalot on GitHub · 2026-11-27 21:50 UTC · original · requested changes
Independently reviewed
33bd9f10integrated overmainc15a73a5(treedbb3164b). The merge is clean andgit diff --cached --check origin/mainis clean.What I traced. I checked the regexes against what
tools/startup/debug_launch.pywrites:events.txtgets<t> exit 0x…;finished.txtgetsprocess exited with … after … s,timeout after … sorstopped by request after … s (stop file)(debug_launch.py:955-958).The classification order is exception stop > timeout > stop request > exit code. The report prints only the allowlisted fields. The hostile-input and filtered first-chance cases in the check hold.
What I ran.
The check is new; it does not exist on
main.Findings.
_read_logsreads each file withread_bytes()[:MAX_BYTES], butsummarizediscards the lines it returns.summarizethen reads every file again with an uncappedpath.read_text(...).stdout.txtwhose heartbeat line comes after the first 16 MiB, plusevents.txt=12.500 exit 0x00000000. The report shows| Last present | \99` frames at `12` s (`8.25` fps overall) |`, a line the cap should have excluded.[:MAX_BYTES]survives: the capped read has no effect._read_logsreturns, in the intended file order, and drop the second read.finished.txtis not authoritative. The comment insummarizesays it is parsed first "so an earlier duplicate event cannot overwrite a later exit code". Butobserveassignsexit_codeandend_elapsed_sunconditionally, so whichever file is parsed last wins.finished.txt=process exited with 0x00000005 after 10.00 s,events.txt=3.000 exit 0x00000000.Exit code 0x00000000,clean exit,End time 3.0 s. Expected from the comment:0x00000005,nonzero exit,10.0 s.finished.txtlast or makeobservekeep the first value, and pin it with a case like the one above.Mutants in
tools/startup/exit_report.py, each run againsttests/startup_exit_report_check.pyand restored afterwards (git diff --quietclean):FILTERED_FIRST_CHANCEemptiedfinished.txt/run.outfirst pass removed[:MAX_BYTES]removeddebug_launch.pywrites only one of themdebug_launch.pyprints lowercase hexNon-blocking. Two survivors are real gaps in the check:
stdout.txtandstderr.txt, would pin it.0x80000003that must still be counted.Verdict: changes requested on
33bd9f10for findings 1 and 2.Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10. No GPU tests ran.
CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass on33bd9f10.This reply was AI-assisted.
@lambirou on GitHub · 2026-11-27 22:11 UTC · original
Review update (2026-11-27,
e67aa6ed)Both findings are fixed.
_read_logsnow reads each file once, caps it at 16 MiB, andsummarizeparses exactly those lines. The second uncapped read is gone.finished.txtis parsed after the other logs, so its exit code and end time are authoritative over an earlierevents.txtduplicate.The synthetic check adds the 17 MiB heartbeat-after-cap control, a conflicting
finished.txt/events.txtexit pair, an out-of-order heartbeat split across files, and a counted second-chance0x80000003.startup_exit_report_check,docs_links_checkandbidi_controls_checkpass. CI is running one67aa6ed.@lambirou on GitHub · 2026-11-27 22:19 UTC · original
@pigalot the 16 MiB bound and
finished.txtauthority are fixed one67aa6ed, with the cap and conflicting-exit controls. Could you re-review?@pigalot on GitHub · 2026-11-27 22:25 UTC · original · approved these changes
Retested
e67aa6edintegrated overmainf6206217(treed7e1a869). The merge is clean andgit diff --cached --check origin/mainis clean.Earlier findings (my changes-requested review on
33bd9f10)._read_logsnow returns the capped lines per file, andsummarizeparses only those, with no second read. The newboundedcase is my repro (a 16 MiB + 10 Bstdout.txtwhose heartbeat line comes after the cap). It now reportsLast present | not reported.finished.txtnot authoritative: addressed.finished.txtandrun.outare parsed after the other logs, so their exit code and end time win. The newfinished authoritycase is my repro and expects0x00000005,nonzero exitand10.0s.The two non-blocking gaps are also covered:
highest heartbeatputs the higher sample instderr.txt, which is parsed beforestdout.txt, and a second-chance0x80000003must be counted.What I ran.
Mutants in
tools/startup/exit_report.py. Each was applied alone, the check run, and the source restored afterwards (git diff --quietclean).[:MAX_BYTES]removedbounded)finished.txt/run.outparsed before the other logsfinished authority)finished.txtno longer parsedhighest heartbeat)FILTERED_FIRST_CHANCEemptieddebug_launch.pywrites only one of themdebug_launch.pyprints lowercase hexVerdict: approve on
e67aa6ed. This supersedes my changes-requested review on33bd9f10.Environment: Windows 11 25H2 build 26200.9974; Python 3.12.10. No GPU tests ran.
CI:
Build and test on Windows,Assemble and translate gfx1013 fixturesandRun platform-independent Python checks on Linuxpass one67aa6ed.This reply was AI-assisted.