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
feat: add OpenClaw instance feature flag
[._.]/ Adam Eivy886ac70e70b0
diff --git a/client/src/components/Layout.test.jsx b/client/src/components/Layout.test.jsxindex 3a2f4b6d3c..a63ff51446 100644--- a/client/src/components/Layout.test.jsx+++ b/client/src/components/Layout.test.jsx@@ -3,6 +3,7 @@ import { render, screen, within, act, fireEvent, waitFor } from '@testing-librarimport { MemoryRouter } from 'react-router';import { PINNED_KEY } from '../utils/navWorkingSet.js';import * as api from '../services/api';+import { INSTANCE_FEATURES_CHANGED } from '../constants/events.js';// This suite locks the *integration* path that SingleNavRow.test.jsx can't reach:// pinning a top-level `single: true` row (Dashboard `/`, Review Hub `/review`,@@ -52,7 +53,7 @@ vi.mock('../services/socket', () => ({// --- API: every sidebar fetch resolves empty so the dynamic sections stay bare// and the single rows are the only top-level leaves under test. ----// Instance features gate sidebar rows (POST / DataDog / JIRA / GSD). Default every+// Instance features gate sidebar rows (POST / DataDog / JIRA / GSD / OpenClaw). Default every// feature ON so these tests see the full sidebar; the gating itself is covered// by 'Layout — instance feature gating' below.const allFeaturesOn = () => [@@ -60,6 +61,7 @@ const allFeaturesOn = () => [{ id: 'datadog', label: 'DataDog', enabled: true },{ id: 'jira', label: 'JIRA', enabled: true },{ id: 'gsd', label: 'GSD', enabled: true },+ { id: 'openclaw', label: 'OpenClaw', enabled: true },];const featureMock = vi.hoisted(() => ({ features: null }));@@ -68,6 +70,7 @@ vi.mock('../services/api', () => ({listPipelineSeries: vi.fn(() => Promise.resolve([])),listUniverses: vi.fn(() => Promise.resolve([])),getPaletteManifest: vi.fn(() => Promise.resolve({ nav: [] })),+ getDailyActions: vi.fn(() => Promise.resolve({ actions: [] })),getInstanceFeatures: vi.fn(() => Promise.resolve({ features: featureMock.features })),}));@@ -204,6 +207,18 @@ describe('Layout — instance feature gating', () => {expect(screen.getByRole('link', { name: 'Features' })).toHaveAttribute('href', '/settings/features');});+ it('shows and hides OpenClaw with its instance feature flag', async () => {+ await renderLayout('/openclaw');+ expect(screen.getByRole('link', { name: 'OpenClaw' })).toHaveAttribute('href', '/openclaw');++ featureMock.features = allFeaturesOn()+ .map((feature) => feature.id === 'openclaw' ? { ...feature, enabled: false } : feature);+ act(() => window.dispatchEvent(new CustomEvent(INSTANCE_FEATURES_CHANGED, {+ detail: { features: featureMock.features },+ })));+ expect(screen.queryByRole('link', { name: 'OpenClaw' })).toBeNull();+ });+it('drops the whole POST section when POST is off', async () => {featureMock.features = allFeaturesOn().map((f) => (f.id === 'post' ? { ...f, enabled: false } : f));diff --git a/client/src/components/apps/tabs/GsdTab.jsx b/client/src/components/apps/tabs/GsdTab.jsxindex e6bfe55192..d051b91d4d 100644--- a/client/src/components/apps/tabs/GsdTab.jsx+++ b/client/src/components/apps/tabs/GsdTab.jsx@@ -8,6 +8,7 @@ import PhaseCardList from '../../gsd/PhaseCardList';import GsdConcernsPanel from '../../cos/tabs/GsdConcernsPanel';import GsdDocumentsPanel from '../../gsd/GsdDocumentsPanel';import * as api from '../../../services/api';+import { useInstanceFeatures } from '../../../hooks/useInstanceFeatures.js';const STEP_DESCRIPTIONS = {map: 'Run the /gsd:map-codebase skill to analyze the codebase structure',@@ -17,6 +18,7 @@ const STEP_DESCRIPTIONS = {function GsdSetupGuide({ gsd, appId, repoPath, onRefresh }) {const navigate = useNavigate();+ const { isFeatureEnabled } = useInstanceFeatures();const [runningStep, setRunningStep] = useState(null);// Determine the current step based on what exists@@ -83,12 +85,14 @@ function GsdSetupGuide({ gsd, appId, repoPath, onRefresh }) {<div className="flex items-center gap-2">{repoPath && (<>- <button- onClick={handleOpenOpenClaw}- className="px-3 py-1.5 bg-cyan-600/20 hover:bg-cyan-600/30 text-cyan-400 rounded-lg text-xs flex items-center gap-1 border border-cyan-600/30"- >- <Terminal size={14} /> Open OpenClaw- </button>+ {isFeatureEnabled('openclaw') && (+ <button+ onClick={handleOpenOpenClaw}+ className="px-3 py-1.5 bg-cyan-600/20 hover:bg-cyan-600/30 text-cyan-400 rounded-lg text-xs flex items-center gap-1 border border-cyan-600/30"+ >+ <Terminal size={14} /> Open OpenClaw+ </button>+ )}<buttononClick={handleOpenClaude}className="px-3 py-1.5 bg-port-accent-2/20 hover:bg-port-accent-2/30 text-port-accent-2 rounded-lg text-xs flex items-center gap-1 border border-port-accent-2/30"@@ -328,4 +332,3 @@ export default function GsdTab({ appId, repoPath }) {</div>);}-diff --git a/client/src/components/gsd/GsdProjectHeader.jsx b/client/src/components/gsd/GsdProjectHeader.jsxindex 0c2296cbe2..1aa34b867a 100644--- a/client/src/components/gsd/GsdProjectHeader.jsx+++ b/client/src/components/gsd/GsdProjectHeader.jsx@@ -2,6 +2,7 @@ import { useNavigate } from 'react-router';import toast from '../ui/Toast';import { RefreshCw, Terminal, Play, Settings } from 'lucide-react';import * as api from '../../services/api';+import { useInstanceFeatures } from '../../hooks/useInstanceFeatures.js';const STATUS_COLORS = {active: 'bg-port-accent text-port-accent',@@ -11,6 +12,7 @@ const STATUS_COLORS = {export default function GsdProjectHeader({ project, appId, repoPath, onRefresh }) {const navigate = useNavigate();+ const { isFeatureEnabled } = useInstanceFeatures();const state = project?.state?.frontmatter || {};const phases = project?.phases || [];const completedPhases = phases.filter(p => p.totalTasks > 0 && p.completedTasks === p.totalTasks && p.verification?.status === 'passed').length;@@ -112,12 +114,14 @@ export default function GsdProjectHeader({ project, appId, repoPath, onRefresh })}{repoPath && (<>- <button- onClick={handleOpenOpenClaw}- className="px-3 py-1.5 bg-cyan-600/20 hover:bg-cyan-600/30 text-cyan-400 rounded-lg text-xs flex items-center gap-1 border border-cyan-600/30"- >- <Terminal size={14} /> OpenClaw- </button>+ {isFeatureEnabled('openclaw') && (+ <button+ onClick={handleOpenOpenClaw}+ className="px-3 py-1.5 bg-cyan-600/20 hover:bg-cyan-600/30 text-cyan-400 rounded-lg text-xs flex items-center gap-1 border border-cyan-600/30"+ >+ <Terminal size={14} /> OpenClaw+ </button>+ )}<buttononClick={handleOpenClaude}className="px-3 py-1.5 bg-port-accent-2/20 hover:bg-port-accent-2/30 text-port-accent-2 rounded-lg text-xs flex items-center gap-1 border border-port-accent-2/30"diff --git a/client/src/components/settings/SettingsTabsHeader.jsx b/client/src/components/settings/SettingsTabsHeader.jsxindex ffb81d4b78..7f56e39007 100644--- a/client/src/components/settings/SettingsTabsHeader.jsx+++ b/client/src/components/settings/SettingsTabsHeader.jsx@@ -1,4 +1,5 @@import RouteTabsHeader from '../ui/RouteTabsHeader';+import { useInstanceFeatures } from '../../hooks/useInstanceFeatures.js';// Shared sub-nav for every page that lives under the sidebar's "Settings"// group. Settings.jsx hosts the in-Settings tabs (general/backup/etc.) and@@ -18,7 +19,7 @@ export const TABS = [{ id: 'features', label: 'Features', to: '/settings/features' },{ id: 'general', label: 'General', to: '/settings/general' },{ id: 'mortalloom', label: 'MortalLoom', to: '/settings/mortalloom' },- { id: 'openclaw', label: 'OpenClaw', to: '/openclaw' },+ { id: 'openclaw', label: 'OpenClaw', to: '/openclaw', feature: 'openclaw' },{ id: 'prompts', label: 'Prompts', to: '/prompts' },{ id: 'providers', label: 'Providers', to: '/ai' },{ id: 'security', label: 'Security', to: '/settings/security' },@@ -31,5 +32,7 @@ export const TABS = [];export default function SettingsTabsHeader({ activeTab }) {- return <RouteTabsHeader tabs={TABS} activeTab={activeTab} ariaLabel="Settings sections" />;+ const { isFeatureEnabled } = useInstanceFeatures();+ const visibleTabs = TABS.filter((tab) => isFeatureEnabled(tab.feature));+ return <RouteTabsHeader tabs={visibleTabs} activeTab={activeTab} ariaLabel="Settings sections" />;}diff --git a/client/src/hooks/useOpenClawStream.js b/client/src/hooks/useOpenClawStream.jsindex 7c988afce9..a16216d257 100644--- a/client/src/hooks/useOpenClawStream.js+++ b/client/src/hooks/useOpenClawStream.js@@ -18,7 +18,7 @@ function normalizeContent(content) {// the messagesError state and passes setMessagesError as onError.// onSendComplete is called after a successful send with { sessionId } so the component// can update session metadata (e.g. lastMessageAt) without the hook owning sessions state.-export function useOpenClawStream({ selectedSessionId, attachments, setAttachments, composer, setComposer, context, apps, sending, setSending, onError = () => {}, onSendComplete = () => {} } = {}) {+export function useOpenClawStream({ selectedSessionId, attachments, setAttachments, composer, setComposer, context, apps, sending, setSending, onError = () => {}, onSendComplete = () => {}, featureEnabled = true } = {}) {const [messages, setMessages] = useState([]);const [activityLabel, setActivityLabel] = useState('');const [messagesLoading, setMessagesLoading] = useState(false);@@ -46,8 +46,18 @@ export function useOpenClawStream({ selectedSessionId, attachments, setAttachmenuseEffect(() => () => abortControllerRef.current?.abort(), []);+ useEffect(() => {+ if (featureEnabled) return;+ abortControllerRef.current?.abort();+ loadingSessionRef.current = null;+ setMessages([]);+ setMessagesLoading(false);+ setActivityLabel('');+ setSending(false);+ }, [featureEnabled, setSending]);+const loadMessages = useCallback(async (sessionId) => {- if (!sessionId) {+ if (!featureEnabled || !sessionId) {loadingSessionRef.current = null;setMessages([]);setMessagesLoading(false);@@ -70,13 +80,13 @@ export function useOpenClawStream({ selectedSessionId, attachments, setAttachmen} finally {if (loadingSessionRef.current === sessionId) setMessagesLoading(false);}- }, [onError]);+ }, [featureEnabled, onError]);const handleSend = useCallback(async (event) => {event?.preventDefault();const message = composer.trim();- if ((!message && attachments.length === 0) || !selectedSessionId || sending) return;+ if (!featureEnabled || ((!message && attachments.length === 0) || !selectedSessionId || sending)) return;const userMessageId = `local-user-${Date.now()}`;const assistantMessageId = `local-assistant-${Date.now()}`;@@ -191,7 +201,7 @@ export function useOpenClawStream({ selectedSessionId, attachments, setAttachmensetSending(false);setActivityLabel('');}- }, [composer, attachments, selectedSessionId, sending, apps, context, setComposer, setAttachments, setSending, onError, onSendComplete]);+ }, [featureEnabled, composer, attachments, selectedSessionId, sending, apps, context, setComposer, setAttachments, setSending, onError, onSendComplete]);const handleStop = () => {abortControllerRef.current?.abort();diff --git a/client/src/hooks/useOpenClawStream.test.jsx b/client/src/hooks/useOpenClawStream.test.jsxindex 8d2bf85f46..8bbb0100b3 100644--- a/client/src/hooks/useOpenClawStream.test.jsx+++ b/client/src/hooks/useOpenClawStream.test.jsx@@ -30,7 +30,8 @@ function useHarness(overrides = {}) {sending,setSending,onError: overrides.onError ?? (() => {}),- onSendComplete: overrides.onSendComplete ?? (() => {})+ onSendComplete: overrides.onSendComplete ?? (() => {}),+ featureEnabled: overrides.featureEnabled ?? true,});return { ...stream, setSelectedSessionId, setComposer, composer, sending };@@ -42,6 +43,20 @@ beforeEach(() => {vi.clearAllMocks();});+describe('feature gate', () => {+ it('does not load or send messages while OpenClaw is disabled', async () => {+ const { result } = renderHook(() => useHarness({ featureEnabled: false }));++ await act(async () => {+ await result.current.loadMessages('session-1');+ await result.current.handleSend();+ });++ expect(getOpenClawMessages).not.toHaveBeenCalled();+ expect(streamOpenClawMessage).not.toHaveBeenCalled();+ });+});+// =============================================================================// loadMessages — stale-response guard (loadingSessionRef)// =============================================================================diff --git a/client/src/pages/OpenClaw.jsx b/client/src/pages/OpenClaw.jsxindex 5901a1a43e..7d86d207d9 100644--- a/client/src/pages/OpenClaw.jsx+++ b/client/src/pages/OpenClaw.jsx@@ -40,8 +40,16 @@ import { formatDateTime } from '../utils/formatters';import { useOpenClawAttachments, OPENCLAW_ATTACHMENT_ACCEPT } from '../hooks/useOpenClawAttachments';import { useOpenClawStream } from '../hooks/useOpenClawStream';import { modKey } from '../utils/platform';+import { useInstanceFeatures } from '../hooks/useInstanceFeatures.js';function getRuntimeState(status) {+ if (status?.enabled === false) {+ return {+ label: 'Disabled',+ classes: 'bg-gray-500/15 text-gray-300 border-gray-500/30'+ };+ }+if (!status?.configured) {return {label: 'Unconfigured',@@ -117,6 +125,9 @@ function partitionSessions(sessions = [], selectedSessionId = '', defaultSession}export default function OpenClaw() {+ const { features } = useInstanceFeatures();+ const featureEnabled = Array.isArray(features)+ && features.some((feature) => feature?.id === 'openclaw' && feature.enabled === true);const [status, setStatus] = useState(null);const [sessions, setSessions] = useState([]);const [apps, setApps] = useState([]);@@ -186,7 +197,8 @@ export default function OpenClaw() {sending,setSending,onError: setMessagesError,- onSendComplete: handleSendComplete+ onSendComplete: handleSendComplete,+ featureEnabled,});const runtimeState = useMemo(() => getRuntimeState(status), [status]);@@ -200,6 +212,23 @@ export default function OpenClaw() {setSessionsLoading(true);setPageError('');+ if (!featureEnabled) {+ setStatus({+ configured: false,+ enabled: false,+ reachable: false,+ label: 'OpenClaw Runtime',+ defaultSession: null,+ message: 'OpenClaw is disabled for this PortOS instance.'+ });+ setSessions([]);+ setSelectedSessionId('');+ loadMessages('');+ setStatusLoading(false);+ setSessionsLoading(false);+ return;+ }+try {const statusData = await api.getOpenClawStatus();setStatus(statusData);@@ -239,12 +268,16 @@ export default function OpenClaw() {setStatusLoading(false);setSessionsLoading(false);}- }, [loadMessages]);+ }, [featureEnabled, loadMessages]);useEffect(() => {loadRuntime();+ if (!featureEnabled) {+ setApps([]);+ return;+ }coreApi.getApps().then(data => setApps((data || []).filter(app => !app.archived))).catch(() => setApps([]));- }, [loadRuntime]);+ }, [featureEnabled, loadRuntime]);useEffect(() => {selectedSessionIdRef.current = selectedSessionId;@@ -377,6 +410,10 @@ export default function OpenClaw() {<RefreshCw size={14} className="animate-spin" />Loading sessions…</div>+ ) : status?.enabled === false ? (+ <div className="p-4 text-sm text-gray-400">+ Enable OpenClaw in Settings > Features to discover sessions.+ </div>) : !status?.configured ? (<div className="p-4 text-sm text-gray-400">Add local OpenClaw config to enable session discovery.@@ -485,6 +522,10 @@ export default function OpenClaw() {<RefreshCw size={16} className="animate-spin" />Loading messages…</div>+ ) : status?.enabled === false ? (+ <div className="flex h-full items-center justify-center rounded-xl border border-dashed border-port-border bg-port-bg/40 p-6 text-center text-sm text-gray-400">+ OpenClaw is disabled for this PortOS instance. Enable it in Settings > Features to use operator chat.+ </div>) : !status?.configured ? (<div className="flex h-full items-center justify-center rounded-xl border border-dashed border-port-border bg-port-bg/40 p-6 text-center text-sm text-gray-400">OpenClaw is not configured for this PortOS instance.@@ -604,7 +645,7 @@ export default function OpenClaw() {onPaste={handlePaste}onKeyDown={handleComposerKeyDown}rows={3}- placeholder={status?.configured ? 'Send a message, paste an image, or drop files here…' : 'OpenClaw is not configured'}+ placeholder={status?.enabled === false ? 'OpenClaw is disabled' : (status?.configured ? 'Send a message, paste an image, or drop files here…' : 'OpenClaw is not configured')}disabled={!status?.configured || !selectedSessionId || sending}className="w-full resize-none rounded-lg border border-port-border bg-port-bg px-3 py-3 text-sm text-white focus:border-port-accent focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-60"/>@@ -651,7 +692,7 @@ export default function OpenClaw() {<div className="mt-3 flex flex-wrap items-center justify-between gap-3"><div className="flex flex-wrap items-center gap-2 text-xs text-gray-500"><span>- {status?.configured && selectedSessionId ? `Stream via PortOS · ${modKey}+↵ to send` : 'Select a configured session to send.'}+ {status?.enabled === false ? 'Enable OpenClaw in Settings > Features to send messages.' : (status?.configured && selectedSessionId ? `Stream via PortOS · ${modKey}+↵ to send` : 'Select a configured session to send.')}</span><FilePickerButtonmultiplediff --git a/client/src/pages/Settings.tabs.test.jsx b/client/src/pages/Settings.tabs.test.jsxindex cb422b41fd..2691928685 100644--- a/client/src/pages/Settings.tabs.test.jsx+++ b/client/src/pages/Settings.tabs.test.jsx@@ -1,12 +1,12 @@import { describe, expect, it, vi } from 'vitest';-import { render, screen } from '@testing-library/react';+import { act, render, screen } from '@testing-library/react';import { MemoryRouter, Route, Routes } from 'react-router';import { TABS } from '../components/settings/SettingsTabsHeader';// Same stub as Settings.redirects.test.jsx — Settings.jsx imports every tab// component, and those pull in the API client at import time.-vi.mock('../services/api', () => new Proxy({}, {- get: (_target, key) => (key === 'then' || key === '__esModule' ? undefined : vi.fn().mockResolvedValue({})),+vi.mock('../services/api', () => ({+ getInstanceFeatures: vi.fn().mockResolvedValue({ features: [] }),}));// The two tabs this test distinguishes between. A slug with no `case` in@@ -38,8 +38,9 @@ describe('Settings — Code Reviewers tab', () => {expect(tab?.to).toBe('/settings/code-reviewers');});- it('routes /settings/code-reviewers to the Code Reviewers panel', () => {+ it('routes /settings/code-reviewers to the Code Reviewers panel', async () => {renderTab('/settings/code-reviewers');+ await act(async () => {});expect(screen.getByTestId('code-reviewers-tab')).toBeTruthy();expect(screen.queryByTestId('general-tab')).toBeNull();});@@ -51,8 +52,9 @@ describe('Settings — Instance Features tab', () => {expect(tab?.to).toBe('/settings/features');});- it('routes /settings/features to the feature participation panel', () => {+ it('routes /settings/features to the feature participation panel', async () => {renderTab('/settings/features');+ await act(async () => {});expect(screen.getByTestId('instance-features-tab')).toBeTruthy();expect(screen.queryByTestId('general-tab')).toBeNull();});diff --git a/client/src/pages/Shell.jsx b/client/src/pages/Shell.jsxindex baa8c058b0..ed43ca7105 100644--- a/client/src/pages/Shell.jsx+++ b/client/src/pages/Shell.jsx@@ -9,6 +9,7 @@ import TerminalHotKeys from '../components/shell/TerminalHotKeys';import ShellSessionTabs from '../components/shell/ShellSessionTabs';import ShellProviderLauncher from '../components/shell/ShellProviderLauncher';import InfoTooltip from '../components/ui/InfoTooltip';+import { useInstanceFeatures } from '../hooks/useInstanceFeatures.js';// Typed-into-the-current-session shortcuts only. The AI CLIs that used to sit// here as hardcoded buttons (claude / codex / agy / grok) now come from the@@ -28,6 +29,7 @@ const QUICK_COMMANDS = [];export default function Shell() {+ const { isFeatureEnabled } = useInstanceFeatures();// Fullscreen promotes the terminal to a fixed overlay above the sidebar, hiding// the stacked toolbars so the TUI gets the whole viewport — the key mobile win// where the header/tabs/quick-commands otherwise eat most of the screen.@@ -248,7 +250,7 @@ export default function Shell() {onOpen={loadProviders}onLaunch={launchProvider}/>- {QUICK_COMMANDS.map(({ label, command }) => (+ {QUICK_COMMANDS.filter(({ label }) => label !== 'openclaw' || isFeatureEnabled('openclaw')).map(({ label, command }) => (<buttonkey={label}onClick={() => sendCommand(command)}diff --git a/docs/features/openclaw-operator-chat.md b/docs/features/openclaw-operator-chat.mdindex 6402418abb..edb20c0326 100644--- a/docs/features/openclaw-operator-chat.md+++ b/docs/features/openclaw-operator-chat.md@@ -11,8 +11,8 @@ PortOS is reachable over Tailscale and is intended to be a secure, self-hosted oPortOS is a public open-source project used by many people, so this feature is:- **Generic** — no assistant identity, persona, or relationship model is baked into product code.-- **Optional** — PortOS works cleanly without OpenClaw; the page degrades gracefully when unconfigured.-- **Instance-configurable** — identity, endpoints, tokens, and machine topology live in local, git-ignored config (`data/openclaw/config.json`) or environment variables, never in committed defaults.+- **Optional and instance-configurable** — PortOS works cleanly without OpenClaw; enable or disable the feature for this install in **Settings > Features**. When disabled, PortOS hides its browse and launch affordances and refuses runtime requests, even if an OpenClaw config or environment variables are present.+- **Instance-local configuration** — identity, endpoints, tokens, and machine topology live in git-ignored config (`data/openclaw/config.json`) or environment variables, never in committed defaults.## Architecturediff --git a/server/integrations/openclaw/api.js b/server/integrations/openclaw/api.jsindex e2f6eafe05..1b8abc850d 100644--- a/server/integrations/openclaw/api.js+++ b/server/integrations/openclaw/api.js@@ -2,6 +2,7 @@ import { join } from 'path';import { readJSONFile, PATHS } from '../../lib/fileUtils.js';import { fetchWithTimeout } from '../../lib/fetchWithTimeout.js';import { ServerError } from '../../lib/errorHandler.js';+import { isInstanceFeatureEnabled } from '../../services/instanceFeatures.js';const CONFIG_FILE = join(PATHS.data, 'openclaw', 'config.json');const DEFAULT_TIMEOUT_MS = 15000;@@ -121,9 +122,10 @@ async function loadConfig() {const fileConfig = await readJSONFile(CONFIG_FILE, {}, { logError: false });const envEnabled = parseBoolean(process.env.OPENCLAW_ENABLED);const enabled = pickFirst(envEnabled, fileConfig.enabled, true);+ const featureEnabled = await isInstanceFeatureEnabled('openclaw');const baseUrlRaw = pickFirst(process.env.OPENCLAW_BASE_URL, fileConfig.baseUrl, '');let finalBaseUrl = typeof baseUrlRaw === 'string' ? baseUrlRaw.trim() : '';- let configured = enabled !== false && Boolean(finalBaseUrl);+ let configured = featureEnabled && enabled !== false && Boolean(finalBaseUrl);if (configured && finalBaseUrl) {try {@@ -141,7 +143,8 @@ async function loadConfig() {}return {- enabled,+ enabled: featureEnabled && enabled !== false,+ featureEnabled,configured,baseUrl: finalBaseUrl,authToken: pickFirst(process.env.OPENCLAW_AUTH_TOKEN, fileConfig.authToken, ''),@@ -356,7 +359,12 @@ export async function isConfigured() {export async function getRuntimeStatus() {const config = await loadConfig();if (!config.configured) {- return normalizeStatusPayload(null, config, false, 'OpenClaw is not configured');+ return normalizeStatusPayload(+ null,+ config,+ false,+ config.featureEnabled ? 'OpenClaw is not configured' : 'OpenClaw is disabled for this PortOS instance'+ );}try {diff --git a/server/integrations/openclaw/api.test.js b/server/integrations/openclaw/api.test.jsindex f7f71ca3dd..350ca6fd4a 100644--- a/server/integrations/openclaw/api.test.js+++ b/server/integrations/openclaw/api.test.js@@ -9,8 +9,13 @@ vi.mock('../../lib/fetchWithTimeout.js', () => ({fetchWithTimeout: vi.fn()}));+vi.mock('../../services/instanceFeatures.js', () => ({+ isInstanceFeatureEnabled: vi.fn()+}));+import { readJSONFile } from '../../lib/fileUtils.js';import { fetchWithTimeout } from '../../lib/fetchWithTimeout.js';+import { isInstanceFeatureEnabled } from '../../services/instanceFeatures.js';import { getRuntimeStatus } from './api.js';const OPENCLAW_ENV_KEYS = Object.keys(process.env).filter(key => key.startsWith('OPENCLAW_'));@@ -28,6 +33,7 @@ describe('openclaw getRuntimeStatus', () => {beforeEach(() => {vi.clearAllMocks();+ isInstanceFeatureEnabled.mockResolvedValue(true);for (const key of OPENCLAW_ENV_KEYS) {savedEnv[key] = process.env[key];delete process.env[key];@@ -77,4 +83,18 @@ describe('openclaw getRuntimeStatus', () => {expect(status.runtime).toBeNull();expect(fetchWithTimeout).not.toHaveBeenCalled();});++ it('does not configure or probe the runtime when the PortOS feature is disabled', async () => {+ isInstanceFeatureEnabled.mockResolvedValue(false);++ const status = await getRuntimeStatus();++ expect(status).toMatchObject({+ configured: false,+ enabled: false,+ reachable: false,+ message: 'OpenClaw is disabled for this PortOS instance'+ });+ expect(fetchWithTimeout).not.toHaveBeenCalled();+ });});diff --git a/server/lib/instanceFeatureRegistry.js b/server/lib/instanceFeatureRegistry.jsindex 5c82ddc0fe..196251417c 100644--- a/server/lib/instanceFeatureRegistry.js+++ b/server/lib/instanceFeatureRegistry.js@@ -42,6 +42,14 @@ export const INSTANCE_FEATURES = Object.freeze([description: 'Get Stuff Done project planning and progress tracking for managed apps.',defaultEnabled: true,}),+ Object.freeze({+ id: 'openclaw',+ label: 'OpenClaw',+ description: 'Operator chat with a configured OpenClaw runtime.',+ // Preserve the existing behavior for installs that already configured+ // OpenClaw; an explicit Settings > Features toggle remains authoritative.+ defaultEnabled: true,+ }),]);export const INSTANCE_FEATURE_IDS = Object.freeze(INSTANCE_FEATURES.map((feature) => feature.id));diff --git a/server/lib/navManifest.js b/server/lib/navManifest.jsindex d7e5b266ae..8b22cc8ab9 100644--- a/server/lib/navManifest.js+++ b/server/lib/navManifest.js@@ -315,7 +315,7 @@ const RAW_NAV_COMMANDS = [{ id: 'nav.models.status', path: '/models/status', label: 'Status', section: 'Models', previousPaths: ['/system-resources/models'], aliases: ['model-status', 'models-status', 'memory-management', 'resident-models', 'model-resources', 'loaded-models', 'downloaded-models', 'model-memory'], keywords: ['memory', 'resident', 'loaded', 'unload', 'ram', 'vram', 'free memory', 'what is loaded', 'ollama', 'lm studio', 'hugging face', 'lora', 'delete model', 'disk'] },{ id: 'nav.settings.local-llm-playground', path: '/local-llm/playground', label: 'Playground', section: 'Models', aliases: ['llm-playground', 'playground', 'model-playground', 'compare-models'], keywords: ['ollama', 'lm studio', 'compare', 'benchmark', 'chat', 'test model', 'ttft', 'tokens per second', 'local llm'] },{ id: 'nav.settings.mortalloom', path: '/settings/mortalloom', label: 'MortalLoom', section: 'Settings', aliases: ['settings-mortalloom', 'mortalloom'] },- { id: 'nav.settings.openclaw', path: '/openclaw', label: 'OpenClaw', section: 'Settings', aliases: ['openclaw', 'settings-openclaw'], keywords: ['operator', 'chat', 'agent', 'runtime', 'sessions', 'streaming'] },+ { id: 'nav.settings.openclaw', path: '/openclaw', label: 'OpenClaw', section: 'Settings', feature: 'openclaw', aliases: ['openclaw', 'settings-openclaw'], keywords: ['operator', 'chat', 'agent', 'runtime', 'sessions', 'streaming'] },{ id: 'nav.settings.security', path: '/settings/security', label: 'Security', section: 'Settings', aliases: ['settings-security', 'login-password', 'auth-password', 'password-settings'], keywords: ['password', 'login', 'auth', 'sign-in', 'lock', 'tailnet', 'sidecar'] },{ id: 'nav.settings.sharing', path: '/settings/sharing', label: 'Sharing', section: 'Settings', aliases: ['settings-sharing', 'sharing-settings'], keywords: ['display name', 'bio', 'attribution', 'identity', 'source'] },{ id: 'nav.settings.signal', path: '/settings/signal', label: 'Signal', section: 'Settings', aliases: ['settings-signal', 'signal', 'signal-settings'], keywords: ['signal', 'signal desktop', 'messages', 'sqlcipher', 'chat', 'tribe', 'timeline', 'encrypted', 'keychain'] },diff --git a/server/routes/settings.test.js b/server/routes/settings.test.jsindex aba7345f94..5331591503 100644--- a/server/routes/settings.test.js+++ b/server/routes/settings.test.js@@ -110,6 +110,7 @@ describe('Settings routes — instance feature participation', () => {// GSD remains enabled by default so existing app planning tabs stay// available unless the install explicitly opts out.expect(res.body.features).toContainEqual(expect.objectContaining({ id: 'gsd', enabled: true }));+ expect(res.body.features).toContainEqual(expect.objectContaining({ id: 'openclaw', enabled: true }));});it('updates one feature without replacing unrelated settings', async () => {