fix(configure): free the terminal on finish / Ctrl+C (stop event + signals)#111
Merged
Conversation
…gnals)
mureo configure busy-slept for a fixed --timeout-seconds (default
600s) with no signal handler and no completion trigger, so closing
the browser left the terminal hung up to 10 min and Ctrl+C was
unreliable.
- ConfigureWizard gains stop_event + request_stop()
- run_configure_wizard installs SIGINT/SIGTERM handlers (set the
stop event), waits on the event instead of busy-sleeping, restores
prior handlers + graceful shutdown in finally; timeout_seconds is
now only a hard cap
- POST /api/shutdown (Host+CSRF gated like every POST) -> request_stop
- completed step gets a 'Finish & free the terminal' button (EN/JA)
that POSTs /api/shutdown
- --timeout-seconds help reworded (it was never 'inactivity')
Verified: real subprocess SIGINT 0.23s / SIGTERM 0.25s graceful
exit; real Chrome tab loading the configure SPA + the button's
exact MUREO.postJson('/api/shutdown') call -> terminal freed in
0.09s, response {ok:true,{status:stopping}}; pytest 3212 passed in
a clean env (3 new lifecycle tests); PyPI 0.9.0 lacks the route
(404) confirming the bug is real.
Test plan:
- [x] full suite 3212 passed (clean env); ruff/black/JS/i18n parity
- [x] code-reviewer APPROVE (no CRITICAL/HIGH)
- [x] real browser + real signal end-to-end verification
…ure_wizard CI lint (mypy mureo/ --ignore-missing-imports) flagged server.py:212: the loop var `sig` was reused (Signals from the install loop vs int from the dict.items() restore loop). Store handlers in a list[tuple[int, object]] and use a distinct `signum` in the restore loop. Type-only; behavior identical (code-reviewer APPROVE).
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.
Problem
mureo configurebusy-slept for a fixed--timeout-seconds(default 600s) with no signal handler and no completion trigger. Closing the browser left the terminal hung for up to 10 minutes; Ctrl+C did not work.Fix
ConfigureWizard:stop_event+request_stop()run_configure_wizard: install SIGINT/SIGTERM handlers (set the event), wait on the event instead of busy-sleeping, restore prior handlers + graceful shutdown infinally;timeout_secondsis now only a hard capPOST /api/shutdown(Host + CSRF gated like every POST) →request_stop/api/shutdown--timeout-secondshelp reworded (it was never "inactivity")Verification
MUREO.postJson('/api/shutdown')(same-origin, real CSRF) → terminal freed in 0.09s, response{ok:true,{status:stopping}}