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
restore the VNC data-path connect seam the probe refactor removed
[._.]/ Adam Eivyc9878812cb3c
diff --git a/server/services/eidoverseHost.js b/server/services/eidoverseHost.jsindex db63318210..7a0e4f349a 100644--- a/server/services/eidoverseHost.js+++ b/server/services/eidoverseHost.js@@ -11,6 +11,14 @@ import { EIDOVERSE_PORT } from './eidoverse.js';const BAD_GATEWAY_BODY = 'Eidoverse Worlds is not running.';const HOST_DESCRIPTOR_PATH = '/host';const EMBED_CONFIG_PATH = '/embed-config';++// Where a conflicting listener would sit. A local squatter almost always claims+// loopback — Docker publishes to 127.0.0.1, dev servers bind localhost — and+// loopback is also the address this bridge's own traffic arrives on when the+// page is opened from the host itself. The probe stays short because it runs on+// the startup path, before this bridge will accept anything.+const CONFLICT_PROBE_HOST = '127.0.0.1';+const CONFLICT_PROBE_TIMEOUT_MS = 300;const FORWARDED_HEADER_NAMES = new Set(['host', 'x-forwarded-host', 'x-forwarded-proto']);const targetAuthority = (host, port) => `${host}:${port}`;@@ -266,7 +274,7 @@ export function createEidoverseHost({// collide with — and it is not a connectable address to probe.if (!listenPort) return false;- return isPortReachable({ host: '127.0.0.1', port: listenPort, timeoutMs: 300 });+ return isPortReachable({ host: CONFLICT_PROBE_HOST, port: listenPort, timeoutMs: CONFLICT_PROBE_TIMEOUT_MS });};const openListener = async () => {diff --git a/server/services/remoteDesktop.js b/server/services/remoteDesktop.jsindex 9ab328b763..20e64d1e96 100644--- a/server/services/remoteDesktop.js+++ b/server/services/remoteDesktop.js@@ -6,6 +6,10 @@ import { isPortReachable } from '../lib/connectivity.js';const LOOPBACK_HOST = '127.0.0.1';const DEFAULT_VNC_PORT = 5900;+// Long enough to cross a loopback connect on a busy machine without making a+// dead VNC port feel hung. Deliberately looser than the eidoverse bridge's+// 300ms conflict probe — these two are not interchangeable.+const PROBE_TIMEOUT_MS = 750;const SESSION_TTL_MS = 5 * 60 * 1000;const CONNECTED_SESSION_TTL_MS = 8 * 60 * 60 * 1000;const TOKEN_BYTES = 32;@@ -21,6 +25,12 @@ export const createRemoteDesktopBroker = ({host = LOOPBACK_HOST,port = parseVncPort(process.env.PORTOS_VNC_PORT),now = () => Date.now(),+ // Two separate seams: `connect` opens the VNC data socket the bridge pipes+ // through, `probeFn` only asks whether anything is listening. They were one+ // option while the probe hand-rolled its own socket; isPortReachable owns that+ // lifecycle now, so the reachability check no longer borrows the data-path+ // constructor.+ connect = createConnection,probeFn = isPortReachable,connectedSessionTtlMs = CONNECTED_SESSION_TTL_MS,} = {}) => {@@ -34,7 +44,7 @@ export const createRemoteDesktopBroker = ({}};- const probe = () => probeFn({ host, port, timeoutMs: 750 });+ const probe = () => probeFn({ host, port, timeoutMs: PROBE_TIMEOUT_MS });const status = async () => ({supported: true,diff --git a/server/services/remoteDesktop.test.js b/server/services/remoteDesktop.test.jsindex 1bb2dc024c..50252cd239 100644--- a/server/services/remoteDesktop.test.js+++ b/server/services/remoteDesktop.test.js@@ -38,6 +38,19 @@ describe('remote desktop broker', () => {expect(broker.hasSession('not-a-session-token')).toBe(false);});+ it('probes reachability through the injected probeFn, at the timeout this caller sets', async () => {+ // The probe and the VNC data socket are two separate seams (#6451). A refactor+ // that folds them together drops one of them silently: the bridge keeps+ // working while reachability stops being injectable, or vice versa. Pin the+ // probe seam here — including the 750ms budget, which is deliberately NOT the+ // 500ms isPortReachable default nor the eidoverse bridge's 300ms.+ const probeFn = vi.fn().mockResolvedValue(false);+ const broker = createRemoteDesktopBroker({ port: 5900, probeFn });++ await expect(broker.createSession()).rejects.toMatchObject({ code: 'VNC_NOT_CONFIGURED' });+ expect(probeFn).toHaveBeenCalledWith({ host: '127.0.0.1', port: 5900, timeoutMs: 750 });+ });+it('refuses sessions when no loopback VNC server is listening', async () => {const temporaryServer = createServer();await new Promise((resolve) => temporaryServer.listen(0, '127.0.0.1', resolve));