Repository navigation
Conversation
…r run
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 (ProjectLeonida#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 ProjectLeonida#3175.
AI-assisted: Claude Opus 5.5 (claude-opus-5-5); review: Claude Opus 5.5.
|
Verified here: it applies on the current The fix is the right shape for #3175: What the body does not mention: the same diff changes 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. |
|
Third-party verification of #3192 (LAUNCHER-OUTPUT-PUMP, fixes #3175)
Tested here (Linux, Python 3.13.18, detached checkout of the head, which equals the merge with Red/green, As the PR says, nothing tests the Review
Defects
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 AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. Generated by Claude Code |
|
Verified PR #3192 (
Verdict: PASS (Python unit tests; no game launch). AI-assisted: yes (Antigravity). |
|
Ran natively on Windows 11, head The unit tests are already covered above, so briefly: the launcher test file has 26 tests on 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 Measured, PR vs main
On Ordering and exit (measured). In every case the box text matched the child's bytes split on
Correction to the first comment. The diff against current Other open PRs touching
Not checked: a real GPUs tested: n/a (Python launcher tests only). AI-assisted: yes (Claude Code). |
…menu's console Two review findings by merzleckeier on ProjectLeonida#3182. Output pump (on dafad4c): the window's pump drained the whole output queue and appended once per line, so a run that floods the pipe (the runtime's stderr with -Log off, ProjectLeonida#3175) could freeze the window. Ported the design and names of ProjectLeonida#3192 by 1mshy: OUTPUT_BATCH = 2000, OUTPUT_RESUME_MS = 10 and a pure take_output() that joins each run of one process's lines into one ("lines", proc, [...]) item, keeps exit/update/info/rail items in order and leaves the rest queued; one insert per run, rescheduled after 10 ms while more is queued. The overhaul's info, rail and finished() handling is kept. ProjectLeonida#3192's two OutputPumpTests ported (with info and rail items), plus 10,001 lines = one insert a turn and a check that the pump goes through take_output. Low-commit warning (on 7768d10): the Play card's warning took the profile from the launcher's settings alone, while play-d3d12.ps1 -Chosen / play-nvidia.ps1 ("What the F1 menu saved") let the F1 menu's LEONIDA_MENU_CONSOLE win when the launcher's profile has not changed since the last PLAY (and at the first PLAY, -Chosen none). New pure effective_console(settings, menu) with that order; the Play card's line uses it and is refreshed when the F1 file is read again (focus, finished()). The Settings note keeps following the live control; the existing "F1 menu: Series X" note under the profile says when the menu holds another. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VERIFY-3192 — Windows nativo:
|
| Own commit | b713fdd8d — tools/leonida_launcher.py (+76), tests/test_leonida_launcher.py (+35) |
Ran at the head
python -I tests/test_leonida_launcher.py Ran 28 tests — OK
Negative control: the commit's own hunk does not revert cleanly (the branch also carries a merged main on that file), so I put main's leonida_launcher.py back and re-ran:
Ran 28 tests — FAILED (errors=2)
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
- A real launch with the pump under load: the tests drive the pump's bookkeeping; the title's log volume is the condition that matters.
Written with an AI assistant.
Claimed 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(45dc41f) and merges cleanly.docs/design.md— n/a, no translator change.