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(organization): harden management recovery and editors

Max6efbf1c87725
diff --git a/tests/scenarios/auth_setup/catalog.yaml b/tests/scenarios/auth_setup/catalog.yaml
index 18fbc840d..6dce75fe6 100644
--- a/tests/scenarios/auth_setup/catalog.yaml
+++ b/tests/scenarios/auth_setup/catalog.yaml
@@ -189,6 +189,13 @@ scenarios:
layer: scenario
backend: cloud_management
test: tests/scenarios/auth_setup/test_auth_setup_scenarios.py::OrganizationManagementAuthScenarioTests::test_unbound_loopback_requires_interactive_sign_in
+ - id: AUTH-SETUP-310
+ name: Organization subject mismatch can re-enter explicit authorization with a clean return path
+ status: covered
+ kind: retry
+ layer: scenario
+ backend: cloud_management
+ test: tests/scenarios/auth_setup/test_auth_setup_scenarios.py::OrganizationManagementAuthScenarioTests::test_subject_mismatch_can_reenter_with_clean_return_path
- id: AUTH-SETUP-901
name: Codex setup success refreshes runtime before the next turn
status: covered
diff --git a/tests/scenarios/auth_setup/test_auth_setup_scenarios.py b/tests/scenarios/auth_setup/test_auth_setup_scenarios.py
index 0bd838c77..fad9b0036 100644
--- a/tests/scenarios/auth_setup/test_auth_setup_scenarios.py
+++ b/tests/scenarios/auth_setup/test_auth_setup_scenarios.py
@@ -245,6 +245,67 @@ class OrganizationManagementAuthScenarioTests(unittest.TestCase):
},
)
+ def test_subject_mismatch_can_reenter_with_clean_return_path(self):
+ """Scenario: AUTH-SETUP-310"""
+ client = self.harness.remote_client()
+ client.set_cookie(cloud_management.BROWSER_COOKIE_NAME, "browser-1", domain="alex.avibe.bot")
+ with patch.object(
+ cloud_management,
+ "complete_authorization",
+ side_effect=cloud_management.CloudManagementError(
+ "cloud_management_subject_mismatch",
+ status=409,
+ ),
+ ):
+ mismatch = client.get(
+ "/auth/organization/callback?code=wrong-user&state=state-1",
+ base_url=REMOTE_ORIGIN,
+ )
+
+ self.assertEqual(mismatch.status_code, 302)
+ self.assertIn(
+ "cloud_management_error=cloud_management_subject_mismatch",
+ mismatch.headers["location"],
+ )
+
+ clean_next = "/admin/organization/overview"
+ with patch.object(
+ cloud_management,
+ "begin_authorization",
+ return_value=("https://avibe.bot/oauth/management/authorize?state=state-2", "state-2"),
+ ) as begin:
+ reentry = client.post(
+ "/api/cloud-management/session/start",
+ json={"mode": "interactive", "next": clean_next},
+ headers=self.harness.csrf(client),
+ base_url=REMOTE_ORIGIN,
+ )
+
+ self.assertEqual(reentry.status_code, 202)
+ self.assertEqual(begin.call_args.kwargs["next_path"], clean_next)
+
+ grant = cloud_management.ManagementGrant(
+ handle="grant-2",
+ browser_id="browser-1",
+ subject="user-1",
+ token="not-exposed",
+ expires_at=4_102_444_800,
+ )
+ with patch.object(
+ cloud_management,
+ "complete_authorization",
+ return_value=(grant, clean_next),
+ ):
+ success = client.get(
+ "/auth/organization/callback?code=right-user&state=state-2",
+ base_url=REMOTE_ORIGIN,
+ )
+
+ self.assertEqual(success.status_code, 302)
+ self.assertEqual(success.headers["location"], clean_next)
+ self.assertNotIn("cloud_management_error", success.headers["location"])
+
class AgentAuthSetupScenarioTests(unittest.IsolatedAsyncioTestCase):
async def test_codex_failure_scenario_emits_reset_path(self):
diff --git a/tests/test_dock_api.py b/tests/test_dock_api.py
index fc09a6d92..f1aacad76 100644
--- a/tests/test_dock_api.py
+++ b/tests/test_dock_api.py
@@ -440,8 +440,8 @@ def test_dock_route_round_trip_via_client(monkeypatch, tmp_path):
def test_dock_route_blocked_for_remote_without_session(monkeypatch, tmp_path):
"""Auth parity: the Dock routes inherit ``enforce_remote_access_cookie`` — a
- remote request without a session is bounced to the OAuth login, never served
- as an unauthenticated native endpoint."""
+ remote API request without a session gets the shared machine-readable login
+ signal and is never served as an unauthenticated native endpoint."""
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
_save_config(tmp_path)
@@ -451,8 +451,9 @@ def test_dock_route_blocked_for_remote_without_session(monkeypatch, tmp_path):
environ_base=_remote_peer(),
follow_redirects=False,
)
- assert get_resp.status_code == 302
- assert get_resp.headers["Location"].startswith("https://backend.test/oauth/authorize?")
+ assert get_resp.status_code == 401
+ assert get_resp.get_json()["error"] == "remote_access_login_required"
+ assert get_resp.headers.get("Location") is None
# The mutating routes are gated by the same before-request hook.
post_resp = app.test_client().post(
diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.py
index 645195dc7..33c763d8a 100644
--- a/tests/test_ui_remote_access_auth.py
+++ b/tests/test_ui_remote_access_auth.py
@@ -317,7 +317,7 @@ def test_remote_setup_route_requires_vibe_cloud_login(monkeypatch, tmp_path):
assert state_payload["next"] == "/setup"
-def test_remote_config_get_without_session_returns_login_required(monkeypatch, tmp_path):
+def test_remote_api_get_without_session_returns_login_required(monkeypatch, tmp_path):
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
_save_config(tmp_path)
@@ -328,8 +328,9 @@ def test_remote_config_get_without_session_returns_login_required(monkeypatch, t
follow_redirects=False,
)
- assert response.status_code == 302
- assert response.headers["Location"].startswith("https://backend.test/oauth/authorize?")
+ assert response.status_code == 401
+ assert response.get_json()["error"] == "remote_access_login_required"
+ assert response.headers.get("Location") is None
def test_api_config_blocked_host_returns_machine_readable_error(monkeypatch, tmp_path):
@@ -957,6 +958,29 @@ def _forged_session_cookie(config: V2Config, exp: int, *, email: str = "alex@exa
return f"{payload_text}.{signature}"
+def test_remote_api_get_with_expired_session_returns_login_required(monkeypatch, tmp_path):
+ import time as _time
+
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = _save_config(tmp_path)
+ client = app.test_client()
+ client.set_cookie(
+ remote_access.SESSION_COOKIE_NAME,
+ _forged_session_cookie(config, int(_time.time()) - 60),
+ domain="alex.avibe.bot",
+ )
+
+ response = client.get(
+ "/api/config",
+ base_url="https://alex.avibe.bot",
+ follow_redirects=False,
+ )
+
+ assert response.status_code == 401
+ assert response.get_json()["error"] == "remote_access_login_required"
+ assert response.headers.get("Location") is None
+
+
def test_remote_session_probe_reports_unauthenticated_when_authorization_refresh_required(monkeypatch, tmp_path):
import time as _time
diff --git a/ui/src/features/organization/components.tsx b/ui/src/features/organization/components.tsx
index b2e5d7e60..9b83f8f42 100644
--- a/ui/src/features/organization/components.tsx
+++ b/ui/src/features/organization/components.tsx
@@ -75,7 +75,7 @@ export function TableFrame({ children, className }: { children: React.ReactNode;
export function StatCard({ label, value, detail, icon }: {
label: string;
- value: number;
+ value: React.ReactNode;
detail?: string;
icon: React.ReactNode;
}) {
@@ -217,6 +217,7 @@ export function ErrorBanner({ code, onRetry }: { code?: string; onRetry?: () =>
'invalid_resource_acl_intent',
'invalid_email',
'invalid_domain',
+ 'duplicate_instance_access_principal',
'duplicate_project_access_principal',
'owner_entry_locked',
'resource_sync_conflict',
diff --git a/ui/src/features/organization/context.tsx b/ui/src/features/organization/context.tsx
index 148cc46ef..3f743ff16 100644
--- a/ui/src/features/organization/context.tsx
+++ b/ui/src/features/organization/context.tsx
@@ -1,3 +1,4 @@
+/* eslint-disable react-refresh/only-export-components */
import React, {
createContext,
useCallback,
@@ -7,7 +8,6 @@ import React, {
useRef,
useState,
} from 'react';
-import { useLocation } from 'react-router-dom';
import { OrganizationApiError, organizationRequest } from './api/client';
import type {
@@ -15,6 +15,7 @@ import type {
Organization,
OrganizationDetail,
} from './api/types';
+import { organizationAuthorizationReturnPath } from './policy';
type GateState =
| 'loading'
@@ -50,15 +51,28 @@ function callbackError(): string | null {
const params = new URLSearchParams(window.location.search);
const error = params.get('cloud_management_error');
if (error) {
- params.delete('cloud_management_error');
- const query = params.toString();
- window.history.replaceState(null, '', `${window.location.pathname}${query ? `?${query}` : ''}${window.location.hash}`);
+ const next = organizationAuthorizationReturnPath(
+ window.location.pathname,
+ window.location.search,
+ );
+ window.history.replaceState(null, '', `${next}${window.location.hash}`);
}
return error;
}
+function gateForOrganizationError(
+ error: unknown,
+ unauthorizedGate: Extract<GateState, 'authorization_required' | 'revoked'>,
+): GateState {
+ if (!(error instanceof OrganizationApiError)) return 'unreachable';
+ if (error.code === 'cloud_management_subject_mismatch') return 'subject_mismatch';
+ if (error.status === 401) return unauthorizedGate;
+ if (error.status === 409) return 'cloud_not_connected';
+ if (error.retryable || error.status >= 500) return 'unreachable';
+ return 'error';
+}
+
export function OrganizationProvider({ children }: { children: React.ReactNode }) {
- const location = useLocation();
const [gate, setGate] = useState<GateState>('loading');
const [session, setSession] = useState<Extract<CloudManagementSession, { connected: true }> | null>(null);
const [organizations, setOrganizations] = useState<Organization[]>([]);
@@ -76,21 +90,20 @@ export function OrganizationProvider({ children }: { children: React.ReactNode }
'/api/cloud-management/session/start',
{
method: 'POST',
- body: JSON.stringify({ mode, next: `${location.pathname}${location.search}` }),
+ body: JSON.stringify({
+ mode,
+ next: organizationAuthorizationReturnPath(
+ window.location.pathname,
+ window.location.search,
+ ),
+ }),
},
);
window.location.assign(result.authorize_url);
} catch (error) {
- if (error instanceof OrganizationApiError) {
- if (error.code === 'cloud_management_subject_mismatch') setGate('subject_mismatch');
- else if (error.status === 409) setGate('cloud_not_connected');
- else if (error.status === 401) setGate('authorization_required');
- else setGate('unreachable');
- } else {
- setGate('unreachable');
- }
+ setGate(gateForOrganizationError(error, 'authorization_required'));
}
- }, [location.pathname, location.search]);
+ }, []);
const loadOrganizationAtGeneration = useCallback(async (
organizationId: string,
@@ -114,7 +127,12 @@ export function OrganizationProvider({ children }: { children: React.ReactNode }
const selectOrganization = useCallback(async (organizationId: string) => {
const generation = ++operationGeneration.current;
- await loadOrganizationAtGeneration(organizationId, generation);
+ try {
+ await loadOrganizationAtGeneration(organizationId, generation);
+ } catch (error) {
+ if (generation !== operationGeneration.current) return;
+ setGate(gateForOrganizationError(error, 'revoked'));
+ }
}, [loadOrganizationAtGeneration]);
const loadOrganizations = useCallback(async (generation: number) => {
@@ -176,14 +194,10 @@ export function OrganizationProvider({ children }: { children: React.ReactNode }
await loadOrganizations(generation);
} catch (error) {
if (generation !== operationGeneration.current) return;
- if (error instanceof OrganizationApiError) {
- if (error.code === 'cloud_management_subject_mismatch') setGate('subject_mismatch');
- else if (error.status === 401) setGate(returnedError ? 'authorization_required' : 'revoked');
- else if (error.status === 409) setGate('cloud_not_connected');
- else setGate('unreachable');
- } else {
- setGate('unreachable');
- }
+ setGate(gateForOrganizationError(
+ error,
+ returnedError ? 'authorization_required' : 'revoked',
+ ));
}
}, [loadOrganizations, startAuthorization]);
@@ -232,7 +246,12 @@ export function OrganizationProvider({ children }: { children: React.ReactNode }
const refreshOrganization = useCallback(async () => {
if (!selectedOrganizationId) return;
const generation = ++operationGeneration.current;
- await loadOrganizationAtGeneration(selectedOrganizationId, generation);
+ try {
+ await loadOrganizationAtGeneration(selectedOrganizationId, generation);
+ } catch (error) {
+ if (generation !== operationGeneration.current) return;
+ setGate(gateForOrganizationError(error, 'revoked'));
+ }
}, [loadOrganizationAtGeneration, selectedOrganizationId]);
const value = useMemo<OrganizationContextValue>(() => ({
diff --git a/ui/src/features/organization/pages/OrganizationInstancePages.tsx b/ui/src/features/organization/pages/OrganizationInstancePages.tsx
index 7467a385f..21c9105b4 100644
--- a/ui/src/features/organization/pages/OrganizationInstancePages.tsx
+++ b/ui/src/features/organization/pages/OrganizationInstancePages.tsx
@@ -60,6 +60,7 @@ import {
} from '../components';
import { useOrganization } from '../context';
import {
+ hasDuplicateOrganizationPrincipals,
hasDuplicateProjectPrincipals,
isCurrentOrganizationLoad,
normalizeOrganizationPrincipal,
@@ -262,14 +263,31 @@ function AccessEntryDialog({
value: normalizeOrganizationPrincipal(kind, resolvedValue),
role,
};
+ const archivedGroup = kind === 'organization_group'
+ ? groups.find((group) => group.id === value && group.archived_at)
+ : undefined;
+ const nextEntries = () => (
+ editingIndex === null
+ ? [...entries, candidate]
+ : entries.map((entry, index) => (index === editingIndex ? candidate : entry))
+ );
+ const hasDuplicatePrincipal = (next: InstanceAccessEntry[]) => (
+ hasDuplicateOrganizationPrincipals(next.map((entry) => ({
+ kind: entry.kind,
+ value: entry.value,
+ })))
+ );
const commit = async () => {
if (!candidate.value) return;
- setSaving(true);
setError(undefined);
- const next = editingIndex === null
- ? [...entries, candidate]
- : entries.map((entry, index) => (index === editingIndex ? candidate : entry));
+ const next = nextEntries();
+ if (hasDuplicatePrincipal(next)) {
+ setError('duplicate_instance_access_principal');
+ setConfirmNarrowing(false);
+ return;
+ }
+ setSaving(true);
try {
const result = await request<{ entries: InstanceAccessEntry[] }>(
`/api/cloud-management/instances/${encodeURIComponent(instanceId)}/authorized-users`,
@@ -286,6 +304,11 @@ function AccessEntryDialog({
};
const save = () => {
+ setError(undefined);
+ if (hasDuplicatePrincipal(nextEntries())) {
+ setError('duplicate_instance_access_principal');
+ return;
+ }
const narrows = Boolean(editing) && (
editing?.role === 'editor' && candidate.role === 'viewer'
|| editing?.kind !== candidate.kind
@@ -325,6 +348,11 @@ function AccessEntryDialog({
value={resolvedValue}
onChange={(event) => setValue(event.target.value)}
>
+ {archivedGroup ? (
+ <option value={archivedGroup.id}>
+ {archivedGroup.name} ({t('organization.groups.archived')})
+ </option>
+ ) : null}
{activeGroups.map((group) => <option key={group.id} value={group.id}>{group.name}</option>)}
</Select>
) : (
diff --git a/ui/src/features/organization/pages/OrganizationOverviewPage.tsx b/ui/src/features/organization/pages/OrganizationOverviewPage.tsx
index 81d2b168f..1bf2b8439 100644
--- a/ui/src/features/organization/pages/OrganizationOverviewPage.tsx
+++ b/ui/src/features/organization/pages/OrganizationOverviewPage.tsx
@@ -42,7 +42,7 @@ type OverviewData = {
instances: OrganizationInstance[];
members: OrganizationMember[];
resources: OrganizationResource[];
- projects: OrganizationProject[];
+ projects: OrganizationProject[] | null;
};
function isUnhealthy(status: ReturnType<typeof aggregateSyncStatus>): boolean {
@@ -106,10 +106,10 @@ export function OrganizationOverviewPage() {
)
: Promise.resolve({ resources: [] }),
]);
- const projectResults = await Promise.all(
+ const projectResults = await Promise.allSettled(
instanceResult.instances.map((instance) => request<{ projects: OrganizationProject[] }>(
`/api/cloud-management/instances/${encodeURIComponent(instance.id)}/projects`,
- ).catch(() => ({ projects: [] }))),
+ )),
);
if (!isCurrent()) return;
setLoadedData({
@@ -118,7 +118,11 @@ export function OrganizationOverviewPage() {
instances: instanceResult.instances,
members: memberResult.members,
resources: resourceResult.resources,
- projects: projectResults.flatMap((result) => result.projects),
+ projects: projectResults.every((result) => result.status === 'fulfilled')
+ ? projectResults.flatMap((result) => (
+ result.status === 'fulfilled' ? result.value.projects : []
+ ))
+ : null,
},
});
} catch (caught) {
@@ -197,7 +201,12 @@ export function OrganizationOverviewPage() {
icon={<Boxes className="size-5" />}
/>
<StatCard label={t('organization.nav.instances')} value={data.instances.length} icon={<Server className="size-5" />} />
- <StatCard label={t('organization.overview.projects')} value={data.projects.length} icon={<FolderTree className="size-5" />} />
+ <StatCard
+ label={t('organization.overview.projects')}
+ value={data.projects === null ? '-' : data.projects.length}
+ detail={data.projects === null ? t('organization.overview.projectCountUnavailable') : undefined}
+ icon={<FolderTree className="size-5" />}
+ />
{canManage ? (
<StatCard label={t('organization.nav.resources')} value={data.resources.length} icon={<Workflow className="size-5" />} />
) : null}
diff --git a/ui/src/features/organization/policy.test.ts b/ui/src/features/organization/policy.test.ts
index e7c29ee92..9d7da54e4 100644
--- a/ui/src/features/organization/policy.test.ts
+++ b/ui/src/features/organization/policy.test.ts
@@ -2,9 +2,11 @@ import { describe, expect, it } from 'vitest';
import {
aggregateSyncStatus,
+ hasDuplicateOrganizationPrincipals,
hasDuplicateProjectPrincipals,
isCurrentOrganizationLoad,
normalizeOrganizationPrincipal,
+ organizationAuthorizationReturnPath,
organizationSwitchDestination,
requiresMemberRoleDowngradeConfirmation,
requiresProjectAccessNarrowingConfirmation,
@@ -29,6 +31,36 @@ describe('Organization policy helpers', () => {
])).toBe(false);
});
+ it('rejects duplicate normalized Avibe access principals', () => {
+ expect(hasDuplicateOrganizationPrincipals([
+ { kind: 'email', value: '[email protected]' },
+ { kind: 'email', value: ' [email protected] ' },
+ ])).toBe(true);
+ expect(hasDuplicateOrganizationPrincipals([
+ { kind: 'email_domain', value: '@Example.com' },
+ { kind: 'email_domain', value: ' example.com ' },
+ ])).toBe(true);
+ expect(hasDuplicateOrganizationPrincipals([
+ { kind: 'organization_group', value: 'group-1' },
+ { kind: 'organization_group', value: ' group-1 ' },
+ ])).toBe(true);
+ expect(hasDuplicateOrganizationPrincipals([
+ { kind: 'email', value: '[email protected]' },
+ { kind: 'email_domain', value: '[email protected]' },
+ ])).toBe(false);
+ });
+
+ it('removes callback errors from Organization authorization return paths', () => {
+ expect(organizationAuthorizationReturnPath(
+ '/admin/organization/overview',
+ '?tab=access&cloud_management_error=cloud_management_subject_mismatch',
+ )).toBe('/admin/organization/overview?tab=access');
+ expect(organizationAuthorizationReturnPath(
+ '/admin/organization/overview',
+ '?cloud_management_error=cloud_management_subject_mismatch',
+ )).toBe('/admin/organization/overview');
+ });
+
it('derives child sync status in the documented severity order', () => {
expect(aggregateSyncStatus({ active: 4, error: 1, offline: 1, applying: 1, in_sync: 1 })).toBe('error');
expect(aggregateSyncStatus({ active: 3, error: 0, offline: 1, applying: 1, in_sync: 1 })).toBe('offline');
diff --git a/ui/src/features/organization/policy.ts b/ui/src/features/organization/policy.ts
index 5fb2cf57e..b078e1da8 100644
--- a/ui/src/features/organization/policy.ts
+++ b/ui/src/features/organization/policy.ts
@@ -9,6 +9,11 @@ export type OrganizationPrincipalKind = ProjectBinding['principal_kind'];
export type ProjectAccessMode = 'inherit' | 'owner_only' | 'restricted';
export type AggregateSyncStatus = 'none' | 'in_sync' | 'applying' | 'offline' | 'error';
+type OrganizationPrincipal = {
+ kind: OrganizationPrincipalKind;
+ value: string;
+};
+
const ORGANIZATION_GROUP_DETAIL_PATH = /^\/admin\/organization\/groups\/[^/]+\/?$/;
const ORGANIZATION_INSTANCE_DETAIL_PATH = /^\/admin\/organization\/instances\/[^/]+\/(?:access|projects)\/?$/;
@@ -21,13 +26,20 @@ export function normalizeOrganizationPrincipal(
return (kind === 'email_domain' ? normalized.replace(/^@/, '') : normalized).toLowerCase();
}
-export function hasDuplicateProjectPrincipals(bindings: ProjectBinding[]): boolean {
- const keys = bindings.map((binding) => (
- `${binding.principal_kind}:${normalizeOrganizationPrincipal(binding.principal_kind, binding.principal_value)}`
+export function hasDuplicateOrganizationPrincipals(principals: OrganizationPrincipal[]): boolean {
+ const keys = principals.map((principal) => (
+ `${principal.kind}:${normalizeOrganizationPrincipal(principal.kind, principal.value)}`
));
return new Set(keys).size !== keys.length;
}
+export function hasDuplicateProjectPrincipals(bindings: ProjectBinding[]): boolean {
+ return hasDuplicateOrganizationPrincipals(bindings.map((binding) => ({
+ kind: binding.principal_kind,
+ value: binding.principal_value,
+ })));
+}
+
function projectBindingKey(binding: ProjectBinding): string {
return `${binding.principal_kind}:${normalizeOrganizationPrincipal(
binding.principal_kind,
@@ -103,6 +115,13 @@ export function organizationSwitchDestination(pathname: string): string | null {
return null;
}
+export function organizationAuthorizationReturnPath(pathname: string, search: string): string {
+ const params = new URLSearchParams(search);
+ params.delete('cloud_management_error');
+ const query = params.toString();
+ return `${pathname}${query ? `?${query}` : ''}`;
+}
+
export function requiresMemberRoleDowngradeConfirmation(
currentRole: OrganizationRole,
nextRole: OrganizationRole,
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 665659a6d..bb9c2c889 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -3443,6 +3443,7 @@
"invalid_resource_acl_intent": "Choose a valid Resource audience.",
"invalid_email": "Enter a valid email address.",
"invalid_domain": "Enter a valid email domain.",
+ "duplicate_instance_access_principal": "Each Avibe access principal can appear only once.",
"duplicate_project_access_principal": "Each Project principal can appear only once.",
"owner_entry_locked": "The Avibe owner's implicit access cannot be changed.",
"resource_sync_conflict": "This policy changed elsewhere. Review the latest version before saving.",
@@ -3488,6 +3489,7 @@
"memberBreakdown": "{{invited}} invited · {{removed}} removed",
"groupBreakdown": "{{archived}} archived",
"projects": "Projects",
+ "projectCountUnavailable": "Count unavailable",
"policySync": "Policy sync",
"needsAttention": "Needs attention",
"instanceNeedsAttention": "{{name}} has policy changes that need attention.",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 629c607ec..53cef1e8d 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -3443,6 +3443,7 @@
"invalid_resource_acl_intent": "请选择有效的资源受众。",
"invalid_email": "请输入有效的邮箱地址。",
"invalid_domain": "请输入有效的邮箱域名。",
+ "duplicate_instance_access_principal": "同一个 Avibe 访问主体只能出现一次。",
"duplicate_project_access_principal": "同一个 Project 主体只能出现一次。",
"owner_entry_locked": "不能修改 Avibe 所有者的隐式访问权限。",
"resource_sync_conflict": "策略已在其他位置更改,请检查最新版本后再保存。",
@@ -3488,6 +3489,7 @@
"memberBreakdown": "{{invited}} 个已邀请 · {{removed}} 个已移除",
"groupBreakdown": "{{archived}} 个已归档",
"projects": "Project",
+ "projectCountUnavailable": "计数暂不可用",
"policySync": "策略同步",
"needsAttention": "需要处理",
"instanceNeedsAttention": "{{name}} 的策略变更需要处理。",
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index b7fe11451..d82d656ce 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -2200,7 +2200,7 @@ def enforce_remote_access_cookie():
if remote_access.session_needs_renewal(payload):
g.remote_session_renew = payload
return None
- if request.method == "GET":
+ if request.method == "GET" and not request.path.startswith("/api/"):
# Bound unauthenticated login-start floods at the door (this writes a
# handshake + sets cookies); a real user spends only a couple per login.
if _auth_rate_limited():