hop2 0.11.37 → 0.11.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/hop +23 -9
  2. package/package.json +1 -1
package/hop CHANGED
@@ -8847,17 +8847,31 @@ async function ensureExternalHayHostReadyOnce() {
8847
8847
 
8848
8848
  writeHayHostStateFile(started);
8849
8849
  child.unref();
8850
- if (watchdogKilledLiveHost) {
8851
- // The old host's PTYs — and every claude running inside them — died
8852
- // with it. Re-drive the fleet the way `hop restore` would instead of
8853
- // waiting for a human to notice dead shells (2026-08-31: a watchdog
8854
- // restart silently orphaned ~36 claude sessions). The delay lets the
8855
- // new host finish its own startup reconcile first; the restore
8856
- // reconciler then converges stragglers for 15 minutes.
8857
- log('[Hay] The watchdog killed a host with live sessions — auto-restoring saved sessions in 5s. Agent-created sessions are excluded; `hop restore --agents` brings those back.', YELLOW);
8850
+ // This host REPLACES one: a record of the previous host was still on
8851
+ // file when we got here. Its PTYs — and every claude running inside them
8852
+ // — died with it, however it died. Re-drive the fleet the way `hop
8853
+ // restore` would instead of waiting for a human to notice dead shells.
8854
+ //
8855
+ // Keyed on the prior record, not on who did the killing. The first
8856
+ // version fired only after a WATCHDOG kill, which left every other death
8857
+ // — a crash, an OOM, a reboot, a deliberate `kill` — to a human, and the
8858
+ // one time it mattered (2026-09-01: host restarted by hand to deploy a
8859
+ // fix) the restore that was supposed to follow never ran, because the
8860
+ // shell it was queued in lived inside the host that had just died. The
8861
+ // fleet sat empty until the user noticed. Deliberate teardown is still
8862
+ // honored: `hop stop --all` clears the record, so there is nothing to
8863
+ // replace and nothing is resurrected; the same goes for first boot.
8864
+ //
8865
+ // The delay lets the new host finish its own startup reconcile first;
8866
+ // the restore reconciler then converges stragglers for 15 minutes.
8867
+ if (existing) {
8868
+ const why = watchdogKilledLiveHost
8869
+ ? 'The watchdog killed a host with live sessions'
8870
+ : `Host ${existing.pid} is gone (not stopped by hop) and has been replaced`;
8871
+ log(`[Hay] ${why} — auto-restoring saved sessions in 5s. Agent-created sessions are excluded; \`hop restore --agents\` brings those back.`, YELLOW);
8858
8872
  setTimeout(() => {
8859
8873
  restoreSavedSessions({}).catch((e) => {
8860
- log(`[Hay] Auto-restore after the watchdog restart failed: ${e?.message || e}. Run \`hop restore\` by hand.`, RED);
8874
+ log(`[Hay] Auto-restore after the host replacement failed: ${e?.message || e}. Run \`hop restore\` by hand.`, RED);
8861
8875
  });
8862
8876
  }, 5000).unref();
8863
8877
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hop2",
3
- "version": "0.11.37",
3
+ "version": "0.11.39",
4
4
  "description": "🐰 Hop into your terminal from anywhere. Secure remote shell access with 2FA via Cloudflare Tunnel. Next-gen rewrite with native terminal sharing.",
5
5
  "main": "hop",
6
6
  "bin": {