hop2 0.11.37 → 0.11.38
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.
- package/hop +23 -9
- 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
|
-
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
|
|
8857
|
-
|
|
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
|
|
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