Files
archy/scripts
archipelagoandClaude Fable 5 24e378c421 fix(tor): make the helper's restart actually recover Tor, and stop lying about it
The dashboard's "Restart Tor" button dispatched to this helper and always
got {"ok":true} back. Two real defects, in order of importance — and one
disproved theory, recorded so nobody re-chases it:

1. reset-failed was missing. Once tor@default fails enough times systemd
   latches "Start request repeated too quickly" and refuses to start it at
   all; a plain restart is then a no-op no matter which unit you name.
   All three fleet nodes found dead on 2026-08-09 were in exactly that
   state, which is why the button appeared to do nothing.
2. The result was unconditional. The write-torrc branch waited up to 30s
   for SOCKS and then ignored the outcome; the restart branch slept 3s and
   claimed success. The UI reported "restarted" over a dead daemon.

Disproved: this was NOT wrong-unit targeting. `systemctl restart tor`
does propagate to tor@default — measured on austin-sapien, MainPID
changed. tor@default is still addressed explicitly because it is the
unit carrying the failed state worth resetting.

restart_tor_daemon() now: reset-failed, restart tor@default (fall back to
tor on single-instance installs), wait up to 30s for SOCKS on 9050, and
return {"ok":false,"error":...} pointing at journalctl when it never
comes up. Callers may no longer report success without a live SOCKS port.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-09 06:49:36 -04:00
..
2026-05-06 09:23:57 -04:00