Add og-veil restart command for seamless server restarts#13
Merged
Conversation
Adds a `restart` subcommand that stops the background server (if running), waits for the old process to exit, then starts a fresh one. Useful after `og-veil update` to load the new version without typing `stop && og-veil`. - New `wait_until_stopped(pid)` daemon helper polls the live process (the pidfile is already removed by stop_background) so the new server doesn't collide with the old one on the same port. - `restart` mirrors `serve`'s flags (host/port/tee-id/expected-pcr/pii-scrub) and reuses the saved login, so it never prompts. - Update hint, docstrings, and README now point at `og-veil restart`. - Tests cover the stop→wait→start ordering, the no-server-running path, the lingering-process error, and the wait helper itself. https://claude.ai/code/session_01TYNjSYZ6QoreCr2dcURYSH
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.
Summary
Adds a new
og-veil restartcommand that stops and restarts the background server without requiring re-authentication. This is particularly useful after runningog-veil updateto load the new version.Key Changes
restartcommand inveil/cli.py: Stops the running background server, waits for it to fully exit, then starts a fresh instance with the same or updated configuration. Accepts the same options asserve(host, port, tee-id, expected-pcr, pii-scrub).wait_until_stopped()function inveil/daemon.py: Polls a process ID to verify it has exited before proceeding, with configurable timeout and polling interval. Prevents port collision between old and new server instances._pid_alive()function inveil/daemon.py: Usesos.kill(pid, 0)to check if a process is still running without sending a signal.restartcommand instead of manualstop && serveworkflow.restart(normal restart, fresh start when nothing running, error handling when old process lingers) and two forwait_until_stopped()(timeout and successful wait scenarios).Implementation Details
restartcommand reuses the login session (no re-authentication needed) and respects environment-based configuration by defaulthttps://claude.ai/code/session_01TYNjSYZ6QoreCr2dcURYSH