launcher: the output pump takes a bounded batch a turn, so the window answers with -Log off (LAUNCHER-OUTPUT-PUMP) #3192
Closed
github-bot
wants to merge 1 commit from
github-bot/gh-3192 into main
AGit
pull from: github-bot/gh-3192
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!3192
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3192"
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?
@1mshy on GitHub · 2026-12-02 17:49 UTC · original
1mshy:fix/launcher-output-pump→main· +86 −25 · 2 files · 1 commits · closed without mergingClaimed in the coordination issue as: LAUNCHER-OUTPUT-PUMP
Fixes: #3175
What and why
With "Log to a file (-Log)" unchecked, the runtime's stderr comes through the launcher's pipe.
Launcher.pump(
tools/leonida_launcher.py) drained the reader thread's whole queue in one Tkaftercallback, with aninsertand asee("end")per line.see("end")forces a layout pass, about 2.5 ms of the ~3 ms a line costs. Tkcould not handle clicks or redraw until the queue was empty: 30,000 queued lines held the window for 90 s, and while
the runtime wrote faster than about 400 lines/s the callback never returned. With -Log on, the pipe stays quiet,
which is why the launcher stayed responsive in that case.
take_output(lines, limit=OUTPUT_BATCH): takes at most 2000 queue items per turn without waiting, in order,and joins each run of lines from one process into one item, so the output box gets one insert and one
seeper run.pump()uses it. The status heuristic (state_for_line) is applied over the run and set once. A turn that leaveslines queued comes back after
OUTPUT_RESUME_MS(10 ms) instead of 100 ms, so a backlog drains fast while clicksand redraws run between turns. Exit, update-check and stale-process handling are unchanged.
Tested
macOS, Python 3.13.5, Tk 8.6.14:
python -I tests/test_leonida_launcher.py: 28 tests OK (2 new:OutputPumpTests)python -I tests/test_shell_launchers.py: 7 OKpython -I tests/test_launcher_serve.py: 10 OKpython -I tests/test_win_launchers.py: 6 run, 5 skipped (Windows-only)python -I scripts/check_no_game_data.py(all tracked files): cleanpython -m compileall -q make_game.py tools tests: OKpython -m unittest discover -s tests -p "test_docs_*.py": 57 OKRed/green:
python -I scripts/red_green.py fix/launcher-output-pump --base origin/main --no-cargo --mutatereports red then green. Both new tests fail on main and pass with the fix; the other 24 pass on both. The mutation
pass catches undoing
take_output. It does not catch undoing thepump()hunk, becauseLauncheris nested inrun_gui()and can't be reached without a display. A Tk benchmark (below) covers that.Tk measurement (real
Textwidget set up like the output box; a 5 ms timer stands in for a click):The independent reviewer reproduced these figures. It also ran a live producer: before, 1,000 lines/s gave one
7.4 s turn; after, at 50k–300k lines/s, turns stay at 4–6 ms and the timer is at most 20 ms late.
Not run: Windows (
Launcher.bat) by hand. The fix is platform-independent Tk/queue code, but nobody has clicked thereal launcher on Windows with the game.
GPUs tested: n/a (launcher UI only, no GPU work)
AI-assisted: yes. Work: Claude Opus 5.5 (
claude-opus-5-5). Independent read-only reviewer: Claude Opus 5.5(
claude-opus-5-5); no blockers. Its nits (a line over 120 characters, commit-message precision) are applied.Checklist
main(45dc41f95) and merges cleanly.docs/design.md— n/a, no translator change.With "Log to a file (-Log)" off the runtime's stderr comes through the launcher's pipe. Launcher.pump drained the reader thread's whole queue in one Tk callback with an insert and a see("end") per line; see("end") forces a layout pass (about 2.5 ms), so a line cost about 3 ms. The window answered no click and drew nothing until the queue was empty: 30,000 queued lines held it 90 s, and while the runtime wrote faster than about 400 lines a second the callback never returned (#3175). take_output() now hands a turn at most OUTPUT_BATCH (2000) items, with each run of lines of one process joined into one insert (one see), and a turn that leaves more queued comes back after 10 ms instead of 100 ms. Measured with Tk 8.6 on macOS: the longest turn is 5-8 ms, a repeating 5 ms timer is at most 14 ms late while 300,000 lines drain (2.3 s), and a box already holding 200,000 lines changes neither. Fixes #3175. AI-assisted: Claude Opus 5.5 (claude-opus-5-5); review: Claude Opus 5.5.@fiestorra on GitHub · 2026-12-02 18:00 UTC · original
Verified here: it applies on the current
main, its two new tests pass, and the launcher suite is green - but the change carries something the body does not mention.The fix is the right shape for #3175:
Launcher.pumpdrained the reader thread's whole queue inside one Tkaftercallback, with aninsertand asee("end")per line, so a chatty runtime (stderr with-Logoff) starved the event loop. A bounded batch per turn is the standard answer, and the two tests pin exactly the property that makes it one - a turn takes at most the batch and leaves the rest queued, and runs stay joined per process and in order.What the body does not mention: the same diff changes
precompile_all's default fromFalsetoTrueand rewritesswitch_argsto emit-PrecompileUsedwhen it is off - that is #3172's territory, not #3175's, and a reviewer reading "the output pump takes a bounded batch" will not expect it. It may be a deliberate follow-up to #3172 (which merged today); if so it deserves its own line in the body, and if it is drift, it deserves its own pull request.What I could not test: the unresponsiveness itself. That needs the launcher's window with a runtime writing to a pipe, and this session has no interactive desktop - the tests hold the batch logic, not the event loop it protects.
AI-assisted: yes - DeepSeek v4.1 (flash).
Written with an AI assistant.
@MoonEyes on GitHub · 2026-12-02 18:04 UTC · original
Third-party verification of #3192 (LAUNCHER-OUTPUT-PUMP, fixes #3175)
b713fdd8da6066fc06cf73636257e43f7be96610, merge base45dc41f95(= currentorigin/main). Merges cleanly (git merge-tree --write-tree origin/main pr/3192). GitHubmergeable_state: blocked(review required); no check runs or statuses reported on the head sha yet.tools/leonida_launcher.pyor #3175.LAUNCHER-OUTPUT-PUMP,#3175and comments by the author. I found noclaiming:ordone:line for this item, even though the body says "Claimed in the coordination issue as: LAUNCHER-OUTPUT-PUMP".Tested here (Linux, Python 3.13.18, detached checkout of the head, which equals the merge with
main):Red/green,
python3 -I scripts/red_green.py pr/3192 --base origin/main --no-fetch --no-cargo --mutate:As the PR says, nothing tests the
pump()hunk (Launcheris nested inrun_gui()). This machine has notkinter, so I could not reproduce the Tk timings.Review
take_output(tools/leonida_launcher.py:471) keeps queue order and joins runs by process identity (is). Non-line items (exit,update) split runs, so ordering relative to an exit is preserved.pump()(tools/leonida_launcher.py:792): the per-runstate_for_linefold gives the same final state as the old per-line calls. Callingset_stateonly on a change is equivalent becauseset_stateonly setsself.stateandstatus_var. The rescheduling at :817 (10 ms while the queue is non-empty, else 100 ms) is sound. The exit and stale-process handling is unchanged.Textwidget still grows without bound over a long-Log-off session (pre-existing).Defects
claiming: LAUNCHER-OUTPUT-PUMP/done: LAUNCHER-OUTPUT-PUMP -> #3192there.Verdict: defects (claim only). The code is correct, small and on one topic; red then green confirmed here. It is ready once the claim is posted. A Windows
Launcher.batclick-through with-Logoff would still be useful.AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
@lixonik on GitHub · 2026-12-02 20:02 UTC · original
Verified PR #3192 (
b713fdd8d) merged cleanly ontomain(f1a559851) on Windows 10 x64:python -I scripts/check_no_game_data.pyPASS.b713fdd8dontof1a559851):python -I tests/test_leonida_launcher.py-- 28 tests, OK (0.267 s).maintools/leonida_launcher.py+ PRtests/test_leonida_launcher.py): FAILED (errors=2) on the two new output-pump batch tests.Verdict: PASS (Python unit tests; no game launch).
AI-assisted: yes (Antigravity).
@Kal0s-design on GitHub · 2026-12-02 21:00 UTC · original
Ran natively on Windows 11, head
b713fdd8dmerged into currentmain(8d82a34ae, clean merge). Python 3.11 with Tk 8.6.The unit tests are already covered above, so briefly: the launcher test file has 26 tests on
mainand 28 on the merge, all green, and the two newOutputPumpTestserror onmain's launcher. Same result as the others.What nobody could run yet is the part the PR is about, the Tk event loop. Tk is available here, so I ran the real
pump,append,read_outputandset_statebodies (pulled from the file on each side, not rewritten) against aTextset up like the launcher's output box (word wrap, Consolas 9, scrollbar). Output came from a throwaway Python child writing to the pipe, never the game. A 5 msafterheartbeat measured how long the window went without getting a turn.Measured, PR vs main
Text, before I matched the launcher's)\rprogress runs of 20k each, then 1000 linesOn
mainthe window does not get a single event until the whole backlog is in the box. With the PR it keeps answering the whole time. Take the absolute numbers as rough; the difference is three orders of magnitude.Ordering and exit (measured). In every case the box text matched the child's bytes split on
\nand decoded witherrors="replace", plusExited with code 0.at the very end. Nothing was lost, duplicated or reordered. The unterminated last line arrives at EOF. The exit line only shows up after the whole backlog has been drawn, sinceread_outputqueuesexitafter EOF andtake_outputkeeps queue order.Limits worth knowing (not defects of this PR)
queue.Queue()(read). A child that writes faster than the box draws just makes it grow. Measured: the 2 s flat-out writer peaked at about 2.7M queued items, which then drained at roughly 120k lines/s while the window kept answering. So the window stays usable, but a runtime that spams for minutes leaves a long tail. I did not measure process memory.readlineonly splits on\n(read), so\r-only progress lines show up as one line when the next\narrives. Same as onmain.Textwidget itself still grows without limit, as already noted above.Correction to the first comment. The diff against current
mainis 2 files,tools/leonida_launcher.pyandtests/test_leonida_launcher.py, with only the pump change. There is noprecompile_allorswitch_argschange in this head (measured withgit diff).Other open PRs touching
tools/leonida_launcher.py(git merge-treeagainst the PR head)pump()infoandrailkinds (read). It does not replace the pump, so whoever merges second has to keep the bounded loop or #3175 comes back.take_outputpasses non-linekinds through unchanged, so the new kinds fit as they are.pump()F1 settings applied.(read). With runs joined into one item, that check has to move into thefor line in valueloop, or it misses lines in the middle of a batch.Not checked: a real
Launcher.batclick-through with-Logoff and the actual runtime, the fullLauncherwindow (I tested the pump methods with a matching output box and stubbed status widgets), process memory, Linux/macOS Tk.GPUs tested: n/a (Python launcher tests only).
AI-assisted: yes (Claude Code).
@fiestorra on GitHub · 2026-12-02 23:50 UTC · original
VERIFY-3192 — Windows nativo:
red then greenen el bombeo de la salidab713fdd8d—tools/leonida_launcher.py(+76),tests/test_leonida_launcher.py(+35)Ran at the head
Negative control: the commit's own hunk does not revert cleanly (the branch also carries a merged
mainon that file), so I putmain'sleonida_launcher.pyback and re-ran:It bites.
What the change is: the launcher's output pump takes a bounded batch per turn — instead of draining whatever is in the pipe — and makes one insert per run. Both halves are about a pump that runs every frame-ish: an unbounded drain starves the next turn, and an insert per line per turn with a run of lines grows without bound (the classic "the launcher is fine for ten minutes").
Why a bounded batch is the right shape: a pump that takes everything available is correct exactly as long as the producer is slower than the consumer — and a game's log is not.
What I could not test
Written with an AI assistant.
@fiestorra on GitHub · 2026-12-03 02:08 UTC · original
#3192is fully inmain— close it rather than rebase itEverything this pull request adds is already there, including its own test class, which is why the rebase conflicts:
So the bounded batch, the one-insert-per-run, and the tests that pin them all landed with
#3182. What remains of the branch is the same lines against a rewrite that already has them, which is whytools/leonida_launcher.pyandtests/test_leonida_launcher.pyconflict.I would close it with a line pointing at
#3182— the work is in, and a rebase would only reproduce it.And it is worth saying what the branch was for, because it did its job: the comment in
mainat L1290 is the sentence from this pull request ("with-Logoff the runtime's stderr comes through the pipe, and the window took a whole queue in one turn with one insert per line, so the window stopped answering clicks") — the reasoning survived the rewrite, which is the best evidence that the fix did too.And
#3214is a different case: not redundant, and its conflict is one hunkIts content: keep an explicit SDK directory in the runtime's environment even with FSR off, resolve relative paths in the script's own working directory, and let an empty
-Moreor a saved value clear the inherited one — a path-resolution change, not a rewrite, and 70 lines of tests come with it.That one needs a rebase and nothing else — the conflict is
play-nvidia.ps1's hunk against#3182's version of the same file, and the two intents do not overlap:#3182replaced the launcher, this replaces how one path among its settings is resolved.@OreoFR on GitHub · 2026-12-03 03:36 UTC · original
Closing at OreoFR's request. The launcher overhaul (#3182, merged) took this design:
take_outputtakes at most 2 000 lines a turn in one insert and comes back after 10 ms while more is waiting, and docs/launcher.md credits #3192 for it. Thanks @1mshy. (oreofr-agent, AI-assisted)Pull request closed