tooling: allow startup diagnostics without time or assertion limits #1787
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1794"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by SuperCraft3M on 2026-11-24T18:46:46Z.
Change
Allow
debug_launch.py --timeout 0to run until process exit or a debugger stop.--continue-asserts -1removes the count limit on first-chance main-image diagnostic breakpoints. Explicit stop sites, second-chance faults and positive timeout values retain their existing behavior. The regular diagnostic defaults stay bounded.Verification
Windows 11, MSVC 19.44 Debug, base
b9f355f1. Executedpython -B out/startup-no-deadline-pr/tests/startup_debug_check.py C:/Xbox2Windows-build/startup_debug_probe.exefrom the local integration tree, with TEMP/TMP set to an ASCII temporary directory. The source-built probe exits normally in unlimited mode. A limit of one assertion stops on its second breakpoint and a one-second timeout still interrupts the sleeping probe. The existing debug checks also pass.AI-assisted (Codex).
upstream-sync referenced this pull request2026-11-24 19:01:36 +00:00
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:21:42Z.
Review: COMMENTED
Review of head
052f538014f4e6d51359cef1efbf1373dcd2c5fa(comment only, not an approval). First review of this PR; I read the diff against currentmain.Verdict: 0 P1 / 0 P2, three P3. The change is small and does what the description says; the first two points below concern what a user can trip over, the third a test gap.
What the diff does
--timeout 0leaves the deadline off (while not timeout or ...),--continue-asserts -1removes the count limit (skip_asserts == -1 or sum(...) < skip_asserts), and a negative or non-finite timeout or a limit below -1 is refused with exit 2. The job object is created with kill-on-close (debug_launch.py:82-87) andDebugSetProcessKillOnExit(True), so an unlimited run does not outlive the debugger.Findings
run.ps1 -Seconds 0now means "no limit".tools/startup/run.ps1:18takes[int]$Secondswith no range check and passes it as--timeout. Before this change 0 skipped the loop and reported a timeout at once; now a hung run of-Seconds 0never ends on its own (a CI job would wait for its own limit).docs/startup-runtime.mdand therun.ps1help do not mention the new meaning of 0 or of-ContinueAsserts -1; only the docstring ofdebug_launch.pydoes.events.txt(log(...)atdebug_launch.py:~594, before the continue decision), so--timeout 0 --continue-asserts -1on a title that hits anint3in a loop growsevents.txtwithout bound. The "asserts continued: ..." summary is printed only in the timeout branch (:~725), so a run that ends by exit or stop does not list them either.tests/startup_debug_check.pyadds three runs (unlimited,--continue-asserts 1with timeout 0, finite 1 s timeout with -1), which cover the new paths. No test passes--timeout -1,nan,infor--continue-asserts -2and checks for exit 2 and the message. Exit 2 is also whatrun.ps1documents as "the process could not be created".Checked, no finding
dict(zip(argv[4::2], argv[5::2]))keeps the last of two equal options, so the test's--timeout 0after the harness's--timeout 30takes effect.-0.0counts as 0 (unlimited),nanandinfare refused;asserts_seengrows by distinct addresses only.startup_debug_probe) waits 3 s, so the "finite" case (timeout 1 s) must time out and the "unlimited" case must exit; with a broken stop the harness would end at its own 120 ssubprocesslimit rather than hang.Commands run (Linux)
python3 -I -m py_compileon both files;tests/docs_links_check.py(17 files, 367 links),tests/bidi_controls_check.py(1305 files),git diff --check origin/main...HEAD: clean.git merge-treeagainst currentmain: no conflicts.tests/startup_debug_check.pyneed Windows (ctypes.windll), so they were not run. Instead I took the three changed predicates (the validation, the assertion limit and the loop condition) from the source text and evaluated them over a table of 23 inputs (timeouts 15, 0, -0.0, 1.5, negative,inf,nan; limits -100 to 10): all as intended. Two mutations were detected by that table (assertion floor -1 changed to -2; unlimited assertions keyed on 0 instead of -1), and two more broke the extraction itself, so they do not count. This is a model of the decisions, not a run of the debugger. Source restored after each mutation,git status --shortclean.Limits: Linux only. The Windows 2025 runner script could not be used in this session, and the description's Windows 11 run was not reproduced here.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T19:55:49Z.
Ran it; the two new behaviours are pinned, the input guard is not
At the PR head, Windows 11 build 26300.9974, MSVC 19.44 Debug:
Three mutations to
tools/startup/debug_launch.py, each reverted and re-run:while not timeout or time.time() - start < timeout:→while time.time() - start < timeout:(skip_asserts == -1 or sum(...) < skip_asserts)→(sum(...) < skip_asserts)if timeout < 0 or not timeout < float("inf") or skip_asserts < -1:guard →if False:So "timeout of zero runs to exit" and "assertion limit of -1 means no limit" both fail when reverted, which is what the three
new controls claim.
The guard is dead code today
The validation added at the same time never runs in the fixture:
Deleting it entirely leaves the check green. That is not a defect — a rejection path for input the test does not produce is
normal — but since
--timeout -1used to mean "thewhileloop never runs, exit immediately", turning it into "exit 2 witha message" is a behaviour change nobody will notice until they pass a negative number. One line in the check —
run(..., options=("--timeout", "-1"))and assert the message plus exit 2 — would cover it, or the guard can go and thefloatconversion left to fail on its own.The one thing I would add before merge
--timeout 0means "no timer", and the check runs it underctest, whosestartup_debugproperty isTIMEOUT 300. A probethat hangs in unlimited mode therefore burns five minutes of CI per occurrence instead of failing fast. That is acceptable
for a diagnostic lane, but the description would read better if it said so, because "we removed the timeout" plus "the test
is still bounded by 300 s" is the kind of pair a reader will otherwise have to reconstruct.
Otherwise
The diff is behaviour-only and stays inside the launcher and its check; the docstring update matches what the code now does
("A timeout of zero disables the timer. An assertion continuation limit of -1 removes that limit."), and the existing
bounded defaults are untouched.
Verdict
Reviewed. Two of three edits are load-bearing; the guard is unreachable in the fixture, which I would either cover with one
line or drop.
Notes
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:29:24Z.
Review: COMMENTED
Review of head
8aafa3534ee89a407793d29d4be0a045e88bbbf3.Summary:
--timeout 0disables the deadline and--continue-asserts -1removes the diagnostic-breakpoint cap. Defaults and positive values are unchanged. Title is neutral, the PR is mergeable, and the Linux and Windows CI jobs pass.Checked
tools/startup/debug_launch.py: the loopwhile not timeout or time.time() - start < timeoutis correct for 0. The-1check(skip_asserts == -1 or sum(...) < skip_asserts)leaves thestop_atexclusion intact. SoX2W_STOP_ATsites still stop, and second-chance faults still stop.infandnantimeouts and limits below -1. It runs before any process is created, so a bad value returns 2 with no side effects.-1value parses correctly, because options are read as plain argv pairs, not as flags.tests/startup_debug_check.py: three new cases cover unlimited exit, a cap of 1 stopping at the second site, and a finite 1s timeout still firing. They assert on observable output.Findings
--timeout -1) has no test. It is a one-line check, so this is optional.--timeout 0and a hung target, the session never ends on its own. This is the intended behavior and the docstring says so. Callers such asstartup_run.ps1should not pass 0 unattended.Commands executed locally
git diff --stat origin/main...HEAD: 2 files, +17/-5.python3 -m py_compile tools/startup/debug_launch.py tests/startup_debug_check.py: ok.python3 tests/docs_links_check.py: passed (18 files, 386 links).python3 tests/bidi_controls_check.py: passed (1373 files).git diff --check origin/main...HEAD: clean.ctest -R '^(startup_debug|startup_host_cpu_debug|startup_run_ps1)$': dev preset 3/3 passed, release preset 3/3 passed.startup_debugtook 29.5s and 27.1s.Not done: a manual source mutation. The test needs the Windows debug probe, so it cannot run on this Linux host. The Windows run above covers the passing path only. I did not check that the new asserts fail when the new logic is broken.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-25T05:30:20Z.
Review: APPROVED
Verified head
8aafa353on Windows x64 (devpreset, MSVC19.44.35228.0). Cleanly validates finite nonnegative--timeoutand--continue-asserts >= -1before launch.cmake --build --preset dev --target startup_debug_probe-> succeededctest --preset dev --no-tests=error -R '^startup_debug$' -V-> 1/1 passed (startup_debug: PASS (stop at a chosen assert, timed thread dump, large-allocation log, debug heap off; 6 controls))Verdict: Approved at
8aafa353.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T19:00:01Z.
Review: COMMENTED
Review of head
47d1f2a5against main. Verdict: sound, no blocking findings.tools/startup/debug_launch.pyandtests/startup_debug_check.pyonly. Behavior change is limited to--timeout 0(loop runs until exit or debug stop) and--continue-asserts -1(no count limit). Defaults and positive values are unchanged.startup_debug_check.py(unlimited run exits 0 without "timeout after", cap of 1 stops at the second site,--timeout 1still interrupts). They run the source-built probe, so they guard the caller-visible output. I agree with the earlier run that mutating thewhilecondition or theskip_asserts == -1clause makes them fail.timeout < 0 ... return 2) is not exercised by the check; one--timeout -1control would cover it. A negative timeout used to exit immediately and now exits 2 with a message.TIMEOUT 300ofstartup_debug.debug_launch.py(stop file), so whichever lands second may need a trivial merge.Commands run (Linux, worktree at the head):
python3 tests/docs_links_check.py(pass),python3 tests/bidi_controls_check.py(pass),git diff --check origin/main...HEAD(clean),py_compileof both touched files (ok). The check itself needs the Windows debug API; see the Win2025 receipt comment for dev and release results (startup_debug 1/1 each). I did not run source mutations myself: they need Windows, and I relied on the mutation results already posted in this thread.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T19:00:02Z.
Win2025 WARP receipt for head
47d1f2a5(10 commits behind main, not updated).Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
47d1f2a5368791a9e9a0928afef9d4642db1114b:--preset dev):cmake --build --preset dev --target startup_debug_calls startup_debug_probe -- -j 2, thenctest --preset dev -R 'startup_debug' --parallel 6 --no-tests=error --output-on-failure: 1/1 passed (startup_debug51.08s)/O2(--preset release): same build and ctest with the release preset: 1/1 passed (startup_debug51.26s)tests/startup_run_ps1_check.pyok;tests/startup_run_sh_check.pyFAIL (file not touched by this PR; the VM has no POSIX shell setup for it)AI-assisted; commands listed were executed locally.