Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(core): surface core connection status in settings

Steven Enamakel09e8d686391f
diff --git a/app/src/components/BootCheckGate/BootCheckGate.tsx b/app/src/components/BootCheckGate/BootCheckGate.tsx
index a017bea563..076740658b 100644
--- a/app/src/components/BootCheckGate/BootCheckGate.tsx
+++ b/app/src/components/BootCheckGate/BootCheckGate.tsx
@@ -22,6 +22,7 @@ import {
import {
clearCoreRpcTokenCache,
clearCoreRpcUrlCache,
+ probeCoreRealtime,
testCoreRpcConnection,
} from '../../services/coreRpcClient';
import { type CoreMode, resetCoreMode, setCoreMode } from '../../store/coreModeSlice';
@@ -199,6 +200,12 @@ function ModePicker({ onConfirm }: PickerProps) {
} catch {
// Non-JSON body is unusual but doesn't disprove reachability.
}
+ const realtime = await probeCoreRealtime(validated.url);
+ if (realtime === 'disabled') {
+ log('[boot-check] picker — RPC ok but realtime (Socket.IO) is disabled on the core');
+ setTestStatus({ kind: 'socketDisabled' });
+ return;
+ }
log('[boot-check] picker — test succeeded');
setTestStatus({ kind: 'ok' });
} catch (err) {
@@ -357,6 +364,11 @@ function ModePicker({ onConfirm }: PickerProps) {
{t('bootCheck.connectedOk')}
</span>
)}
+ {testStatus.kind === 'socketDisabled' && (
+ <span className="text-xs text-red-600" data-testid="test-status-socket-disabled">
+ {t('bootCheck.socketDisabled')}
+ </span>
+ )}
{testStatus.kind === 'auth' && (
<span className="text-xs text-red-600" data-testid="test-status-auth">
{t('bootCheck.authFailed')}
diff --git a/app/src/components/settings/panels/CoreConnectionPanel.tsx b/app/src/components/settings/panels/CoreConnectionPanel.tsx
index 2bc34ccf01..f1b4c4d178 100644
--- a/app/src/components/settings/panels/CoreConnectionPanel.tsx
+++ b/app/src/components/settings/panels/CoreConnectionPanel.tsx
@@ -34,6 +34,7 @@ import { useT } from '../../../lib/i18n/I18nContext';
import {
clearCoreRpcTokenCache,
clearCoreRpcUrlCache,
+ probeCoreRealtime,
testCoreRpcConnection,
} from '../../../services/coreRpcClient';
import { gatewaysAvailable } from '../../../services/gatewayService';
@@ -70,6 +71,7 @@ type TestStatus =
| { kind: 'idle' }
| { kind: 'testing' }
| { kind: 'ok' }
+ | { kind: 'socketDisabled' }
| { kind: 'auth' }
| { kind: 'unreachable'; reason: string };
@@ -108,6 +110,17 @@ async function testCoreRpcConnectionWithTimeout(url: string, token?: string): Pr
}
}
+/** Realtime (Socket.IO) availability probe with the same bounded deadline. */
+async function probeCoreRealtimeWithTimeout(url: string) {
+ const controller = new AbortController();
+ const timer = setTimeout(() => controller.abort(), CONNECTION_TEST_TIMEOUT_MS);
+ try {
+ return await probeCoreRealtime(url, { signal: controller.signal });
+ } finally {
+ clearTimeout(timer);
+ }
+}
+
const CoreConnectionPanel = () => {
const { t } = useT();
const dispatch = useAppDispatch();
@@ -251,7 +264,8 @@ const CoreConnectionPanel = () => {
} catch {
/* reachable regardless of body shape */
}
- setTestStatus({ kind: 'ok' });
+ const realtime = await probeCoreRealtimeWithTimeout(validated.url);
+ setTestStatus({ kind: realtime === 'disabled' ? 'socketDisabled' : 'ok' });
} catch (err) {
const reason = err instanceof Error ? err.message : 'Connection failed';
setTestStatus({ kind: 'unreachable', reason });
@@ -475,6 +489,11 @@ const CoreConnectionPanel = () => {
{t('bootCheck.connectedOk')}
</span>
)}
+ {testStatus.kind === 'socketDisabled' && (
+ <span className="text-xs text-coral-600" data-testid="core-test-socket-disabled">
+ {t('bootCheck.socketDisabled')}
+ </span>
+ )}
{testStatus.kind === 'auth' && (
<span className="text-xs text-coral-600" data-testid="core-test-auth">
{t('bootCheck.authFailed')}
diff --git a/app/src/services/coreRpcClient.ts b/app/src/services/coreRpcClient.ts
index a5aeef68d0..e4dec5ed02 100644
--- a/app/src/services/coreRpcClient.ts
+++ b/app/src/services/coreRpcClient.ts
@@ -674,6 +674,41 @@ export async function testCoreRpcConnection(
return fetch(rpcUrl, { method: 'POST', headers, body, signal: init?.signal });
}
+/** Outcome of [`probeCoreRealtime`]. */
+export type CoreRealtimeProbe = 'ok' | 'disabled' | 'unknown';
+
+/**
+ * Checks whether the core's realtime (Socket.IO) endpoint is on, without
+ * opening a socket: a Socket.IO-disabled core (`--jsonrpc-only`) answers
+ * `/socket.io/` with HTTP 503 and `{ error: "socketio_disabled" }` (#5656).
+ *
+ * Only that exact response yields `'disabled'`. Any network error, relay-only
+ * runtime or unexpected status is `'unknown'`, so a flaky probe never blocks or
+ * misreports an otherwise working RPC connection.
+ */
+export async function probeCoreRealtime(
+ url: string,
+ init?: { signal?: AbortSignal }
+): Promise<CoreRealtimeProbe> {
+ try {
+ const target = new URL(normalizeRpcUrl(url));
+ target.pathname = '/socket.io/';
+ target.search = 'EIO=4&transport=polling';
+ target.hash = '';
+ // The mixed-content shell relay is POST-only; skip rather than guess.
+ if (isTauri() && rpcUrlNeedsShellRelay(target.toString())) return 'unknown';
+ const response = await fetch(target.toString(), { method: 'GET', signal: init?.signal });
+ if (response.status === 503) {
+ const body = (await response.json().catch(() => null)) as { error?: unknown } | null;
+ return body?.error === 'socketio_disabled' ? 'disabled' : 'unknown';
+ }
+ return response.status === 200 ? 'ok' : 'unknown';
+ } catch (err) {
+ coreRpcLog('[rpc] realtime probe inconclusive: %o', err);
+ return 'unknown';
+ }
+}
+
export async function getCoreHttpBaseUrl(): Promise<string> {
const rpcUrl = await getCoreRpcUrl();
const url = new URL(rpcUrl);