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

address review (codex): exit non-zero from non-TTY setup when no DB available

Adam Eivy7f6371ff2a60
diff --git a/scripts/setup-db.js b/scripts/setup-db.js
index fe5f836d3e..2c35bdb05d 100644
--- a/scripts/setup-db.js
+++ b/scripts/setup-db.js
@@ -174,12 +174,17 @@ function setPgMode(mode) {
// Prompt user to choose storage mode (TTY only)
function promptStorageChoice(message, hint) {
- // Stdout redirected means we can't show the prompt — warn and exit 0 without changing mode.
+ // Non-interactive (stdout/stdin redirected, e.g. `npm start` under PM2): we
+ // can't prompt. By the time we reach here, handleDockerUnavailable() has
+ // already ruled out a healthy native PostgreSQL, so there is no usable DB and
+ // no file fallback anymore — setup genuinely failed. Exit NON-ZERO so the
+ // `&&`-chained `npm start` / `npm run setup` halts here instead of launching
+ // a server that would immediately fail-fast and crash-loop under PM2.
if (!process.stdin.isTTY || !process.stdout.isTTY) {
- console.error(`⚠️ ${message}`);
+ console.error(`❌ ${message}`);
console.error(` ${hint}`);
- console.error(' Start Docker then run: npm run setup');
- process.exit(0);
+ console.error(' PostgreSQL is required. Start Docker (or set up native PostgreSQL) then run: npm run setup');
+ process.exit(1);
}
return new Promise((resolve) => {