Skip to content

emrg: stop-emrg.cmd v2 — host-verified fix for installer exit 1 - #729

Merged
argszero merged 1 commit into
masterfrom
feature/stop-emrg-v2-verified
Aug 13, 2026
Merged

emrg: stop-emrg.cmd v2 — host-verified fix for installer exit 1#729
argszero merged 1 commit into
masterfrom
feature/stop-emrg-v2-verified

Conversation

@argszero

Copy link
Copy Markdown
Owner

Implements host rants 2026-08-13T09:56:47 + 2026-08-13T10:00:33 (final root cause, host-verified on real Windows with EXIT_CODE=0).

Double bug in stop-emrg.cmd (host's decisive diagnostic):

  1. Bug 1 — skips step 4: when the daemon is not running (emrgd.pid absent), the old daemon section jumped straight to :verify, so step 4 (kill bundled git) never ran → orphaned evolution-spawned git.exe×3 + sh + vim processes kept locking install\git → verify reported them → exit 1 → installer aborted.
  2. Bug 2 — %VAR% parse-time expansion inside paren blocks: if %TRIES% geq 10 expanded at parse time ("10 was unexpected at this time") and if exist "%INSTALL%\bin\emrg.cmd" misjudged inside a block ("no emrg.cmd" while the file exists).

Fix (host's verified v2, copied VERBATIM per host instruction — no rewrites):

  • Step 4 unconditional: daemon section falls through via goto :step4; if exist emrgd.pid wraps the pid poll/kill, then :step4 always executes before :verify.
  • Label structure replaces nested parens (:tui_wmic/:tui_done, :daemon_stop/:daemon_pid/:daemon_pid_wait/:kill_pid/:pid_gone); if !TRIES! geq 10 uses delayed expansion.
  • Diagnostics preserved (host requirement): per-step echo [N] check/kill/result + chcp 65001.
  • CRLF (per .gitattributes).
  • The new file was verified byte-exact against the host-provided content (4354 bytes, CRLF).

Verification: tests updated — test_stop_emrg_v2_step4_always_runs added (no goto :verify, !TRIES! delayed expansion, labels present, diagnostics present), old tests adapted to the v2 :step4 label structure; full pytest 761 green; doc-count guard synced (Agent.md 760 → 761).

@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 (1/3)

Reviewed the full diff on feature/stop-emrg-v2-verified (c738de7).

Bug 1 (step 4 skipped) — fix verified: the old if not exist "%EMRG_DIR%\emrgd.pid" goto :verify is gone. Daemon section now falls through via goto :daemon_pid → (no pid) goto :step4, so the bundled-git kill ALWAYS runs before :verify. Verified on the real blob: goto :verify absent, :step4 present, ordering :step4 < :verify ✓.

Bug 2 (%VAR% parse-time expansion) — fix verified: nested paren blocks replaced by label structure (:tui_wmic/:tui_done, :daemon_stop/:daemon_pid/:daemon_pid_wait/:kill_pid/:pid_gone); loop guard uses delayed expansion if !TRIES! geq 10 goto :kill_pid with setlocal enabledelayedexpansion ✓.

Diagnostics preserved (host requirement): per-step echo [N] check/kill/result + chcp 65001 + residual listing in :verify ✓.

Consistency: blob is LF 4263 bytes → +91 CRLF = 4354 bytes host CRLF, matching the PR's byte-exact claim; .gitattributes eol=crlf intact. tests/test_installer_stop.py 8/8 green locally (incl. new test_stop_emrg_v2_step4_always_runs); Agent.md 760→761 synced.

No issues found.

@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. CI run 31659728224 SUCCESS (test + test-windows both green). Verified: bin/stop-emrg.cmd is a byte-exact copy of the host-verified v2 (4354 bytes, CRLF, EXIT_CODE=0 on real Windows); step 4 (kill bundled git) now always executes before :verify (no goto :verify skip); paren-block %VAR% parse-time expansion fixed via label structure + !TRIES! delayed expansion; per-step [N] diagnostics preserved. Test suite: +1 test (test_stop_emrg_v2_step4_always_runs), old tests adapted to :step4 label; pytest 761 green; Agent.md count synced (doc-count guard green).

@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 (3/3)

Third independent cycle confirming the diff at c738de7 (unchanged since 1/3 review): stop-emrg.cmd v2 fixes both root causes — (1) step 4 (bundled-git kill) now ALWAYS runs via goto :step4 fall-through (no more goto :verify early jump), (2) paren-block %VAR% parse-time expansion replaced by label structure + !TRIES! delayed expansion. Host-verified on real Windows (EXIT_CODE=0); byte-exact CRLF confirmed; tests 8/8 + CI 31659728224 green. Merging.

@argszero
argszero merged commit eb38234 into master Aug 13, 2026
2 checks passed
argszero pushed a commit that referenced this pull request Aug 13, 2026
…entries (#744)

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.

1 participant