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

refactor(review): trim single-instance guard to real PM2 statuses (online, launching) (#2991)

[._.]/ Adam Eivy68b11dec04ce
diff --git a/server/routes/apps/lifecycle.js b/server/routes/apps/lifecycle.js
index adfeb0b938..6b134c6496 100644
--- a/server/routes/apps/lifecycle.js
+++ b/server/routes/apps/lifecycle.js
@@ -71,13 +71,13 @@ router.post('/:id/start', loadApp, asyncHandler(async (req, res) => {
for (let i = 0; i < processNames.length; i++) {
const name = processNames[i];
const command = commands[i] || commands[0];
- // Single instance: a desktop/GUI process that is already up — or in a
- // transient coming-up state — must not be relaunched into a second window.
- // Match every "already running or about to be" PM2 status, not just the
- // steady `online`, so a click during a slow launch can't spawn a duplicate.
+ // Single instance: a desktop/GUI process that is already up — or in the
+ // transient `launching` state a slow game build sits in — must not be
+ // relaunched into a second window. Matching more than the steady `online`
+ // is what stops a click during a slow launch from spawning a duplicate.
if (desktop) {
const current = await pm2Service.getAppStatus(name, app.pm2Home).catch(() => null);
- if (['online', 'launching', 'restarting', 'waiting_restart'].includes(current?.status)) {
+ if (['online', 'launching'].includes(current?.status)) {
results[name] = { success: true, alreadyRunning: true };
continue;
}