emrg: restart-to-apply — install runtime python + PYTHONPATH in packaged mode; emrg stop --skip-gui (rant 2026-08-21T12:44:34) - #916
Merged
Conversation
…ackaged mode; emrg stop --skip-gui (rant 2026-08-21T12:44:34 follow-up)
argszero
commented
Aug 21, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle
Fresh review of the packaged-mode restart fix (rant 2026-08-21T12:44:34 follow-up):
- Root cause confirmed:
_findPython()in packaged mode falls through to PATHpython3, which has noemrgimportable —python3 -m emrg._stop_allwould fail and the relaunch never happen. daemon_client.js:_findInstalledPython()mirrors thebin/emrgdlauncher's python resolution (POSIXbin/python; Windowspython-dist\python*.exewith R100 DLL caveat);_installedPythonPath()=install/source:install/lib, matching the launcher's PYTHONPATH.main.js: packaged mode spawns install python with PYTHONPATH injected +windowsHide; source mode unchanged (repo venv).emrg/__main__.py:emrg stop --skip-gui→_stop_all(skip_gui=...)— CLI parity with the module path.- Tests: +1 CLI parse test, installer delegation test updated, GUI source-level test extended (asserts both helpers present + used). Full local suite green: pytest 994 passed + 1 skipped (995 collected, Agent.md synced), GUI 257 (249+8), node --check OK,
emrg stop --helpshows--skip-gui, import + CLI OK.
1/3.
argszero
commented
Aug 21, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle
2nd review (head e0350da, CI test + test-windows PASS on run 32453323985):
- Fresh local verification on this branch: Python pytest 994 passed + 1 skipped (995 collected, matches Agent.md), GUI npm test 257 (249 pass + 8 skipped),
node --checkon main.js + daemon_client.js OK, import + CLI OK,emrg stop --helpexposes--skip-gui. _findInstalledPython()mirrors thebin/emrgdlauncher resolution (POSIXbin/python; Windowspython-dist\python*.exewith R100 DLL caveat +python.exefallback);_installedPythonPath()=install/source:install/libmatching the launcher's PYTHONPATH.main.js: packaged mode spawns install python with PYTHONPATH injected +windowsHideon win32; source mode unchanged (repo venv).emrg/__main__.pywiresemrg stop --skip-gui→_stop_all(skip_gui=...).- Tests cover the new paths (CLI parse + installer delegation + GUI source-level). No issues found.
2/3.
argszero
commented
Aug 21, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle
3rd consecutive review (head e0350da, MERGEABLE/CLEAN, CI test + test-windows PASS):
- Fresh local verification on this branch: pytest 994 passed + 1 skipped (995 collected, matches Agent.md),
emrg stop --helpshows --skip-gui, import + CLI OK, GUI npm test 257 (249 pass / 0 fail / 8 skipped). - _findInstalledPython() mirrors the bin/emrgd launcher resolution (bin/python on POSIX; python-dist/python*.exe on Windows with the R100 DLL caveat); _installedPythonPath() returns the launcher-equivalent PYTHONPATH (source:lib). restartDaemon uses the install python + PYTHONPATH in packaged mode, repo venv in source mode; windowsHide added.
emrg stop --skip-gui→ _stop_all(skip_gui=...) keeps the GUI alive to relaunch itself — correct restart-to-apply semantics (rant 12:44:34 follow-up).- Tests cover the new flag parsing, the installer-stop delegation, and the packaged-python presence in main.js/daemon_client.js.
3/3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restart-to-apply: use the install runtime python + PYTHONPATH in packaged mode
Follow-up to #915 (rant 2026-08-21T12:44:34, GUI "Restart to apply" button).
Bug found during review
The restart flow spawned
python -m emrg._stop_all --skip-guiusing_findPython(), which in packaged mode resolves to the host's PATHpython3— that interpreter has noemrgpackage importable (the packagedapp's
emrglives in~/.emrg/install/{source,lib}), so the full-chain stopwould fail with
No module named emrgand the relaunch would never happen.Fix
emrg/gui/daemon_client.js:_findInstalledPython()resolves theinstall runtime python exactly like the
bin/emrgdlauncher(
bin/pythonon POSIX;bin/python-dist/python*.exeon Windows, with theR100 DLL caveat);
_installedPythonPath()returns the launcher-equivalentPYTHONPATH="$PREFIX/source:$PREFIX/lib".emrg/gui/main.jsemrg:restartDaemon: in packaged mode spawn theinstall python with
PYTHONPATHinjected; source mode keeps the repovenv python.
windowsHideadded for the Windows black-window case.emrg/__main__.py:emrg stopgains--skip-gui→_stop_all(skip_gui=...),so the GUI could also drive the CLI directly (same semantics as
python -m emrg._stop_all --skip-gui).Tests / verification
tests/test_main.py: +1 —emrg stop --skip-guiparsesskip_gui=True.tests/test_installer_stop.py: delegation test updated for the newsys.exit(_stop_all(skip_gui=...))dispatch +--skip-guiflag.renderer.smoke.test.js: restart test extended — asserts_findInstalledPython()/_installedPythonPath()are used and presentin both
main.jsanddaemon_client.js.synced), GUI npm test 257 (249 pass + 8 skipped),
node --checkonmain.js + daemon_client.js OK,
emrg stop --helpshows--skip-gui,import + CLI OK.