Setting up remote access exposed this: 'python' works for the operator's own
account only. It resolves through pyenv SHIMS driven by PYENV/PYENV_HOME/
PYENV_ROOT, and all three are USER-scoped to that account; the single
machine-wide PATH entry points at a Python39-32 folder that no longer exists.
So a dedicated remote-admin login (the account just created for SSH/RDP) gets
NO python at all -- parking the relay from the road would have failed with
'python is not recognized', at night, with players waiting.
park_relay.cmd now resolves an interpreter explicitly and prints which one:
BT_PYTHON override -> the project's pyenv 3.11.4 (calling account's profile,
then the operator's -- Administrators can read it) -> the machine-wide py
launcher -> whatever is on PATH -> a clear error naming the fix. Verified both
as the operator and with a simulated second-account environment (machine PATH
only, PYENV cleared): both resolve 3.11.4.
Also dropped a delayed-expansion bug in the first cut (!CAND! without
EnableDelayedExpansion would have silently evaluated to nothing).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Completes the travelling-operator deployment. The relay stays parked on the
home machine (so no player ever edits join.bat) and the console dials in from
anywhere -- but until now two things needed hands on that machine: bringing the
relay back when it died, and restarting it (the only way to clear a wedge or
pick up a roster resize). Both are covered now.
tools/btrelay_park.py -- the supervisor:
* runs the relay with cwd=content\ , which is what pins WHICH
operator_secret.txt is live (the trap documented last commit);
* relaunches on ANY exit, with 2/5/15/30/60s backoff when a relay dies inside
20s, so a permanent fault (port taken, missing egg) cannot become a spin;
* rotates content\parked_relay.log to .1 first, so the dead generation's
evidence survives the relaunch that replaces it;
* Ctrl-C stops it for good. NOT a Windows service on purpose: session 0
would hide the window an operator wants to tail.
tools/park_relay.cmd -- double-click to park; a shortcut to it in shell:startup
gives start-after-reboot with no admin rights.
`restart` on the control port (btconsole.py): sets restart_requested, the run
loop returns, relay_main exits RESTART_EXIT_CODE=42 and the supervisor relaunches
-- re-reading the egg. REFUSED while a mission is running (launches_sent >= 2
and not stop_sent): bouncing then would drop every pod out of a live round.
Local stdin gets the same command for parity.
btoperator.py: Restart Session in REMOTE mode now sends `restart` and reconnects
6s later instead of just tearing down our own link -- the old behaviour looked
like "Restart does nothing" against a parked relay. (QTimer had to be imported;
it was missing, which py_compile does not catch -- it would have been a runtime
NameError on the first click.)
VERIFIED by scratchpad/test_parked_supervisor.py, 12/12, and the full
test_remote_console_e2e.py re-run green afterwards (15/15):
* kill the relay -> a NEW pid is serving again, and the old log is kept as .1;
* remote `restart` -> ACKed, new pid, egg re-read, serving again;
* the supervisor distinguishes the two -- "operator requested a restart" vs
the crash/backoff path -- proven from its own log, not assumed;
* the mid-mission guard is present and wired to launches_sent/stop_sent.
Two harness defects fixed while proving it, both mine: a check written with
`or True` that could never fail (replaced with two real assertions against the
supervisor's log), and a recv that treated the relay's correct
close-after-restart as a ConnectionResetError failure.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>