fix: smooth remote server updates - #5470
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR changes runtime behavior around server updates: new stop marker protocol, modified tunnel release logic, and systemd KillMode configuration change. While well-tested and from a trusted contributor, the changes to tunnel lifecycle management during updates warrant human review. You can customize Macroscope's approvability policy. Learn more. |
8d56061 to
5b72fd9
Compare
The version-skew banner is no longer an amber warning: it reads "Server update available" with the raw versions (unreadable for nightlies) moved to a tooltip. The in-flight rail (Download/Install/ Resume) becomes a single status row, "Downloading…" then "Restarting…", since the wire installing stage is a sub-second launcher handoff and "resuming" meant nothing to most people. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Measured on a live update: the server was back in ~9s but stayed unreachable for ~96s, because releasing the tunnel on shutdown forces the replacement tunnel's hostname route through 1-2 minutes of edge propagation. An update handoff always brings a server right back (new version or rollback), so the tunnel is never orphaned; skip the release when the launcher state file records a pending update. The next boot respawns the connector from the stored config against the same tunnel and is reachable as soon as it connects. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…pdate A pending update in the launcher state is not proof a replacement server is coming: `t3 service uninstall` or `systemctl stop` during the pending window also tears the server down, permanently. The launcher now writes a stop marker before signalling its child on an explicit stop and clears it on the next start; the shutdown tunnel release keeps the tunnel only for pending updates without the marker. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5b72fd9 to
8d599f9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 63c155f. Configure here.
## What's Changed * fix: smooth remote server updates by @t3dotgg in pingdotgg/t3code#5470 * fix(server): drop superseded tool updates from snapshots by @t3dotgg in pingdotgg/t3code#5483 **Full Changelog**: pingdotgg/t3code@v0.0.32-nightly.20260806.1014...v0.0.32-nightly.20260806.1015 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.32-nightly.20260806.1015

A remote server update restarts the server in ~9 seconds, but the client stayed disconnected for 90+ seconds, and the progress UI was a three-step rail (Download / Install / Resume) where "Install" is a sub-second launcher handoff and "Resuming" meant nothing to most people.
Two changes:
Keep the managed tunnel across update restarts. Shutdown released the Cloudflare tunnel, so every update forced the replacement tunnel's hostname route through 1-2 minutes of edge propagation — measured on a live update: server listening at T+9s, first inbound request at T+96s. An update handoff always brings a server right back (new version, or the old one after rollback), so the tunnel is never orphaned. The release now checks the launcher's durable state file and skips deletion when an update is pending; the next boot respawns the connector from the stored config against the same tunnel and is reachable as soon as it connects (~T+12s). Explicit unlink and non-update shutdowns still release, so the per-tunnel billing hygiene is unchanged.
Calmer, honest update UI. The version-skew banner is no longer an amber warning: it reads "Server update available" with the raw versions (unreadable for nightlies) in a tooltip. The in-flight rail becomes a single status row, "Downloading…" then "Restarting…", matching what actually happens; failures keep the row with the rollback reason and a Retry action.
Together with #5404 (merged), an update should now be: ~6s "Downloading…", ~10s "Restarting…", reconnected.
Written by Claude Fable 5 running in Claude Code.
Note
Medium Risk
Changes managed-tunnel lifecycle on shutdown and systemd kill behavior during updates; mistakes could leak tunnels or drop connectivity on uninstall, though new tests cover handoff vs explicit stop.
Overview
Remote server updates were slow to reconnect because shutdown released the managed Cloudflare tunnel, forcing a new tunnel and long hostname route propagation. Shutdown now reads the launcher’s
service-state.jsonand skips tunnel release when a pending update is a handoff (pending update without.service-stopping). Explicit stops (systemctl stop, uninstall) still release the tunnel.The service launcher writes
.service-stoppingsynchronously onstop()so the child can tell “service going away” from “replacement starting”; recovery clears stale markers. The systemd unit usesKillMode=mixedso the launcher gets signals before the cgroup is torn down. Trial servers register tunnel cleanup before activation when a pending update exists; normal runtimes still wait until after activation.UI/docs: version skew is no longer an amber warning—“Server update available” with versions in a tooltip. In-flight progress is a single row (Downloading… / Restarting…), folding the sub-second install handoff into download; docs match.
Reviewed by Cursor Bugbot for commit 063ddb7. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Preserve managed tunnel during server update handoff on shutdown
releaseManagedTunnelOnShutdownnow checks for a pending update handoff (pending update recorded + no explicit stop marker). If detected, the managed tunnel is kept alive so the replacement server can inherit it.SERVICE_STOP_MARKER_FILEsynchronously at the start ofstop()so the child can distinguish an explicit stop from an update handoff. The marker is cleared on recovery to avoid stale state.KillModechanges fromcontrol-grouptomixedinrenderBootServiceUnitto support smoother process handoff.Macroscope summarized 063ddb7.