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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: treat a host-only selection as an explicit native endpoint (#9470)
Adam Eivyb2d3f0fad578
diff --git a/scripts/db-migrate.test.js b/scripts/db-migrate.test.jsindex 70e9ee7234..6abf6c006c 100644--- a/scripts/db-migrate.test.js+++ b/scripts/db-migrate.test.js@@ -291,4 +291,13 @@ describe.skipIf(process.platform === 'win32')('scripts/db.sh export + migrate',expect(psqlCalls()).toEqual([]);expect(readFileSync(envFile, 'utf8')).toBe('PGMODE=docker\n');});++ it('keeps a host-only selection on the default port instead of discovering another cluster', () => {+ const result = run(['setup-native'], 'ok', { PGHOST: 'db.example.invalid', READY_PORTS: '5432' });+ expect(result.status).toBe(0);+ expect(psqlCalls().every(call => call.includes('-h db.example.invalid -p 5432 '))).toBe(true);+ const down = run(['setup-native'], 'ok', { PGHOST: 'db.example.invalid', READY_PORTS: '5433' });+ expect(down.status).not.toBe(0);+ expect(psqlCalls().every(call => !call.includes('-p 5433 '))).toBe(true);+ });});diff --git a/scripts/db.sh b/scripts/db.shindex d4f06e6312..5bd92ba13c 100755--- a/scripts/db.sh+++ b/scripts/db.sh@@ -30,6 +30,7 @@ ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"PGUSER="${PGUSER:-portos}"PGDATABASE="${PGDATABASE:-portos}"PGPASSWORD="${PGPASSWORD:-portos}"+SELECTED_PGHOST="${PGHOST:-}"PGHOST="${PGHOST:-localhost}"# The maintenance coordinator names its install's dump directory explicitly# (its data root can differ from this checkout); otherwise use this checkout.@@ -70,8 +71,9 @@ get_port() {fi}-# Whether the caller named a port. setup-native provisions exactly that-# endpoint; only an unnamed port falls back to local service discovery.+# Whether the caller named a host or port. setup-native provisions exactly that+# endpoint (an unnamed half keeps its default); only a fully unnamed endpoint+# falls back to local service discovery.SELECTED_PGPORT="${PGPORT:-}"PGPORT=$(get_port)EXPLICIT_ENDPOINT=false@@ -469,8 +471,8 @@ cmd_setup_native() {# Step 2: Ensure PostgreSQL is running. A caller-selected endpoint# (PGHOST/PGPORT) is provisioned as-is: discovery must never redirect SQL# (role/password changes, schema) to a different cluster than the one chosen.- if [ -n "$SELECTED_PGPORT" ]; then- PGPORT="$SELECTED_PGPORT"+ if [ -n "$SELECTED_PGPORT" ] || [ -n "$SELECTED_PGHOST" ]; then+ PGPORT="${SELECTED_PGPORT:-5432}"if pg_isready -h "$PGHOST" -p "$PGPORT" >/dev/null 2>&1; thenlog "PostgreSQL already running at $PGHOST:$PGPORT"elif [ "$(uname)" = "Darwin" ] && command -v brew >/dev/null 2>&1; then