Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: document managed updates that rebase and autostash local work

[._.]/ Adam Eivyc4e7ada7657c
diff --git a/docs/MANAGED_APP_UPDATES.md b/docs/MANAGED_APP_UPDATES.md
index 7e4fdde0ed..50fd26f492 100644
--- a/docs/MANAGED_APP_UPDATES.md
+++ b/docs/MANAGED_APP_UPDATES.md
@@ -3,13 +3,30 @@
PortOS updates itself through `update.sh` or `update.ps1`. That lifecycle is
specific to PortOS and is never assumed for a separately managed app.
-When a managed app is updated, PortOS first fetches `origin`, checks out that
-repository's default branch, fast-forwards it, and restarts the app's configured
-PM2 processes. It does not automatically run `npm install`, `setup`, migrations,
-or a production build. If the checkout has local changes, the update stops
-without stashing or discarding them.
-
-An app can opt into its own lifecycle in either of these ways:
+When a managed app is updated, PortOS fetches `origin` and checks out the
+repository's configured `portos.runtimeBranch`, or origin's default branch when
+that setting is absent. It first tries `git pull --ff-only origin <branch>`.
+If that fails, it retries with `git pull --rebase --autostash origin <branch>`:
+local commits can be rebased, and tracked uncommitted changes can be temporarily
+stashed and reapplied. Local changes do **not** automatically stop an update;
+non-conflicting changes can also carry across the branch switch. Commit work
+before updating if you need a durable recovery point, and preserve untracked
+files separately — `--autostash` is not an untracked-file backup.
+
+A blocked checkout, failed rebase, or conflict while reapplying the autostash
+stops the update before lifecycle commands or process restart. PortOS attempts
+to abort a failed rebase and queues a CoS conflict-resolution task. An autostash
+reapply conflict can leave unmerged files after the rebase has completed; the
+update does not treat Git's zero exit status as success in that case. Review
+the reported conflict and task outcome before retrying. Configured companion
+repositories follow the same pull sequence; a later conflict does not roll
+back repositories already updated.
+
+After successful pulls, PortOS runs any opted-in lifecycle below and restarts
+the app's configured PM2 processes. Without that lifecycle, it does not
+automatically run `npm install`, `setup`, migrations, or a production build.
+
+An app can opt into its own lifecycle in these ways:
1. Add an executable `update.sh` (or `update.ps1` on Windows) at the repository
root. PortOS recognizes these conventional scripts automatically.
@@ -32,10 +49,11 @@ When more than one is present, the configured **Update Command** wins, then
The PortOS record appears in App Management like any other app, so **Update**
there runs the same `appUpdater` flow described above. It is the one app whose
update routine deletes the process running that flow, so it takes a different
-launcher: the conventional-script branch delegates to `executeUpdate()` in
-`server/services/updateExecutor.js`, whose double-fork keeps `update.sh` alive
-through its own `pm2 delete` step, and the trailing PM2 restart is skipped
-because the script starts the ecosystem itself. See
+launcher: when the record points at the running PortOS checkout and uses its
+conventional update script, it delegates to `startPortosSelfUpdate()` in
+`server/services/portosSelfUpdate.js` with mode `refresh`. The shared detached
+launcher keeps the update alive through its own PM2 shutdown. The trailing
+PM2 restart is skipped because the script starts the ecosystem itself. See
[Self-Update Flow](SELF_UPDATE.md#every-portos-update-goes-through-the-detached-launcher).
A custom **Update Command** on the PortOS record keeps the ordinary attached