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(pr1162): close review 4902210423

Maxed4cf8e3546c
diff --git a/core/memory/migrations/0001_initial.sql b/core/memory/migrations/0001_initial.sql
index fd01395a3..e98788961 100644
--- a/core/memory/migrations/0001_initial.sql
+++ b/core/memory/migrations/0001_initial.sql
@@ -37,6 +37,11 @@ CREATE TABLE IF NOT EXISTS memory_capture_queue (
AND substr(principal_id, 1, 2) = 'u-'
AND substr(principal_id, 3) NOT GLOB '*[^0-9a-f]*'
),
+ project_ref TEXT NOT NULL CHECK (
+ length(project_ref) = 34
+ AND substr(project_ref, 1, 2) = 'p-'
+ AND substr(project_ref, 3) NOT GLOB '*[^0-9a-f]*'
+ ),
provenance TEXT NOT NULL CHECK (provenance IN ('user_input', 'agent')),
payload_text TEXT,
payload_attachments TEXT,
diff --git a/tests/test_memory_store.py b/tests/test_memory_store.py
index a6ea0ed90..6fdc8f3eb 100644
--- a/tests/test_memory_store.py
+++ b/tests/test_memory_store.py
@@ -125,6 +125,33 @@ def test_store_creates_exact_memory_tables_and_due_index(tmp_path: Path) -> None
)
+def test_initial_memory_migration_supports_enqueue_request(tmp_path: Path) -> None:
+ database = _store_path(tmp_path, "memory-migrated.sqlite")
+ database.parent.mkdir(parents=True, exist_ok=True)
+ migration = Path(__file__).resolve().parents[1] / "core/memory/migrations/0001_initial.sql"
+ with sqlite3.connect(database) as conn:
+ conn.executescript(migration.read_text(encoding="utf-8"))
+
+ store = MemoryStore(database)
+ result = store.enqueue_request(
+ source_message_id="fresh-migration",
+ session_id="session",
+ principal_id="u-11111111111111111111111111111111",
+ project_ref=PROJECT,
+ provenance="user_input",
+ payload_text="queued payload",
+ occurred_at_ms=1_000,
+ max_provider_timestamp_ms=4_102_444_800_000,
+ )
+
+ assert result.outcome == "accepted"
+ assert result.row is not None
+ assert result.row.project_ref == PROJECT
+ with sqlite3.connect(store.path) as conn:
+ queue_columns = {row[1] for row in conn.execute("PRAGMA table_info('memory_capture_queue')")}
+ assert "project_ref" in queue_columns
+
+
def test_principal_derivation_is_stable_opaque_and_user_scoped() -> None:
scope_key = bytes.fromhex("11" * 32)
diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.py
index 68e47734a..94d5d1bb6 100644
--- a/tests/test_ui_remote_access_auth.py
+++ b/tests/test_ui_remote_access_auth.py
@@ -1537,6 +1537,16 @@ def test_remote_config_allows_only_explicit_preferences_and_unchanged_round_trip
"/api/config",
{"language": "zh", "ui": {"instance_name": "Remote label"}},
)
+ assert not ui_server._is_remote_local_execution_request(
+ "POST",
+ "/api/config",
+ {"agent_progress_style": "concise"},
+ )
+ assert ui_server._is_remote_local_execution_request(
+ "POST",
+ "/api/config",
+ {"agent_progress_style": "concise", "agent_status_heartbeat_ms": 1},
+ )
assert not ui_server._is_remote_local_execution_request(
"POST",
"/api/config",
@@ -1563,6 +1573,7 @@ def test_remote_config_strips_protected_round_trip_fields_before_persistence(
)
payload = json.loads(json.dumps(api.config_to_payload(config)))
payload["language"] = "zh"
+ payload["agent_progress_style"] = "concise"
observed = []
def save_config(remote_payload):
@@ -1582,6 +1593,8 @@ def test_remote_config_strips_protected_round_trip_fields_before_persistence(
assert response.status_code == 200
assert len(observed) == 1
assert observed[0]["language"] == "zh"
+ assert observed[0]["agent_progress_style"] == "concise"
+ assert "agent_status_heartbeat_ms" not in observed[0]
assert observed[0]["ui"] == {
field: payload["ui"][field]
for field in ui_server._REMOTE_UI_CONFIG_MUTABLE_FIELDS
diff --git a/ui/src/components/AppShell.tsx b/ui/src/components/AppShell.tsx
index 0d99fa2b1..06099e231 100644
--- a/ui/src/components/AppShell.tsx
+++ b/ui/src/components/AppShell.tsx
@@ -35,6 +35,7 @@ import { useViewportHeightVar } from '../lib/useViewportHeightVar';
import { OrganizationShell } from '../features/organization/OrganizationShell';
import {
adminLandingPath,
+ filterLocalSystemNavItems,
isAdvancedSettingsPath,
isLocalSystemPath,
isMemorySettingsPath,
@@ -465,18 +466,10 @@ export const AppShell: React.FC = () => {
// Second half of the trusted-local gate: a page the redirect above withholds
// must not still be advertised, or a remote owner taps a nav entry and lands
- // back on the Workbench. Recurses into groups (平台凭据 is a child) and drops a
- // group left with nothing to open.
- const withoutLocalSystemEntries = (navItems: ShellNavItem[]): ShellNavItem[] =>
- navItems
- .filter((item) => !item.to || !isLocalSystemPath(item.to))
- .map((item) =>
- item.children ? { ...item, children: withoutLocalSystemEntries(item.children) } : item,
- )
- .filter((item) => item.to || item.onClick || (item.children?.length ?? 0) > 0);
+ // back on the Workbench.
const visibleAdminItems = capabilities.can_use_system
? adminItems
- : withoutLocalSystemEntries(adminItems);
+ : filterLocalSystemNavItems(adminItems);
const items: ShellNavItem[] = shellMode === 'admin' ? visibleAdminItems : [];
@@ -500,7 +493,7 @@ export const AppShell: React.FC = () => {
];
const adminMobileTabs = capabilities.can_use_system
? adminMobileTabsAll
- : withoutLocalSystemEntries(adminMobileTabsAll);
+ : filterLocalSystemNavItems(adminMobileTabsAll);
// The More sheet shows the overflow: admin sections not already on the bottom
// bar. Keep its filtering aligned with the currently visible primary tabs.
const adminBottomBarPaths = new Set(
diff --git a/ui/src/lib/adminNavigation.test.ts b/ui/src/lib/adminNavigation.test.ts
index f4412852f..2183ed216 100644
--- a/ui/src/lib/adminNavigation.test.ts
+++ b/ui/src/lib/adminNavigation.test.ts
@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';
import {
adminLandingPath,
+ filterLocalSystemNavItems,
isAdvancedSettingsPath,
isLocalOnlyMessagingField,
isLocalSystemPath,
@@ -37,6 +38,7 @@ 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/groups')).toBe(true);
expect(isLocalSystemPath('/admin/users')).toBe(true);
expect(isLocalSystemPath('/admin/logs')).toBe(true);
expect(isLocalSystemPath('/admin/settings/service')).toBe(true);
@@ -52,6 +54,7 @@ describe('isLocalSystemPath', () => {
it('matches nested paths under a gated destination', () => {
expect(isLocalSystemPath('/admin/settings/platforms/slack')).toBe(true);
+ expect(isLocalSystemPath('/admin/groups/engineering')).toBe(true);
expect(isLocalSystemPath('/harness/')).toBe(true);
});
@@ -68,6 +71,30 @@ describe('isLocalSystemPath', () => {
});
});
+describe('filterLocalSystemNavItems', () => {
+ it('removes local-only destinations from nested admin navigation trees', () => {
+ const visible = filterLocalSystemNavItems([
+ {
+ children: [
+ { to: '/admin/settings/platforms' },
+ { to: '/admin/groups' },
+ { to: '/admin/settings/messaging' },
+ ],
+ },
+ { onClick: () => undefined },
+ { to: '/admin/settings/messaging' },
+ ]);
+
+ expect(visible).toEqual([
+ {
+ children: [{ to: '/admin/settings/messaging' }],
+ },
+ { onClick: expect.any(Function) },
+ { to: '/admin/settings/messaging' },
+ ]);
+ });
+});
+
describe('adminLandingPath', () => {
it('opens the Dashboard for a trusted-local caller', () => {
expect(adminLandingPath(true)).toBe('/admin/dashboard');
diff --git a/ui/src/lib/adminNavigation.ts b/ui/src/lib/adminNavigation.ts
index 116dd2712..672fe507b 100644
--- a/ui/src/lib/adminNavigation.ts
+++ b/ui/src/lib/adminNavigation.ts
@@ -28,6 +28,7 @@ export const isMemorySettingsPath = (pathname: string): boolean =>
export const LOCAL_SYSTEM_ROUTES = [
'/admin/dashboard',
'/admin/remote-access',
+ '/admin/groups',
'/admin/users',
'/admin/logs',
'/admin/settings/service',
@@ -50,6 +51,20 @@ const LOCAL_ONLY_MESSAGING_FIELDS = new Set([
export const isLocalSystemPath = (pathname: string): boolean =>
LOCAL_SYSTEM_ROUTES.some((route) => matchesRoute(pathname, route));
+export type LocalSystemNavItem = {
+ to?: string;
+ onClick?: () => void;
+ children?: LocalSystemNavItem[];
+};
+
+export const filterLocalSystemNavItems = <T extends LocalSystemNavItem>(navItems: T[]): T[] =>
+ navItems
+ .filter((item) => !item.to || !isLocalSystemPath(item.to))
+ .map((item) =>
+ item.children ? ({ ...item, children: filterLocalSystemNavItems(item.children) } as T) : item,
+ )
+ .filter((item) => item.to || item.onClick || (item.children?.length ?? 0) > 0);
+
export const isLocalOnlyMessagingField = (field: string): boolean =>
LOCAL_ONLY_MESSAGING_FIELDS.has(field);
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index 7b8a99b86..73cb37e08 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -2293,8 +2293,9 @@ def enforce_instance_role_capabilities():
_REMOTE_CONFIG_MUTABLE_FIELDS = frozenset(
{
"ack_mode",
+ # Remote owners may choose how progress is presented, but the heartbeat
+ # cadence stays trusted-local because it directly controls edit timing.
"agent_progress_style",
- "agent_status_heartbeat_ms",
"agent_status_no_output_ms",
"include_time_info",
"include_user_info",