Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(remote): restore messaging settings projection

Maxb1ca7aa76372
diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.py
index 8d1c57e5f..63f711551 100644
--- a/tests/test_ui_remote_access_auth.py
+++ b/tests/test_ui_remote_access_auth.py
@@ -2800,6 +2800,13 @@ def test_remote_instance_role_route_matrix(
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
config = _save_config(tmp_path)
+ config.ack_mode = "reaction"
+ config.show_duration = False
+ config.include_time_info = False
+ config.include_user_info = True
+ config.reply_enhancements = False
+ config.agent_progress_style = "concise"
+ config.save()
ensure_sqlite_state()
client = app.test_client()
client.set_cookie(
@@ -2848,14 +2855,27 @@ def test_remote_instance_role_route_matrix(
assert prefs_write_response.status_code == 403
# Role grants an authorized remote operation, not trusted-local visibility.
# All remote callers receive the same explicit safe config projection.
- assert set(config_response.get_json()) == {
+ config_payload = config_response.get_json()
+ assert set(config_payload) == {
+ "ack_mode",
+ "agent_progress_style",
"capabilities",
+ "include_time_info",
+ "include_user_info",
"language",
"mode",
+ "reply_enhancements",
"setup_state",
+ "show_duration",
"ui",
"version",
}
+ assert config_payload["ack_mode"] == "reaction"
+ assert config_payload["show_duration"] is False
+ assert config_payload["include_time_info"] is False
+ assert config_payload["include_user_info"] is True
+ assert config_payload["reply_enhancements"] is False
+ assert config_payload["agent_progress_style"] == "concise"
assert conversation_response.status_code == conversation_status
assert project_response.status_code == project_status
if role == "viewer":
diff --git a/ui/src/components/settings/SettingsMessagingPage.test.tsx b/ui/src/components/settings/SettingsMessagingPage.test.tsx
new file mode 100644
index 000000000..0e89d4934
--- /dev/null
+++ b/ui/src/components/settings/SettingsMessagingPage.test.tsx
@@ -0,0 +1,107 @@
+/* @vitest-environment jsdom */
+
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { cleanup, render, screen } from '@testing-library/react';
+import { MemoryRouter } from 'react-router-dom';
+
+import { SettingsMessagingPage } from './SettingsMessagingPage';
+import {
+ InstanceAuthorizationContext,
+ type InstanceAuthorizationValue,
+} from '../../context/InstanceAuthorizationContext';
+import { OWNER_INSTANCE_CAPABILITIES } from '../../lib/sessionInfo';
+
+const api = vi.hoisted(() => ({
+ getConfig: vi.fn(),
+ saveConfig: vi.fn(),
+}));
+
+const translate = vi.hoisted(() => (key: string) => key);
+
+vi.mock('../../context/ApiContext', async (loadOriginal) => {
+ const original = await loadOriginal<typeof import('../../context/ApiContext')>();
+ return { ...original, useApi: () => api };
+});
+
+vi.mock('react-i18next', () => ({
+ useTranslation: () => ({ t: translate }),
+}));
+
+vi.mock('./SettingsPageShell', () => ({
+ SettingsPageShell: ({ children }: { children: React.ReactNode }) => children,
+}));
+
+const baseConfig = {
+ platforms: { enabled: ['slack'] },
+ ack_mode: 'typing',
+ show_duration: true,
+ include_time_info: true,
+ include_user_info: false,
+ reply_enhancements: true,
+ show_pages_prompt: true,
+ agent_progress_style: 'off',
+ ui: { chat_message_font_size: 14, show_agent_activity: false, show_tool_calls: true },
+ slack: { disable_link_unfurl: false },
+ agents: {
+ opencode: {
+ error_retry_limit: 2,
+ active_turn_timeout_seconds: 5400,
+ },
+ },
+};
+
+const localOwner: InstanceAuthorizationValue = {
+ remote: false,
+ instanceRole: 'owner',
+ capabilities: OWNER_INSTANCE_CAPABILITIES,
+};
+
+const remoteOwner: InstanceAuthorizationValue = {
+ remote: true,
+ instanceRole: 'owner',
+ capabilities: {
+ ...OWNER_INSTANCE_CAPABILITIES,
+ can_use_system: false,
+ },
+};
+
+function renderPage(context: InstanceAuthorizationValue) {
+ return render(
+ <InstanceAuthorizationContext.Provider value={context}>
+ <MemoryRouter>
+ <SettingsMessagingPage />
+ </MemoryRouter>
+ </InstanceAuthorizationContext.Provider>,
+ );
+}
+
+describe('SettingsMessagingPage locality gating', () => {
+ beforeEach(() => {
+ api.getConfig.mockResolvedValue(baseConfig);
+ api.saveConfig.mockResolvedValue(baseConfig);
+ });
+
+ afterEach(() => {
+ cleanup();
+ vi.clearAllMocks();
+ });
+
+ it('keeps remote-safe messaging preferences visible to a remote owner', async () => {
+ renderPage(remoteOwner);
+
+ expect(await screen.findByText('dashboard.ackMode')).toBeTruthy();
+ expect(screen.getByText('dashboard.showDuration')).toBeTruthy();
+ expect(screen.getByText('dashboard.replyEnhancements')).toBeTruthy();
+ expect(screen.queryByText('dashboard.errorRetryLimit')).toBeNull();
+ expect(screen.queryByText('dashboard.opencodeActiveTurnTimeout')).toBeNull();
+ expect(screen.queryByText('dashboard.showPagesPrompt')).toBeNull();
+ });
+
+ it('shows the protected messaging controls to a trusted-local owner', async () => {
+ renderPage(localOwner);
+
+ expect(await screen.findByText('dashboard.errorRetryLimit')).toBeTruthy();
+ expect(screen.getByText('dashboard.opencodeActiveTurnTimeout')).toBeTruthy();
+ expect(screen.getByText('dashboard.showPagesPrompt')).toBeTruthy();
+ });
+});
diff --git a/ui/src/components/settings/SettingsMessagingPage.tsx b/ui/src/components/settings/SettingsMessagingPage.tsx
index a95532896..d6c669ff7 100644
--- a/ui/src/components/settings/SettingsMessagingPage.tsx
+++ b/ui/src/components/settings/SettingsMessagingPage.tsx
@@ -5,7 +5,9 @@ import { useTranslation } from 'react-i18next';
import clsx from 'clsx';
import { useApi } from '@/context/ApiContext';
+import { useInstanceAuthorization } from '@/context/InstanceAuthorizationContext';
import { SettingsPageShell } from './SettingsPageShell';
+import { isLocalOnlyMessagingField } from '@/lib/adminNavigation';
import {
platformHasCapability,
getEnabledPlatforms,
@@ -69,6 +71,8 @@ function formatSavedAt(value: number | null, t: (key: string) => string) {
export const SettingsMessagingPage: React.FC = () => {
const { t } = useTranslation();
const api = useApi();
+ const { capabilities } = useInstanceAuthorization();
+ const canUseSystem = capabilities.can_use_system;
const [config, setConfig] = useState<any>(null);
const [saveError, setSaveError] = useState<string | null>(null);
const [savedAt, setSavedAt] = useState<number | null>(null);
@@ -125,6 +129,8 @@ export const SettingsMessagingPage: React.FC = () => {
{ value: 'concise', label: t('dashboard.agentProgressStyleConcise') },
{ value: 'verbose', label: t('dashboard.agentProgressStyleVerbose') },
];
+ const canShowProtectedMessagingControl = (field: string) =>
+ canUseSystem || !isLocalOnlyMessagingField(field);
const includeTimeInfoEnabled = config.include_time_info !== false;
const audioAsr = config.audio_asr || {};
const audioEchoEnabled = audioAsr.echo_transcript !== false;
@@ -355,64 +361,68 @@ export const SettingsMessagingPage: React.FC = () => {
}
/>
- <SettingsRow
- title={t('dashboard.errorRetryLimit')}
- description={t('dashboard.errorRetryLimitHint')}
- control={
- <CompactField
- type="number"
- min={0}
- max={10}
- value={config.agents?.opencode?.error_retry_limit ?? 1}
- onChange={(event) => {
- const limit = Math.max(0, Math.min(10, Number(event.target.value) || 0));
- void persist({
- ...config,
- agents: {
- ...(config.agents || {}),
- opencode: {
- ...(config.agents?.opencode || {}),
- error_retry_limit: limit,
- },
- },
- });
- }}
- className="w-24 text-center font-mono"
+ {canShowProtectedMessagingControl('agents.opencode.error_retry_limit') && (
+ <>
+ <SettingsRow
+ title={t('dashboard.errorRetryLimit')}
+ description={t('dashboard.errorRetryLimitHint')}
+ control={
+ <CompactField
+ type="number"
+ min={0}
+ max={10}
+ value={config.agents?.opencode?.error_retry_limit ?? 1}
+ onChange={(event) => {
+ const limit = Math.max(0, Math.min(10, Number(event.target.value) || 0));
+ void persist({
+ ...config,
+ agents: {
+ ...(config.agents || {}),
+ opencode: {
+ ...(config.agents?.opencode || {}),
+ error_retry_limit: limit,
+ },
+ },
+ });
+ }}
+ className="w-24 text-center font-mono"
+ />
+ }
/>
- }
- />
- <SettingsRow
- title={t('dashboard.opencodeActiveTurnTimeout')}
- description={t('dashboard.opencodeActiveTurnTimeoutHint')}
- control={
- <CompactField
- type="number"
- min={1}
- max={1440}
- value={Math.round(
- (config.agents?.opencode?.active_turn_timeout_seconds ?? 5400) / 60
- )}
- onChange={(event) => {
- const minutes = Math.max(
- 1,
- Math.min(1440, Number(event.target.value) || 1)
- );
- void persist({
- ...config,
- agents: {
- ...(config.agents || {}),
- opencode: {
- ...(config.agents?.opencode || {}),
- active_turn_timeout_seconds: Math.round(minutes * 60),
- },
- },
- });
- }}
- className="w-24 text-center font-mono"
+ <SettingsRow
+ title={t('dashboard.opencodeActiveTurnTimeout')}
+ description={t('dashboard.opencodeActiveTurnTimeoutHint')}
+ control={
+ <CompactField
+ type="number"
+ min={1}
+ max={1440}
+ value={Math.round(
+ (config.agents?.opencode?.active_turn_timeout_seconds ?? 5400) / 60
+ )}
+ onChange={(event) => {
+ const minutes = Math.max(
+ 1,
+ Math.min(1440, Number(event.target.value) || 1)
+ );
+ void persist({
+ ...config,
+ agents: {
+ ...(config.agents || {}),
+ opencode: {
+ ...(config.agents?.opencode || {}),
+ active_turn_timeout_seconds: Math.round(minutes * 60),
+ },
+ },
+ });
+ }}
+ className="w-24 text-center font-mono"
+ />
+ }
/>
- }
- />
+ </>
+ )}
<SettingsRow
title={t('dashboard.showDuration')}
@@ -447,21 +457,23 @@ export const SettingsMessagingPage: React.FC = () => {
/>
}
/>
- <SettingsRow
- title={t('dashboard.showPagesPrompt')}
- description={t('dashboard.showPagesPromptHint')}
- control={
- <ToggleSwitch
- enabled={config.show_pages_prompt !== false}
- onClick={() =>
- void persist({
- ...config,
- show_pages_prompt: !(config.show_pages_prompt !== false),
- })
- }
- />
- }
- />
+ {canShowProtectedMessagingControl('show_pages_prompt') && (
+ <SettingsRow
+ title={t('dashboard.showPagesPrompt')}
+ description={t('dashboard.showPagesPromptHint')}
+ control={
+ <ToggleSwitch
+ enabled={config.show_pages_prompt !== false}
+ onClick={() =>
+ void persist({
+ ...config,
+ show_pages_prompt: !(config.show_pages_prompt !== false),
+ })
+ }
+ />
+ }
+ />
+ )}
{slackSupportsLinkUnfurl && (
<SettingsRow
title={t('dashboard.slackLinkPreviews')}
diff --git a/ui/src/lib/adminNavigation.test.ts b/ui/src/lib/adminNavigation.test.ts
index edbb59b61..f4412852f 100644
--- a/ui/src/lib/adminNavigation.test.ts
+++ b/ui/src/lib/adminNavigation.test.ts
@@ -3,6 +3,7 @@ import { describe, expect, it } from 'vitest';
import {
adminLandingPath,
isAdvancedSettingsPath,
+ isLocalOnlyMessagingField,
isLocalSystemPath,
isMemorySettingsPath,
} from './adminNavigation';
@@ -36,10 +37,15 @@ describe('isLocalSystemPath', () => {
it('covers every destination whose page runs entirely on local-only routes', () => {
expect(isLocalSystemPath('/admin/dashboard')).toBe(true);
expect(isLocalSystemPath('/admin/remote-access')).toBe(true);
+ expect(isLocalSystemPath('/admin/users')).toBe(true);
+ expect(isLocalSystemPath('/admin/logs')).toBe(true);
expect(isLocalSystemPath('/admin/settings/service')).toBe(true);
expect(isLocalSystemPath('/admin/settings/platforms')).toBe(true);
expect(isLocalSystemPath('/admin/settings/backends')).toBe(true);
expect(isLocalSystemPath('/admin/settings/models')).toBe(true);
+ expect(isLocalSystemPath('/admin/settings/dependencies')).toBe(true);
+ expect(isLocalSystemPath('/admin/settings/diagnostics')).toBe(true);
+ expect(isLocalSystemPath('/admin/settings/logs')).toBe(true);
expect(isLocalSystemPath('/harness')).toBe(true);
expect(isLocalSystemPath('/apps/library')).toBe(true);
});
@@ -74,6 +80,20 @@ describe('adminLandingPath', () => {
});
});
+describe('isLocalOnlyMessagingField', () => {
+ it('marks only the protected messaging controls as trusted-local', () => {
+ expect(isLocalOnlyMessagingField('agents.opencode.error_retry_limit')).toBe(true);
+ expect(isLocalOnlyMessagingField('agents.opencode.active_turn_timeout_seconds')).toBe(true);
+ expect(isLocalOnlyMessagingField('show_pages_prompt')).toBe(true);
+ });
+
+ it('leaves remote-safe messaging preferences available remotely', () => {
+ expect(isLocalOnlyMessagingField('ack_mode')).toBe(false);
+ expect(isLocalOnlyMessagingField('show_duration')).toBe(false);
+ expect(isLocalOnlyMessagingField('reply_enhancements')).toBe(false);
+ });
+});
+
describe('isMemorySettingsPath', () => {
it('matches the Memory route and nested path boundaries', () => {
expect(isMemorySettingsPath('/admin/settings/memory')).toBe(true);
diff --git a/ui/src/lib/adminNavigation.ts b/ui/src/lib/adminNavigation.ts
index b216ca0d7..116dd2712 100644
--- a/ui/src/lib/adminNavigation.ts
+++ b/ui/src/lib/adminNavigation.ts
@@ -11,32 +11,48 @@ export const isMemorySettingsPath = (pathname: string): boolean =>
* `/api/doctor`, `/api/logs`, `/api/settings`, `/api/users` and drives
* `/api/control`; Remote Access drives pair / start / stop / optimize / settings
* / diagnose (only its status read is remote-permitted); the service, platform,
- * backend, and Model Hub settings pages save or reorder protected local state;
- * Harness opens on `/api/harness/bootstrap`; and the Library's Show Page
- * controls are local-only. They therefore need the trusted-local
- * `can_use_system` capability on top, otherwise a remote owner gets partial or
- * empty state and every mutation ends in `remote_execution_disabled`.
+ * backend, Model Hub, dependency, diagnostics, logs and users pages save or
+ * reveal protected local state; Harness opens on `/api/harness/bootstrap`; and
+ * the Library's Show Page controls are local-only. They therefore need the
+ * trusted-local `can_use_system` capability on top, otherwise a remote owner
+ * gets partial or empty state and every mutation ends in
+ * `remote_execution_disabled`.
*
* This is the single source of truth for both halves of the gate — the route
* redirect and the navigation entries that point at it — so a withheld page can
* never still be advertised in the sidebar, mobile tabs or the More sheet.
- * Messaging settings are deliberately absent: the payload filter restricts their
- * saves to remotely-mutable preference fields, so they work remotely.
+ * Messaging settings are deliberately absent: the payload filter restricts most
+ * of that page to remotely-mutable preference fields, and the remaining
+ * protected controls are gated by `isLocalOnlyMessagingField` below.
*/
-const LOCAL_SYSTEM_ROUTES = [
+export const LOCAL_SYSTEM_ROUTES = [
'/admin/dashboard',
'/admin/remote-access',
+ '/admin/users',
+ '/admin/logs',
'/admin/settings/service',
'/admin/settings/platforms',
'/admin/settings/backends',
'/admin/settings/models',
+ '/admin/settings/dependencies',
+ '/admin/settings/diagnostics',
+ '/admin/settings/logs',
'/harness',
'/apps/library',
-];
+] as const;
+
+const LOCAL_ONLY_MESSAGING_FIELDS = new Set([
+ 'agents.opencode.error_retry_limit',
+ 'agents.opencode.active_turn_timeout_seconds',
+ 'show_pages_prompt',
+]);
export const isLocalSystemPath = (pathname: string): boolean =>
LOCAL_SYSTEM_ROUTES.some((route) => matchesRoute(pathname, route));
+export const isLocalOnlyMessagingField = (field: string): boolean =>
+ LOCAL_ONLY_MESSAGING_FIELDS.has(field);
+
/**
* Where the "Control Panel" entry points. A remote owner cannot open the
* Dashboard, so send them to the first admin page they can actually use rather
diff --git a/vibe/api.py b/vibe/api.py
index 9b386f4ab..1a2896ce8 100644
--- a/vibe/api.py
+++ b/vibe/api.py
@@ -1257,6 +1257,12 @@ def remote_config_payload(config: V2Config) -> dict:
"version": payload.get("version"),
"setup_state": payload.get("setup_state"),
"language": payload.get("language"),
+ "ack_mode": payload.get("ack_mode"),
+ "show_duration": payload.get("show_duration"),
+ "include_time_info": payload.get("include_time_info"),
+ "include_user_info": payload.get("include_user_info"),
+ "reply_enhancements": payload.get("reply_enhancements"),
+ "agent_progress_style": payload.get("agent_progress_style"),
"ui": {
key: ui_payload[key]
for key in _REMOTE_CONFIG_UI_FIELDS