fix(multitenant): remove dead alias, duplicate origin, and tenant-scoped platform hosts (Sam & zAI)

Remove duplicate trusted origin in auth.ts where PLATFORM_INTERNAL_DOMAIN
and ai.${PLATFORM_INTERNAL_BASE} resolve to the same string.

Switch worker/browser/GUI/docs local hostnames from tenant-scoped
AGENT_INTERNAL_DOMAIN to PLATFORM_INTERNAL_BASE — these are platform
infrastructure, not tenant content.

Remove AGENT_PID_FILE dead alias — zero consumers, PLATFORM_PID_FILE
is canonical.

---
Build: pass | Tests: pass — 1812 passed (115 files)
This commit is contained in:
Clawdie AI 2026-04-24 19:37:51 +02:00
parent 9ed3ce607c
commit c2d340155a
3 changed files with 14 additions and 25 deletions

View file

@ -6,7 +6,6 @@ import {
CONTROLPLANE_API_PORT, CONTROLPLANE_API_PORT,
BETTER_AUTH_SECRET, BETTER_AUTH_SECRET,
BETTER_AUTH_URL, BETTER_AUTH_URL,
PLATFORM_INTERNAL_BASE,
PLATFORM_INTERNAL_DOMAIN, PLATFORM_INTERNAL_DOMAIN,
} from './config.js'; } from './config.js';
import { logger } from './logger.js'; import { logger } from './logger.js';
@ -14,12 +13,13 @@ import { logger } from './logger.js';
export type AuthMode = 'local_trusted' | 'authenticated'; export type AuthMode = 'local_trusted' | 'authenticated';
export function createAuth(pool: Pool) { export function createAuth(pool: Pool) {
const trustedOrigins = Array.from(new Set([ const trustedOrigins = Array.from(
`http://localhost:${CONTROLPLANE_API_PORT}`, new Set([
`http://${PLATFORM_INTERNAL_DOMAIN}:${CONTROLPLANE_API_PORT}`, `http://localhost:${CONTROLPLANE_API_PORT}`,
`http://10.0.0.2:${CONTROLPLANE_API_PORT}`, `http://${PLATFORM_INTERNAL_DOMAIN}:${CONTROLPLANE_API_PORT}`,
`http://ai.${PLATFORM_INTERNAL_BASE}:${CONTROLPLANE_API_PORT}`, `http://10.0.0.2:${CONTROLPLANE_API_PORT}`,
])); ]),
);
const auth = betterAuth({ const auth = betterAuth({
baseURL: BETTER_AUTH_URL, baseURL: BETTER_AUTH_URL,
@ -58,10 +58,7 @@ export function createAuth(pool: Pool) {
}, },
}); });
logger.info( logger.info({ mode: CONTROLPLANE_AUTH_MODE }, 'Better Auth initialized');
{ mode: CONTROLPLANE_AUTH_MODE },
'Better Auth initialized',
);
return auth; return auth;
} }

View file

@ -244,15 +244,8 @@ export const CODE_ADMIN_EXPOSURE =
export const PUBLISHING_MODE = export const PUBLISHING_MODE =
registryDefaults?.platform.publishingMode || 'disabled'; registryDefaults?.platform.publishingMode || 'disabled';
export const RESERVED_HOST_LABELS = export const RESERVED_HOST_LABELS = registryDefaults?.platform
registryDefaults?.platform.reservedHostLabels || [ .reservedHostLabels || ['ai', 'cms', 'git', 'web', 'www', 'mail'];
'ai',
'cms',
'git',
'web',
'www',
'mail',
];
// ── Agent identity ─────────────────────────────────────────────────────────── // ── Agent identity ───────────────────────────────────────────────────────────
@ -375,7 +368,6 @@ export const SYSTEM_LOCALE = normalizeSystemLocale(
// ── Service naming ── // ── Service naming ──
export const PLATFORM_PID_FILE = `${PLATFORM_SERVICE_NAME}.pid`; export const PLATFORM_PID_FILE = `${PLATFORM_SERVICE_NAME}.pid`;
export const AGENT_PID_FILE = PLATFORM_PID_FILE;
// ── Engine & provider ── // ── Engine & provider ──

View file

@ -28,10 +28,10 @@ export const GIT_LOCAL_HOST = CODE_SERVICE_INTERNAL_DOMAIN;
export const OLLAMA_LOCAL_HOST = OLLAMA_INTERNAL_DOMAIN; export const OLLAMA_LOCAL_HOST = OLLAMA_INTERNAL_DOMAIN;
export const LLAMA_CPP_LOCAL_HOST = LLAMA_CPP_INTERNAL_DOMAIN; export const LLAMA_CPP_LOCAL_HOST = LLAMA_CPP_INTERNAL_DOMAIN;
export const CMS_LOCAL_HOST = CMS_INTERNAL_DOMAIN; export const CMS_LOCAL_HOST = CMS_INTERNAL_DOMAIN;
export const WORKER_LOCAL_HOST = `worker.${AGENT_INTERNAL_DOMAIN}`; export const WORKER_LOCAL_HOST = `worker.${PLATFORM_INTERNAL_BASE}`;
export const BROWSER_LOCAL_HOST = `browser.${AGENT_INTERNAL_DOMAIN}`; export const BROWSER_LOCAL_HOST = `browser.${PLATFORM_INTERNAL_BASE}`;
export const GUI_LOCAL_HOST = `gui.${AGENT_INTERNAL_DOMAIN}`; export const GUI_LOCAL_HOST = `gui.${PLATFORM_INTERNAL_BASE}`;
export const DOCS_LOCAL_HOST = `docs.${AGENT_INTERNAL_DOMAIN}`; export const DOCS_LOCAL_HOST = `docs.${PLATFORM_INTERNAL_BASE}`;
export const AGENT_LOCAL_SITE_HOST = AGENT_INTERNAL_DOMAIN; export const AGENT_LOCAL_SITE_HOST = AGENT_INTERNAL_DOMAIN;
function uniqueNames(names: string[]): string[] { function uniqueNames(names: string[]): string[] {