Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): allow remote updates with database migrations #5374

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/5374/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Remote background-service updates refused every release containing a SQLite migration because rollback could only swap binaries safely.

The service launcher now snapshots all SQLite files before a trial and restores them before rollback. Trials can run migrations normally, and a protocol bump makes older launchers fail closed until one local service update installs the new safety boundary.

Verification:

  • 22 focused service launcher and update tests
  • server typecheck and targeted lint
  • CLI parsing suite
  • production server and standalone launcher bundles

Generated by GPT-5.6-sol in T3 Code using the Codex harness.


Note

High Risk Changes core self-update, SQLite persistence, and launcher recovery paths; protocol 1 launchers must perform one local service update before remote DB migrations work.

Overview Remote background-service updates can include SQLite migrations by snapshotting and restoring the database (main file plus WAL/SHM) around trial candidates, instead of blocking any release that changes the schema.

Launcher protocol 2 adds required dbPath on pending updates and request-update IPC; the launcher backs up SQLite once per trial, restores on rollback/failure (with a durable restore marker if interrupted), and drops the snapshot after commit. Preflight no longer compares migration manifests—it only requires a launcher at the new protocol. SQLite startup always runs WAL and migrations (the trial skip path is removed). Self-update passes dbPath into requestUpdate.

Boot service install fails with BootServiceUpdatePendingError when service state already has a pending remote update, so local install does not overwrite launcher/state; connect onboarding treats that like other background-setup skips.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0aaf284faba0e58abd9eb1549175b6e785f0c063. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add database snapshot and rollback support for remote server updates

  • Bumps SERVICE_LAUNCHER_PROTOCOL to 2 and adds dbPath to pending update state, update requests, and IPC messages so the launcher knows which database to snapshot.
  • Before starting a trial run, the launcher snapshots the SQLite database (including WAL and SHM files); if the snapshot fails, the trial is aborted and the previous version is restored.
  • On rollback or trial failure, the launcher restores the database from the snapshot before restarting the previous version, with a crash-safe restore marker to handle interrupted restores.
  • install in bootService.ts now aborts with BootServiceUpdatePendingError when an existing service-state.json indicates a pending remote update, preventing state from being overwritten mid-update.
  • The SQLite persistence layer always runs migrations on startup; trial-mode conditional behavior and the trial flag are removed from both the persistence layer and the launcher client.
  • Risk: Callers of BootServiceError must now handle BootServiceUpdatePendingError; requestUpdate requires dbPath; child IPC messages without dbPath are rejected.
Macroscope summarized 0aaf284.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 72f6d094-55e7-4370-9f30-73c151986d93

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      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.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      This PR changes the server update mechanism to snapshot databases before trial updates, enabling remote updates with migrations. The architectural shift from migration-blocking to snapshot-based rollback affects production deployment behavior and data integrity mechanisms, warranting human review.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 9116c0981b1c2a719eddbd6aa9d751adf89d2b6a. Configure [here](https://www.cursor.com/dashboard/bugbot).

Sign in to join this conversation.