tooling: add a run end-point section to the startup triage report #1940

Merged
tedin7 merged 3 commits from upstream-pr/1947 into main 2026-11-24 23:59:23 +00:00
tedin7 commented 2026-11-24 21:59:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T21:59:02Z.


Refs #1758, #870.

A report of a startup run is only comparable with another one if both say how far the run got and how it ended: the memory cap is not enough (#1758 asks for cap, peak commit and end exception). Today the triage report reads none of that, so reports on #870 mix the runs by hand. This adds a Run End-Point section to tools/startup/triage_run.py.

Change

The section is built from the same kind of allowlisted values as the rest of the tool:

Item Source Copied
Peak commit the largest commit peak=N MiB of the x2w-dstorage heartbeat lines (not the last one) the decimal N
Last heartbeat the highest heartbeat N s: second the decimal N
Failed requests by cause the last failed requests by cause line of #1781 (the later second wins) the second, and the count of each of the eight fixed cause names
First and last stop event the `exception ... first-chance second-chancelines ofdebug_launch.py's events.txt`

Exceptions that debug_launch.py steps over (loader and assertion breakpoint, single step, thread name, debug print) are not stop events. A value the log does not carry is not reported. A code that is not exactly eight hex digits, a count that is not decimal and a cause name outside the fixed eight are ignored. Module names, paths, addresses and exception parameters are never copied. The new reads never replace the existing classification of a line: RunEndpoint.observe only reads, and the line is classified as before.

The tool still has no dependency outside the standard library. debug_launch.py and the producers are not edited.

Tests (tests/startup_triage_run_check.py, synthetic logs only)

  • A complete run: several heartbeats with a lower peak after a higher one, two cause lines, an events.txt with a loader breakpoint, a thread name, a first-chance C++ exception and a second-chance access violation. Checks the maximum peak, the last second, the last cause counts, the first and last stop and the stop count.
  • A run with no commit peak= (cause line only; a commit unknown heartbeat; an empty directory): not reported.
  • A run with a second stop: the same code first-chance then second-chance.
  • Hostile lines: a path, a link, an address inside the exception line, a nine-or-more digit code, a non-decimal peak, a cause value that is an address, an unknown cause name. None of it may appear.
  • Four mutations are applied in the test and each must be caught: the peak taken from the last line, an earlier cause line replacing a later one, a code pattern that is not limited to 32 bits, and every exception counted as a stop. I also broke _keep_peak and _is_later_sample in the source by hand and the check failed each time (1 and 3 failures); both were restored.

Verified (Linux only)

  • python3 -B tests/startup_triage_run_check.py: 0 failed.
  • git diff --check origin/main, tests/docs_links_check.py, tests/bidi_controls_check.py: pass.
  • git merge-tree --write-tree against the head of all 119 open PRs (among them #1408, #1801, #1794, #1251, #1229): no conflict that does not already exist between that PR and origin/main (38 PRs already conflict with main), and no conflict with origin/main itself. No open PR touched triage_run.py or the check when I looked.

Not run

  • No real run log: the line formats come from xcrdapi.cpp (heartbeat and cause line), startup_heartbeat_check.py and debug_launch.py. If a producer changes a format, the section reports not reported instead of a wrong value.

AI-assisted; commands listed were executed locally.


Replaces closed draft #1816 (rebased cleanly on origin/main).
AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6592241361 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1947). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T21:59:02Z. --- Refs #1758, #870. A report of a startup run is only comparable with another one if both say how far the run got and how it ended: the memory cap is not enough (#1758 asks for cap, peak commit and end exception). Today the triage report reads none of that, so reports on #870 mix the runs by hand. This adds a `Run End-Point` section to `tools/startup/triage_run.py`. ## Change The section is built from the same kind of allowlisted values as the rest of the tool: | Item | Source | Copied | |---|---|---| | Peak commit | the largest `commit peak=N MiB` of the `x2w-dstorage heartbeat` lines (not the last one) | the decimal `N` | | Last heartbeat | the highest `heartbeat N s:` second | the decimal `N` | | Failed requests by cause | the last `failed requests by cause` line of #1781 (the later second wins) | the second, and the count of each of the eight fixed cause names | | First and last stop event | the `exception <code> ... first-chance|second-chance` lines of `debug_launch.py`'s `events.txt` | the 32-bit code, lowercase, and the chance | Exceptions that `debug_launch.py` steps over (loader and assertion breakpoint, single step, thread name, debug print) are not stop events. A value the log does not carry is `not reported`. A code that is not exactly eight hex digits, a count that is not decimal and a cause name outside the fixed eight are ignored. Module names, paths, addresses and exception parameters are never copied. The new reads never replace the existing classification of a line: `RunEndpoint.observe` only reads, and the line is classified as before. The tool still has no dependency outside the standard library. `debug_launch.py` and the producers are not edited. ## Tests (`tests/startup_triage_run_check.py`, synthetic logs only) - A complete run: several heartbeats with a lower peak after a higher one, two cause lines, an `events.txt` with a loader breakpoint, a thread name, a first-chance C++ exception and a second-chance access violation. Checks the maximum peak, the last second, the last cause counts, the first and last stop and the stop count. - A run with no `commit peak=` (cause line only; a `commit unknown` heartbeat; an empty directory): `not reported`. - A run with a second stop: the same code first-chance then second-chance. - Hostile lines: a path, a link, an address inside the exception line, a nine-or-more digit code, a non-decimal peak, a cause value that is an address, an unknown cause name. None of it may appear. - Four mutations are applied in the test and each must be caught: the peak taken from the last line, an earlier cause line replacing a later one, a code pattern that is not limited to 32 bits, and every exception counted as a stop. I also broke `_keep_peak` and `_is_later_sample` in the source by hand and the check failed each time (1 and 3 failures); both were restored. ## Verified (Linux only) - `python3 -B tests/startup_triage_run_check.py`: 0 failed. - `git diff --check origin/main`, `tests/docs_links_check.py`, `tests/bidi_controls_check.py`: pass. - `git merge-tree --write-tree` against the head of all 119 open PRs (among them #1408, #1801, #1794, #1251, #1229): no conflict that does not already exist between that PR and `origin/main` (38 PRs already conflict with `main`), and no conflict with `origin/main` itself. No open PR touched `triage_run.py` or the check when I looked. ## Not run - No real run log: the line formats come from `xcrdapi.cpp` (heartbeat and cause line), `startup_heartbeat_check.py` and `debug_launch.py`. If a producer changes a format, the section reports `not reported` instead of a wrong value. AI-assisted; commands listed were executed locally. --- Replaces closed draft #1816 (rebased cleanly on origin/main). AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot commented 2026-11-24 23:03:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:05:11Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ef9a0798fc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6048145223 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1947#pullrequestreview-6048145223). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T22:05:11Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `ef9a0798fc` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
chatgpt-codex-connector[bot commented 2026-11-24 23:03:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:02:08Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T22:05:13.881066Z ef9a079 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7145714692 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1947#issuecomment-7145714692). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T22:02:08Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"ef9a0798fc9617f2823db6c76bbd368b2109d9d7","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T22:05:13.881066Z">2026-11-24T22:05:13.881066Z</relative-time> | `ef9a079` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
ChazY11 commented 2026-11-24 23:03:37 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T22:16:14Z.


Ran it, broke three rules, two caught

Windows 11 build 26300.9974:

out/pe-env/Scripts/python.exe -B tests/startup_triage_run_check.py
startup triage_run checks: 0 failed      exit 0

Mutations to tools/startup/triage_run.py, each reverted:

mutation result
_keep_peak: max(old, new) → new (last peak wins) caught
NON_STOP_EXCEPTIONS → set() (first-chance codes counted as run stops) caught
_is_later_sample: new_second >= old_second → True not caught

The peak case is covered by design — the fixture already carries HEARTBEAT_COMMIT.format(second=299, peak=14000, …) with the
comment "a lower peak after a higher one", which is exactly the line that catches it.

The survivor: no case has a heartbeat that goes backwards

_is_later_sample guards updating the recorded second, peak and failure cause from heartbeat lines, and the fixture feeds seconds
20 → 290 → 299, i.e. monotonic. With the guard forced to True, a log whose lines are not in time order lets an earlier
sample overwrite the run's end second, so the report says the run got less far than it did — and since the end second is what a
reader uses to compare two runs (#1758's whole purpose), that is a wrong number rather than a missing one.

One case closes it, in the shape the file already uses:

def test_a_later_line_does_not_move_the_end_second_backwards(self):
    bundle = {
        "stderr.txt": (HEARTBEAT_COMMIT.format(second=299, peak=16208, current=15000) + "\n"
                       + HEARTBEAT_COMMIT.format(second=290, peak=16000, current=14000) + "\n"),
    }
    report = build(bundle)
    self.assertIn("| Last heartbeat | `299` s |", report)
    self.assertIn("16208", report)          # and the peak stays the larger one

Without the guard, 299 is replaced by 290.

What the section gets right

  • The regexes are bounded (\d{1,10}), and only decimal counts, the fixed FAILURE_CAUSES names and the 32-bit exception code
    with its chance are copied — the module names, paths, addresses and exception parameters are dropped, which is the right
    allowlist direction for a report that gets pasted into an issue.
  • NON_STOP_EXCEPTIONS is a named set with the reason in the comment, so a later reader can check the four codes against
    debug_launch.py instead of guessing why 0x80000003 is excluded.
  • Splitting _keep_peak and _is_later_sample into two named helpers is what let me test them apart; please keep it that way.

What this does not establish

Nothing about a real run: the fixture is synthetic stderr and an events file. Whether debug_launch.py emits the heartbeat lines
in order is not something this test checks, and that is precisely why the backwards case is worth pinning rather than assuming.

Verdict

Reviewed. Two of the three rules are pinned and the allowlist is careful; the ordering guard has no case.

Notes

  • AI-assisted review.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7146020345 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1947#issuecomment-7146020345). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T22:16:14Z. --- ## Ran it, broke three rules, two caught Windows 11 build 26300.9974: ```powershell out/pe-env/Scripts/python.exe -B tests/startup_triage_run_check.py startup triage_run checks: 0 failed exit 0 ``` Mutations to `tools/startup/triage_run.py`, each reverted: | mutation | result | |---|---| | `_keep_peak`: `max(old, new)` → `new` (last peak wins) | **caught** | | `NON_STOP_EXCEPTIONS` → `set()` (first-chance codes counted as run stops) | **caught** | | **`_is_later_sample`: `new_second >= old_second` → `True`** | **not caught** | The peak case is covered by design — the fixture already carries `HEARTBEAT_COMMIT.format(second=299, peak=14000, …)` with the comment "a lower peak after a higher one", which is exactly the line that catches it. ## The survivor: no case has a heartbeat that goes backwards `_is_later_sample` guards updating the recorded second, peak and failure cause from heartbeat lines, and the fixture feeds seconds `20 → 290 → 299`, i.e. monotonic. With the guard forced to `True`, a log whose lines are not in time order lets an **earlier** sample overwrite the run's end second, so the report says the run got less far than it did — and since the end second is what a reader uses to compare two runs (#1758's whole purpose), that is a wrong number rather than a missing one. One case closes it, in the shape the file already uses: ```python def test_a_later_line_does_not_move_the_end_second_backwards(self): bundle = { "stderr.txt": (HEARTBEAT_COMMIT.format(second=299, peak=16208, current=15000) + "\n" + HEARTBEAT_COMMIT.format(second=290, peak=16000, current=14000) + "\n"), } report = build(bundle) self.assertIn("| Last heartbeat | `299` s |", report) self.assertIn("16208", report) # and the peak stays the larger one ``` Without the guard, `299` is replaced by `290`. ## What the section gets right - The regexes are bounded (`\d{1,10}`), and only decimal counts, the fixed `FAILURE_CAUSES` names and the 32-bit exception code with its chance are copied — the module names, paths, addresses and exception parameters are dropped, which is the right allowlist direction for a report that gets pasted into an issue. - `NON_STOP_EXCEPTIONS` is a named set with the reason in the comment, so a later reader can check the four codes against `debug_launch.py` instead of guessing why 0x80000003 is excluded. - Splitting `_keep_peak` and `_is_later_sample` into two named helpers is what let me test them apart; please keep it that way. ## What this does not establish Nothing about a real run: the fixture is synthetic stderr and an events file. Whether `debug_launch.py` emits the heartbeat lines in order is not something this test checks, and that is precisely why the backwards case is worth pinning rather than assuming. ## Verdict Reviewed. Two of the three rules are pinned and the allowlist is careful; the ordering guard has no case. ## Notes - AI-assisted review.
chatgpt-codex-connector[bot commented 2026-11-24 23:03:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T22:05:11Z.

Code review location: tools/startup/triage_run.py; line 101

@@ -82,6 +83,75 @@
 ]
 
 
+# Run end-point: how far a run got and how it ended. Only decimal counts, the fixed failure-cause names of the
+# DirectStorage heartbeat and the 32-bit exception code with its chance are copied; the rest of those lines (module
+# names, paths, addresses, exception parameters) is dropped.
+FAILURE_CAUSES = (
+    "read-at-or-past-eof",
+    "read-crossing-eof",
+    "read-other",
+    "destination-capacity",
+    "destination-not-writable",
+    "zlib",
+    "bcpack",
+    "other",
+)
+# Codes debug_launch.py logs as exceptions but steps over (loader breakpoint, assertion continuation, single step,
+# thread names, debug prints); they are not run stops.
+NON_STOP_EXCEPTIONS = {"0x80000003", "0x80000004", "0x406d1388", "0x40010006"}

P2 Badge Preserve breakpoint exceptions that actually stop the run

When a run ends on a main-image breakpoint, this blacklist drops its terminal 0x80000003 event along with the loader breakpoint. The inspected tools/startup/debug_launch.py:608–615 only continues main-image breakpoints while the configured assertion budget remains; otherwise they stop the run, and tools/startup/run.ps1:21 defaults that budget to zero. A synthetic log containing the loader breakpoint followed by the stopping breakpoint consequently reports both stop events as not reported and a stop count of zero. If earlier exceptions exist, the report instead leaves an unrelated exception as the last stop. Distinguish continued breakpoint events from the actual stopping event rather than excluding the exception code unconditionally.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4687178759 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1947#discussion_r4687178759). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T22:05:11Z. **Code review location:** `tools/startup/triage_run.py`; line 101 ~~~~diff @@ -82,6 +83,75 @@ ] +# Run end-point: how far a run got and how it ended. Only decimal counts, the fixed failure-cause names of the +# DirectStorage heartbeat and the 32-bit exception code with its chance are copied; the rest of those lines (module +# names, paths, addresses, exception parameters) is dropped. +FAILURE_CAUSES = ( + "read-at-or-past-eof", + "read-crossing-eof", + "read-other", + "destination-capacity", + "destination-not-writable", + "zlib", + "bcpack", + "other", +) +# Codes debug_launch.py logs as exceptions but steps over (loader breakpoint, assertion continuation, single step, +# thread names, debug prints); they are not run stops. +NON_STOP_EXCEPTIONS = {"0x80000003", "0x80000004", "0x406d1388", "0x40010006"} ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Preserve breakpoint exceptions that actually stop the run** When a run ends on a main-image breakpoint, this blacklist drops its terminal `0x80000003` event along with the loader breakpoint. The inspected `tools/startup/debug_launch.py:608–615` only continues main-image breakpoints while the configured assertion budget remains; otherwise they stop the run, and `tools/startup/run.ps1:21` defaults that budget to zero. A synthetic log containing the loader breakpoint followed by the stopping breakpoint consequently reports both stop events as `not reported` and a stop count of zero. If earlier exceptions exist, the report instead leaves an unrelated exception as the last stop. Distinguish continued breakpoint events from the actual stopping event rather than excluding the exception code unconditionally. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
upstream-sync closed this pull request 2026-11-25 00:04:43 +00:00
R0Y00 commented 2026-11-25 01:01:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T23:50:35Z.


I pushed a follow-up for the existing breakpoint finding and ChazY11’s out-of-order heartbeat control. The debugger now emits the code and chance only when it actually stops. The triage script distinguishes that result from observed exceptions and can also read the existing legacy summary. The source-built Windows debugger fixture confirms exactly one terminal breakpoint marker and none for its continue-to-exit control. The triage and documentation checks passed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147856092 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1947#issuecomment-7147856092). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T23:50:35Z. --- I pushed a follow-up for the existing breakpoint finding and ChazY11’s out-of-order heartbeat control. The debugger now emits the code and chance only when it actually stops. The triage script distinguishes that result from observed exceptions and can also read the existing legacy summary. The source-built Windows debugger fixture confirms exactly one terminal breakpoint marker and none for its continue-to-exit control. The triage and documentation checks passed locally.
R0Y00 commented 2026-11-25 01:02:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T23:55:27Z.


The main merge is now on this branch. I kept both the existing shader-reason coverage and the new endpoint cases. The synthetic triage suite, docs links and combined Windows debugger probe passed, including default-disabled call hooks and the explicit terminal breakpoint.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147943490 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1947#issuecomment-7147943490). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T23:55:27Z. --- The main merge is now on this branch. I kept both the existing shader-reason coverage and the new endpoint cases. The synthetic triage suite, docs links and combined Windows debugger probe passed, including default-disabled call hooks and the explicit terminal breakpoint.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1940
No description provided.