add verified updates and rollback for compiled installs - #2166
add verified updates and rollback for compiled installs#2166kevinjosethomas wants to merge 8 commits into
Conversation
Refs ENG-6047; fixes #2166
Refs ENG-6047; fixes #2166
Prime Agent performance — completedPR Overall: 0 regressed · 0 improved · 17 no clear change.
Python runtime
Sandbox cost: ~$0.0877 — no inference calls. Methodology and samplesMain resolved at 2026-09-11T01:35:35.784512+00:00. Harness
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes 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 fccd033. Configure here.
38cfd42 to
e441b97
Compare
|
[written by prime-agent, checked by snimu] |
|
[written by prime-agent, checked by snimu] |
|
[written by prime-agent, checked by snimu] |

This is part of the PR stack migrating us to use Bun to compile Prime Agent for releases. This makes supported installations self-contained, removing the need to download and install Node.js and npm packages separately.
This PR adds updates and rollback for compiled installations. Users update through the usual command, downloads are checked before activation, and restarted sessions use the new version. Prime Agent keeps the previous compiled release so users can switch back without downloading it again.
Tested updates between simulated Bun-compiled releases, offline rollback, corrupt downloads, simultaneous updates, and interrupted updates. The combined stack passed 109 of 110 scenarios; the remaining case was the existing npm 12 restriction, with tested recovery. Forced termination can require manual recovery. The final release-metadata fix passed 44 targeted tests.
ENG-6047 · Stack: #2140 → #2165 → #2166.
Note
Add verified updates and offline rollback for compiled installs
getNativeUpdatePlanresolves the latest release, selects matching native artifacts, and produces a verified install command or offline rollback command.prime_agent_native_rollbackvalidates the retained previous release directory and assets, then activates it without downloading.prime_agent_install_nativeaborts the download if the release manifest checksum does not match the planner-supplied checksum.getLatestPiReleaseisolates malformed native artifact metadata, dropping it so npm updates still work while native update planning rejects the release.getLatestPiRelease, falling back to npm metadata only.Macroscope summarized ee33a74.
Note
Medium Risk
Changes the self-update and release-activation path for compiled installs, including checksum gates and symlink swapping, but failed validation leaves the active release unchanged and rollback is limited to managed installs.
Overview
Adds managed compiled self-update and offline rollback so
prime-agent updateno longer depends on npm when running from an installer-owned Bun binary.Compiled updates resolve the channel release, require a validated platform entry in the manifest (
binarieswith matching SHA-256), and invoke the bundledinstall.shwith guards likePRIME_AGENT_EXPECTED_CURRENTandPRIME_AGENT_EXPECTED_SHA256.update --rollbackswitches back to the retainedbin/previousrelease without downloading; the installer validates the previous directory and assets before activation.install.sh --rollbackimplements the same path for non-interactive use.The CLI wires
--rollbackthrough public commands and package self-update, routes Bun installs throughgetNativeUpdatePlan, and usescreateUpdatedCliSubprocessLaunchSpecso interactive updates and daemon restart coordinators relaunch via the stable managed launcher after activation.getLatestPiReleasenow parses optional native artifact metadata but drops the wholebinarieslist when any entry is invalid, so bad compiled metadata does not block npm updates while native planning still rejects unverified archives.Documentation and regression tests cover verified updates, offline rollback, manifest/checksum failures, interrupted rollback, and end-to-end flows on real archives.
Reviewed by Cursor Bugbot for commit ee33a74. Bugbot is set up for automated code reviews on this repo. Configure here.