After the archive backend moved from Windows to object storage, that machine still had a whole old chain left on it: scheduled tasks, the H: drive directory, a root directive in Caddy, a stale credential copy, and a WSL build directory created by mistake.
The service no longer uses them, but “not used” and “no impact” are two different things. That root * H:/wg in Caddy points at a directory that no longer exists; the config is still running, and the next reload is a real chance of failure.
A read-only inventory round first makes the scope clear, then we delete.
The inventory admits up front that it isn’t complete
The review only covered the previous working directories, the H: drive root, the WG- / WVN- scheduled tasks, the known shared Caddy config, and the relevant local startup entries. It was a targeted inventory, not a full scan.
What was counted:
- 31
WG-/WVN-scheduled tasks on Windows: 18 Disabled, 13 Ready, none Running. Every action points at an H: drive directory that has already been cleared. None of the 13 Ready ones has a trigger — Ready doesn’t mean it will run on its own; they’re just one-off registrations left in the system. C:/ProgramData/CaddyWG/Caddyfileline 14’srootreferences a nonexistentH:/wg, and line 42’spem_filereferences a nonexistentH:/wg-split-production-storage-20261024/arch-web.crt. CaddyWG and Cloudflared are both still Running / Auto./home/i/wvn-build-fallback-20261115still exists in WSL, containing jobs, artifacts, workspaces, and environment scripts./home/i/webgal-b2-transfer-20261027/.secrets/rclone.confstill exists on Alice’s machine, and its whole-file SHA256 is identical to the stale old bucket config deleted earlier — it’s a copy of an old credential that was missed. Only digests were compared; no keys were printed.
It also explicitly recorded “not found”: no wg* / wvn* / .wvn* in the H: drive root, no matching LaunchAgent / LaunchDaemon / cron on the local machine, and no matching cron, systemd unit, or active old-bucket process on Alice.
The closing conclusion deliberately says “there are still clear remnants” rather than “everything is cleaned up” — the places you inventoried are not the places you didn’t.
Order: archive first, then delete
The cleanup script’s first assertion is “refuse to replay if a start marker already exists in this task directory,” and the second line validates the hostname:
if(Test-Path "$r/start"){throw 'Existing job; no replay'}
if($env:COMPUTERNAME -ne 'DESKTOP-ASUNA'){throw 'Unexpected host'}Then the baseline: the two shared services CaddyWG and Cloudflared must both be Running; record their ProcessId first, compare them one by one at the end, and they must still be the same processes. These two services are not the target of this cleanup — restarting them would turn “deleted cleanly” into a collateral incident.
The Caddy change follows “generate candidate → validate → overwrite → reload → read back the live config”:
- Read the original config, verify the SHA256, and confirm nobody changed it after the inventory;
- Use string replacement to remove
root * H:/wgand swappem_filefor an existing certificate; - If the result equals the original text, or any
H:/wgremains, fail immediately; caddy validatethe candidate file; stop if it’s non-zero;- Back up the original file, write the candidate,
caddy reload; - If reload fails, put the on-disk config back, without restarting the service;
- After a successful reload, request
http://127.0.0.1:2021/config/and serialize the live config; it must not containH:/wgand must still contain the new upstream address; - Finally confirm the PIDs of the two services haven’t changed.
Step 7 is the key. The file on disk being right doesn’t mean that’s what’s running in Caddy’s memory. Looking only at the file misses the whole “reload didn’t take effect” category.
Scheduled tasks, meanwhile, are exported first and then unregistered:
Export-ScheduledTask -TaskName $row.name -TaskPath $row.path | Set-Content -Encoding UTF8 "$taskdir/$($row.name).xml"
Unregister-ScheduledTask -TaskName $row.name -TaskPath $row.path -Confirm:$falseBefore exporting, also verify that the paths referenced in the actions haven’t changed; tasks that are running are left untouched. At the end, count how many ^WG-|^WVN- remain — it must be 0, and exactly 31 must have been deleted.
That WSL directory
It isn’t config; it’s a build workspace created by mistake, and keeping it just takes up space.
Pack it with Python inside WSL, with hard-coded conditions: the directory exists, isn’t a symlink, the active run-build.sh no longer exists, and ROLE_DISABLED.md is present; reject any symlink during recursion. Use tar’s x mode (fail if it already exists), compute the archive SHA256 after packing, and after shutil.rmtree assert that the directory is really gone.
The archive lands in the task directory on the Windows side and travels with this round’s evidence.
The local machine, Alice, and that credential
- Deleted 3 old working directories on the local machine; only a shared SSH helper script remains in the audit directory.
- Deleted 36 ops scripts on Alice, archiving the script evidence before deleting.
- After deleting the stale
rclone.confcopy, confirmed that only unrelated r2 configs remain in the global rclone, and the two deleted old copies did not come back. - Deleted the paused local monitor “WG pull status notification”.
The things on Alice’s machine that actually need protecting are the assets and the backups. After the deletion I ran a before-and-after invariance check over 1,067,041 protected files and 173,316,714,942 bytes, and never once touched the new bucket or the backup directory.
Looking at production again after the cleanup
Once the deletion is done you can’t just check whether it’s “all gone” — you also have to check whether production got dragged down with it.
Over about twenty minutes I did a round of live-site re-verification: health was still production/save-cas-b2-20261115-r2, the container was Running with no OOM or restarts, StartedAt matched the release from before the cleanup, backend was still b2-cas, and the Windows upstream was empty. Four representative titles loaded in Chromium, produced native frames, and exited, with 0 requests to the old cache domain. Each of the three engines ran through synthetic QA cloud-save upload, byte-for-byte download, idempotent commit, and history restore, plus real WebSocket send/receive across two pages.
I also left one unfixed exception: fetching a public object with Python urllib returns 403 first, with CF’s error code 1010 as the response body. The same URL passes in three real browsers and in a real Origin: null context. A limitation of a script client gets recorded as a limitation of a script client — I didn’t go and tweak CF on the side, and I didn’t write it up as “fixed”.
The scope of the re-verification is written as “no regression seen on representative samples” — not “all titles played through”, not “full three-engine matrix”, and not real cold-download performance from B2.
Wrapping up
The script’s failure branch is monotonous: if any assertion fails it jumps to catch, writes error.json with the failing line number, writes exit, and stops the transcript in finally. There’s no “continue with the remaining steps” option.
With cleanup work like this, the thing you fear most isn’t missing something — it’s missing something and not knowing. Better to stop at task 30 of 31 than to finish all 31 and only then discover Caddy has been swapped for a config that won’t start.
