Repository navigation
Keep web launcher job status tied to its process - #2798
weeeeeeeeees1 wants to merge 1 commit into
Conversation
|
Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12, head MEASURED
READ IN CODE
AI-assisted: Claude Code |
Verification — VERIFY-2798Verdict: PASS
AI-assisted: yes (Muse Wonder, Muse by Meta) |
KelboLive
left a comment
There was a problem hiding this comment.
The state half is right and the test genuinely guards it: identity against the live Popen closes the race (launcher/serve.py:322-325, repeated on the exit path at :370-374), running() polls the same object, so there is no pid-reuse hole, and nothing is left behind on a crash. On origin/main a stale worker leaves kind='' state='Exited with code 7'; here it stays kind='play' state='Starting'. Real-process checks (immediate exit, kill, still running) behave as described, and the tests are 12 / 15 / 3 green.
One leak remains, and it is the same race in the log rather than the state:
_followstill callsself.say(f"Exited with code {code}.")before the ownership check (serve.py:369vs:371), and the per-lineself.say(line)at:362is never gated. I reproduced it deterministically (holding the launcher lock so the old follower cannot finish draining): after the new job's> <command>header, the shared log received the old worker'sold-a,old-b,old-candExited with code 0., while the state correctly stayedStarting. That line also feeds the page's log drawer and, as the last line, the log chip (launcher/index.html:596) — so the pill says "Starting" and the chip says "Exited with code 0." The Tk launcher already drops every event from a non-current process (tools/leonida_launcher.py:614-615); please gate the appends the same way (keep draining, drop the writes) and move the check ahead of the exitsay.
Also: both new tests are Mock-based and neither asserts launcher.log — in the stale test the log is ['loading', 'Exited with code 7.'] even on this head, so the leak passes. assertNotIn("Exited with code 7.", launcher.log) fails today and would pin the fix.
Out of scope but worth a sentence: a restarted launcher forgets the job entirely (new Launcher reports Ready while the old child runs), since tracking is in-memory only — "tied to its process" holds for one launcher lifetime.
|
Independent check of Using the verifier from #2817, reversing individual source edits in AI-assisted with OpenAI Codex. |
Claimed in the coordination issue as LAUNCHER-JOB-STATE-OWNERSHIP.
What and why
The web launcher can accept a new job as soon as the previous child exits, while its output worker is still draining stdout. The previous worker could then overwrite the new job’s status or clear its kind.
This change passes the exact spawned process to its worker and checks process ownership under the launcher lock before publishing progress or recording an exit status. It also updates the current job’s kind and exit status together.
Tested
mainand passes with the fix. The current-worker test confirms exit status is still recorded.scripts/check_no_game_data.pyandgit diff --checkpassed.GPUs tested: n/a. The tests use synthetic processes and do not launch the game.
AI-assisted: yes. OpenAI Codex (GPT-6) prepared the patch, and GPT-6.2 Astra independently reviewed the diff.
Checklist
main.