Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Install the background service on a build before
0.0.46-nightly.20261014.3105(here:t3 service installon0.0.46-nightly.20261003.2610). The systemd unit isExecStart=~/.t3/runtime/versions/0.0.46-nightly.20261003.2610/t3 __service-launcher, and that launcher speaks protocol 3. - Only update through the client after that (desktop "Update server" for the remote environment). Remote updates replace only the child, so the launcher stays at 0.0.46-nightly.20261003.2610 indefinitely. Recent children (0.1.10) still run under it because protocol 3 stays supported (
apps/server/src/cloud/serviceProtocol.ts:9). - Let
statev2.sqlitegrow large (here 21 GB: 5,246,110 pages, 1,311,893 on the freelist). - From the client, update the server to a release whose migrations take more than about 2 minutes on that database:
0.1.10-nightly.20261115.4723→0.1.11-nightly.20261117.4814. That release runs migration95_TurnItemInlineWorkOutput, which took 90 s on its own when run offline.
Expected behavior
The trial gets the 30-minute prepared deadline that #19311 introduced, so the migration finishes and the update commits. If the installed launcher cannot give it that deadline, the update should be refused up front with the existing "update the launcher on the server machine" guidance, not attempted.
Actual behavior
The old launcher still has PREPARED_TIMEOUT_MS = 12e4 (confirmed in the installed binary's bundled serviceLauncher). The trial is killed partway through migration 95, the snapshot is restored, and the service returns to 0.1.10:
{ "protocol": 3, "activeVersion": "0.1.10-nightly.20261115.4723",
"update": { "targetVersion": "0.1.11-nightly.20261117.4814",
"status": "rolled-back", "reason": "prepared-timeout" } }The client still offers the update, so each retry repeats the whole cycle. Over Nov 16–18 this happened 6 times (5 for this target, 1 for 0.1.10-nightly.20261116.4761). Each attempt cost:
- About 3–3.5 minutes with nothing listening on :3773. The relay logs
dial tcp 127.0.0.1:3773: connect: connection refusedfor the whole window. - Every live provider session stopped. Shutdown reconciliation reported
stoppedSessions: 19andstoppedSessions: 50on two of the attempts. - A full snapshot of the 21 GB database, and the same migration work again on the next try.
docs/internals/server-updates.mdnames this cost ("the retry pays the same cost again"), but with a 120 s deadline a retry can never succeed.
The client shows only "The t3@{version} update rolled-back." It gives no reason and no action, so nothing tells the user that the launcher is the problem.
Root cause: #19311 (shipped in 0.0.46-nightly.20261014.3105) raised the deadline in the launcher, and the client now waits 32 minutes (SERVER_UPDATE_RESUME_TIMEOUT). A remote update never replaces the launcher, and protocol 3 is still accepted. So every service installed before Oct 14 and updated only from clients keeps the 120 s deadline, and heavy migrations have become common since then. Preflight checks only the protocol number (apps/server/src/cloud/servicePreflight.ts:46), and both kinds of protocol-3 launcher (120 s and 30 min) report the same number.
Impact
Major degradation or frequent failure
Version or commit
Launcher 0.0.46-nightly.20261003.2610 (protocol 3); server 0.1.10-nightly.20261115.4723 → 0.1.11-nightly.20261117.4814; code read on main @ 316c325
Environment
Omarchy (Arch Linux), kernel 7.1.8, systemd user service, btrfs, used remotely through the desktop app over T3 Connect. statev2.sqlite is 21 GB. The unit also has a MemoryHigh=6G drop-in, which throttles the trial, but the migration took 90 s even unthrottled, which leaves no margin under 120 s.
Logs or stack traces
# boot-service.log, one cycle (all six look the same)
[10:21:09.295] INFO Server update prepared; handing off to the service launcher.
targetVersion: '0.1.11-nightly.20261117.4814'
[10:21:14.843] INFO V2 orchestration shutdown reconciliation completed { stoppedSessions: 50 }
[10:21:42.045] INFO Running database migrations
[10:21:42.049] INFO Upgrading database migration: 95_TurnItemInlineWorkOutput progress: 1 of 2
# no further output from the trial; launcher times it out and restores 0.1.10
[10:24:43.543] INFO Listening on http://0.0.0.0:3773 # back on 0.1.10
# same migration run by hand with no deadline (0.1.11 `t3 serve`, service stopped)
[10:28:02.720] INFO Upgrading database migration: 95_TurnItemInlineWorkOutput progress: 1 of 2
[10:29:32] migration: 96_RepairStaleTitleRegeneration progress: 2 of 2
[10:29:33.115] INFO Listening on http://127.0.0.1:3774
$ strings ~/.t3/runtime/versions/0.0.46-nightly.20261003.2610/t3 | grep PREPARED_TIMEOUT_MS
PREPARED_TIMEOUT_MS = 12e4;Workaround
Run the migration once with no deadline, then select the new runtime:
systemctl --user stop t3code.service, then take a reflink backup ofstatev2.sqlite.T3CODE_HOME=~/.t3 ~/.t3/runtime/versions/<target>/t3 serve --host 127.0.0.1 --port 3774 --no-browser. Wait forListening, then stop it.- Set
service-state.jsontoactiveVersion: <target>(updatestatus: "committed") and start the service.
A local t3 update that replaces the launcher should avoid the problem for later updates too.
Suggested fix (smallest first):
- Refuse instead of looping. In preflight, read the launcher runtime version from the unit's
ExecStart(already parsed inserviceProtocol.ts). If it predates0.0.46-nightly.20261014.3105, refuse the remote update with the existing "requires a newer service launcher; runt3 updateon the server machine" path, at least when the target has pending migrations. - Make the rollback actionable. When the outcome is
rolled-backwith reasonprepared-timeout, the client should say so, suggest updating the launcher locally, and stop re-offering the same target to that environment.
Activity
f4llenz commentedon Dec 1, 2026
Same bug on another host, still present in
0.1.14-nightly.20261201.5550:0.0.46-nightly.20261003.2610(installed witht3 service install, then updated only from the desktop), Linux systemd user unit,statev2.sqlite15 GB.0.1.9-nightly.20261111.4501 → 0.1.12-nightly.20261125.5230rolled back on Nov 25, and0.1.9 → 0.1.14-nightly.20261201.5550rolled back three times on Dec 1, all with"status": "rolled-back", "reason": "prepared-timeout". Each trial was killed at migration 8 of 42 (88_TurnItemTypeStatusIndex), 120 s after spawn. One rollback's recovery reportedstoppedSessions: 97.t3 update --yeson the host rewroteExecStartto the 0.1.14 launcher (protocol 4). All 42 migrations then finished in 5 min 20 s. Going straight from the 0.0.46 launcher to the 0.1.14 one did not crash-loop here, unlike the report in [Bug]: In-app update keeps rolling back when the service launcher predates #19311 #41668.