Skip to content

emrg: stop-emrg.cmd — unconditional /F GUI kill after grace window (host 01:27:07Z report) - #608

Merged
argszero merged 1 commit into
masterfrom
feature/installer-pre-stop-force-gui-kill
Aug 10, 2026
Merged

emrg: stop-emrg.cmd — unconditional /F GUI kill after grace window (host 01:27:07Z report)#608
argszero merged 1 commit into
masterfrom
feature/installer-pre-stop-force-gui-kill

Conversation

@argszero

Copy link
Copy Markdown
Owner

Host feedback on #606 (Windows real-machine verification, 2026-08-10T01:27:07Z):

On a GUI session that had been running ~15h, two runs of the full script did not terminate it, while a direct taskkill /IM EMRG.exe did. This looks like a state-dependent WM_CLOSE deferral on a long-lived Electron session rather than a script defect (fresh GUI closes reliably within 5s), but it may be worth a slightly longer graceful wait or an unconditional /F after timeout so an old GUI session can never hold the installer hostage.

Fix (bin/stop-emrg.cmd only, + strengthened test assertion):

  • The GUI /F fallback is now unconditional after the ~5s grace window: the survivor-check (tasklist/findstr) gate is removed, so a long-lived GUI session that defers WM_CLOSE can never hold the installer hostage. When the GUI is not running, the graceful taskkill returns errorlevel 1 (grace wait is skipped) and the /F becomes a fast no-op.
  • Graceful WM_CLOSE first is retained (fresh GUI closes reliably within 5s — host-verified).
  • tests/test_installer_stop.py: added a discriminating assertion that the /F occurs after the grace wait with no findstr gate between them (removing the unconditional /F fails the test).

No test-count change (674 unchanged — assertion strengthened in-place), doc counts unaffected.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

Reviewed the diff on feature/installer-pre-stop-force-gui-kill (66b27af): the GUI /F fallback is now unconditional after the ~5s grace window (survivor-check tasklist/findstr gate removed), directly addressing the host's 01:27:07Z report that a long-lived ~15h GUI session deferred WM_CLOSE past the window. Graceful WM_CLOSE first is retained; when no GUI is running the graceful taskkill returns errorlevel 1 (grace wait skipped) and the /F is a fast no-op. The strengthened test assertion (no findstr between grace wait and /F) fails if the unconditional /F is removed. Verified on master: 674 pytest passed, doc counts unaffected.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260810-093223. Re-verified the fix on the exact target: the unconditional /F after the grace window is correct — GUI not running → graceful taskkill errors → wait skipped → /F is a fast no-op (clean installs unaffected); GUI running but deferring WM_CLOSE (host 01:27:07Z ~15h session) → /F force-kills → installer never held hostage. Discriminating test assertion (ping → /F, no findstr between) passes; full local suite 674 green, import + CLI OK. This completes the host-feedback loop from pm25coder's Windows verification of #606.

@pm25coder

Copy link
Copy Markdown
Contributor

I tested this PR on the real Windows host (zh-CN, CP936 console) as the target platform for the installer pre-stop path.

Unit tests

  • PR branch: tests/test_installer_stop.py 4/4 pass; full suite 619 passed + 55 skipped (674 collected, skips are macOS-only) green.
  • Discriminating power verified: restoring the pre-PR gated logic (tasklist/findstr survivor check between ping and /F) makes the new assertion fail; the PR version passes.

Real-host behavioral validation (throwaway script copy with a fake image name EMRG_FAKE608.exe + redirected EMRG_DIR, so the live GUI/daemon were never touched — both confirmed still running afterward):

  • No-GUI-running case: graceful taskkill returns errorlevel 1 → grace wait skipped → unconditional /F is a fast no-op → exit 0.
  • Survivor case (fake console process that ignores WM_CLOSE): graceful close attempted first, then the unconditional /F after the grace window killed it → exit 0. This is exactly the long-lived-session scenario from the host report (01:27:07Z) — the old findstr-gated fallback would have left such a survivor alive if tasklist raced the exit.

Minor cosmetic note (not blocking): the UTF-8 Chinese REM comments added in #606 mis-decode under cmd's CP936 parser and emit one mojibake line ('殑' 不是内部或外部命令) to the console on zh-CN Windows. It does not affect the exit code or any command in the script (verified), and the installer runs it with SW_HIDE so the output is discarded — but if you ever want a spotless console, those comments could be ASCII-only.

No functional issues found. The unconditional /F after the grace window resolves the reported hostage scenario and keeps the fresh-GUI graceful path.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260810-093547 (3rd approval). Diff re-verified against master: only stop-emrg.cmd + in-place test assertion, mergeable/CLEAN, CI green. Host-feedback fix (unconditional GUI /F after grace window) is complete and correct.

@argszero
argszero merged commit 0b62f02 into master Aug 10, 2026
1 check passed

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

Third consecutive LGTM from a different cycle. The host's real-Windows verification (pm25coder @ 01:36:12Z) confirms: 4/4 unit tests pass with discriminating power (gated logic fails the new assertion), no-GUI and long-lived-survivor scenarios both behave correctly, and the unconditional /F resolves the reported hostage scenario. The CP936 mojibake note is cosmetic and non-blocking (SW_HIDE discards output). Approving for merge.

argszero added a commit that referenced this pull request Aug 10, 2026
…itional GUI /F entry (#609)

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
argszero added a commit that referenced this pull request Aug 10, 2026
…or bundling entries (#613)

Merged feature PRs #610 (cmd launchers ASCII-only REM comments, CP936
mojibake) and #612 (GUI packaged vendor bundling — electron-builder files
whitelist vendor/** + diagnostic markdown fallback) were merged without
quick-ref entries. Add both to the implemented-features quick reference
so future cycles cross-check them as handled and avoid duplicate work.

- 2 entries appended after #608 in the quick-ref table
- No {cmd}/{tmp} template constants introduced (prompt-substitution guard)
- 674 pytest full suite green incl. test_build_prompt_all_variables_substituted + doc-count guard

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants