Repository navigation
Run the worker as a Windows service - #1004
Merged
Merged
Conversation
theatrus
force-pushed
the
worker-windows-service
branch
3 times, most recently
from
October 26, 2026 04:02
19ed81e to
7ce03ba
Compare
`psf-guard worker-service install` creates the PSF Guard Worker service, started with Windows and run as Local System with the worker settings the desktop app saved (or --config FILE), and starts it. Stop and shutdown let the worker leave the server, which queues its running task again, while the service reports a stop pending. A failed run, such as a refused token, exits nonzero, and the service's failure actions start it again after 30 seconds. `worker-service uninstall` stops and removes it. The service logs to files starting `worker` in %ProgramData%\PSF Guard\logs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The app installs per user, so a service that ran its binary or read its settings in place would let any program running as that user gain the service's rights. `worker-service install` now copies the binary to Program Files and the settings to ProgramData, limits that folder to SYSTEM, Administrators and the service, and runs the service as its own virtual account, NT SERVICE\PSFGuardWorker, not Local System. Running it again updates the copies. The settings path is made absolute; shutdown uses preshutdown with time for the worker to leave the server; a stop reports rising checkpoints; a failure logs its reason before the service reports it stopped, with a service-specific code; uninstall reports access refused and a stop still in progress, and removes the copies. Settings › Run a worker shows a running service and offers no second worker then. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
theatrus
force-pushed
the
worker-windows-service
branch
from
October 26, 2026 04:35
ab3527e to
e0c23fa
Compare
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.
Run a PSF Guard worker as a Windows service so it can process tasks before anyone logs in. #1003 is merged, and this branch is rebased onto main. It includes the revised desktop-worker terminology and preserves the concurrent Windows permissions and process-exit fix.
Open Settings › Workers › Worker on this computer, enter the worker settings, and turn off Start worker at login. Click Save worker settings, then Stop worker if it is running. From PowerShell opened as administrator, run:
The command installs and starts PSF Guard Worker under its own virtual account,
NT SERVICE\PSFGuardWorker. It copies the executable to%ProgramFiles%\PSF Guard Workerand settings to%ProgramData%\PSF Guard Worker\worker.json. Settings and task files inherit the protected data folder’s permissions. Reinstalling repairs permissions left by earlier installs.tasksfolder.worker-service uninstallstops and removes the service and deletes its copied executable, settings including the token, task files and logs. The desktop app’s saved settings remain separate.The Workers guide covers updates, permission recovery, RC-Astro licenses, shared storage and removal. Commands, API fields and stored settings remain unchanged by the language edits.
Screenshots
WebKit browser fixtures simulate the Windows service states through the Tauri bridge. They verify the UI wording and disabled controls; they do not exercise a native Windows service.
Service running
Service has not stopped
Validation
On macOS, after integrating the permissions and process-exit fix:
cargo fmt --all -- --check.cargo clippy --workspace --all-targets --all-features -- -D warnings.cargo test --lib --all-features worker: 74 passed, 2 ignored.git diff --check; screenshots visually inspected.Windows-only modules and their PowerShell permission/process tests do not run on macOS. Native Windows install, stop, shutdown and uninstall remain untested here; hosted Windows checks are separate from these local results.
Operational limits