Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
Merge remote-tracking branch 'origin/dev' into pr252-sync-20260905
Alfredo Lopez61c5217a0f6b
diff --cc control-api/src/db.tsindex 1a4b716b5,d2c282feb..ce5db6654--- a/control-api/src/db.ts+++ b/control-api/src/db.ts@@@ -5963,9 -5969,51 +5999,64 @@@ export const CONTROL_API_MIGRATIONS: Db},},{- version: '0101_mcp_secret_rollback_permits',+ version: '0101_codex_multi_connection',+ apply: applyCodexMultiConnectionSchema,+ },+ {+ version: '0102_codex_catalog_models',+ apply: applyCodexCatalogModelsSchema,+ },+ {+ version: '0103_llm_provider_attempts_connection_id',+ apply: applyLlmProviderAttemptConnectionIdSchema,+ },+ {+ version: '0104_codex_grant_default_model',+ apply: applyCodexGrantDefaultModelSchema,+ },+ {+ version: '0105_codex_reusable_connection_key',+ apply: applyCodexReusableConnectionKeySchema,+ },+ {+ version: '0106_oauth_grants_owner_generalization',+ // Renamed repeatedly while rebasing onto dev: 0091 -> 0100 -> 0101 -> 0106+ // (each dev sync collided with a migration dev landed at the same number; the+ // latest sync brought dev's 0101–0105 codex migrations, so 0101 is now taken+ // by 0101_codex_multi_connection). Environments where the feature branch+ // already deployed recorded it under an earlier name (the dev cluster most+ // likely as 0100_...). legacyVersions lets the runner mark 0106 applied from+ // that prior row instead of re-running the DDL and leaving an orphan+ // schema_migrations entry. Every prior name is unique to this migration, so+ // there is no false-skip.+ legacyVersions: [+ '0101_oauth_grants_owner_generalization',+ '0100_oauth_grants_owner_generalization',+ '0091_oauth_grants_owner_generalization',+ ],+ apply: applyOAuthGrantsOwnerGeneralization,+ },+ {+ version: '0107_llm_provider_attempts_sdk_link',+ apply: applyLlmProviderAttemptSdkLinkSchema,+ },+ {+ version: '0108_llm_provider_attempts_sdk_link_on_delete_set_null',+ apply: applyLlmProviderAttemptSdkLinkOnDeleteSetNullSchema,+ },++ {++ version: '0109_mcp_secret_rollback_permits',++ // Renamed while syncing onto dev: 0101 -> 0109. This branch introduced the++ // migration as 0101, and the sync brought dev's 0101–0108 (codex multi-++ // connection through the SDK-link FK), so 0101 is now taken by++ // 0101_codex_multi_connection. Environments where this feature branch was++ // already deployed recorded it under the earlier name. legacyVersions lets++ // the runner mark 0109 applied from that prior row instead of re-running++ // the DDL and leaving an orphan schema_migrations entry. The prior name is++ // unique to this migration, so there is no false-skip.++ legacyVersions: ['0101_mcp_secret_rollback_permits'],+ apply: applyMcpSecretRollbackPermitSchema,+ },]async function consolidateWorkflowAllowedUsersToTriggers(db: DbClient): Promise<void> {diff --cc control-api/src/routes/admin/resources.tsindex 920faed74,a244c464c..f31582c12--- a/control-api/src/routes/admin/resources.ts+++ b/control-api/src/routes/admin/resources.ts@@@ -11,9 -11,7 +11,8 @@@ import { enforceNamespace } from '../..import { validateCommunicationChannelSpec } from '../../http/validateCommunicationChannelSpec.js'import { validateMcpServerSpecPreflight } from '../../http/validateMcpServerSpec.js'import { K8sGateway } from '../../k8s.js'+import { rootLogger } from '../../observability/logger.js'import { stripHookRefFromHosts } from '../../services/hostGuardrailRefs.js'- import { getModelAllowlistState, isModelAllowed } from '../../services/llmAllowedModels.js'import {K8sConflictError,K8sNotFoundError,diff --cc control-api/src/routes/admin/secrets.tsindex fe3186c91,0169b7062..6ead505d2--- a/control-api/src/routes/admin/secrets.ts+++ b/control-api/src/routes/admin/secrets.ts@@@ -594,55 -522,38 +603,90 @@@ export function createAdminSecretsRoutestringData: data,}- const created = await gateway.createSecret(secretReq)+ // Key NAMES are safe to log; values never are. Emit after the write+ // succeeds (a create that happened must never go unlogged) and on the+ // failed write path so operators can still reconstruct the attempt.+ const createdKeys = Object.keys(data).sort((a, b) => a.localeCompare(b))++ let created: Awaited<ReturnType<typeof gateway.createSecret>>+ try {- await gateway.createSecret(secretReq)++ created = await gateway.createSecret(secretReq)+ } catch (err) {+ logger.warn(+ {+ module: 'admin-secrets',+ event: 'mcp-secret-create-failed',+ name: name.trim(),+ namespace: targetNs,+ createdKeys,+ err: auditErrorFields(err),+ },+ 'MCP Secret create failed'+ )+ throw err+ }+++ // The Secret now exists in the cluster. Log it before any fail-closed++ // return below, so a 503 on identity or permit persistence never hides a++ // write that actually landed.+ logger.info(+ {+ module: 'admin-secrets',+ event: 'mcp-secret-created',+ name: name.trim(),+ namespace: targetNs,+ createdKeys,+ },+ 'MCP Secret created'+ )- res.status(201).json({ name: name.trim(), namespace: targetNs, created: true })+++ const identity = secretIdentityPreconditions(created)+ const completeIdentity =+ identity?.uid && identity.resourceVersion+ ? { uid: identity.uid, resourceVersion: identity.resourceVersion }+ : null+ if (!completeIdentity) {+ res.status(503).json({ error: 'secret_identity_unavailable', outcome: 'repair_required' })+ return+ }+ const rollbackPermit: McpSecretRollbackPermit = {+ sessionJti: (req as UiAuthedRequest).adminAuth?.jti ?? '',+ name: secretReq.name,+ namespace: targetNs,+ uid: completeIdentity.uid,+ resourceVersion: completeIdentity.resourceVersion,+ }+ try {+ await rollbackPermits.issue(rollbackPermit)+ } catch (err) {+ logger.error(+ {+ err,+ module: 'admin-secrets',+ event: 'mcp-secret-create-rollback-permit-repair-required',+ name: secretReq.name,+ namespace: targetNs,+ },+ 'MCP Secret create could not persist its rollback permit'+ )+ res.status(503).json({+ error: 'mcp_secret_rollback_permit_unavailable',+ outcome: 'repair_required',+ created: {+ name: secretReq.name,+ namespace: targetNs,+ uid: completeIdentity.uid,+ resourceVersion: completeIdentity.resourceVersion,+ },+ })+ return+ }+ res.status(201).json({+ name: name.trim(),+ namespace: targetNs,+ uid: completeIdentity.uid,+ resourceVersion: completeIdentity.resourceVersion,+ created: true,+ })}))diff --cc control-api/test/db.migrationsOrder.test.tsindex bf84c27a1,151aec60f..08a93da70--- a/control-api/test/db.migrationsOrder.test.ts+++ b/control-api/test/db.migrationsOrder.test.ts@@@ -58,41 -58,4 +58,41 @@@ describe('CONTROL_API_MIGRATIONS orderiexpect(duplicates).toEqual([])expect(currentCollisions).toEqual([])})+- it('requires 0101_mcp_secret_rollback_permits to persist expiring rollback permits', async () => {++ it('requires 0109_mcp_secret_rollback_permits to persist expiring rollback permits', async () => {+ const { CONTROL_API_MIGRATIONS } = await import('../src/db.js')+ const migration = CONTROL_API_MIGRATIONS.find(- candidate => candidate.version === '0101_mcp_secret_rollback_permits'++ candidate => candidate.version === '0109_mcp_secret_rollback_permits'+ )++ expect(migration).toBeDefined()+ if (!migration) return++ const query = vi.fn().mockResolvedValue({ rows: [], rowCount: 0 })+ await migration.apply({ query } as never)++ const sql = query.mock.calls.map(([statement]) => String(statement)).join('\n')+ expect(sql).toMatch(/CREATE TABLE IF NOT EXISTS mcp_secret_rollback_permits/i)+ for (const column of [+ 'session_hash',+ 'namespace',+ 'name',+ 'uid',+ 'resource_version',+ 'expires_at',+ 'claim_token',+ 'claim_expires_at',+ ]) {+ expect(sql).toMatch(new RegExp(`\\b${column}\\b`, 'i'))+ }+ expect(sql).toMatch(/session_hash\s+BYTEA/i)+ expect(sql).toMatch(/octet_length\s*\(\s*session_hash\s*\)\s*=\s*32/i)+ expect(sql).toMatch(/expires_at\s*<=\s*created_at\s*\+\s*INTERVAL\s*'120 seconds'/i)+ expect(sql).toMatch(/claim_token\s+UUID/i)+ expect(sql).toMatch(/claim_expires_at\s+TIMESTAMPTZ/i)+ expect(sql).toMatch(/claim_token IS NULL[\s\S]+claim_expires_at IS NULL/i)+ expect(sql).toMatch(+ /CREATE INDEX IF NOT EXISTS[\s\S]+?ON mcp_secret_rollback_permits\s*\(\s*expires_at\s*\)/i+ )+ })})diff --cc control-ui/components/CreateMcpServerForm/index.tsxindex 14b65e8a0,2f9f2f9a3..130ba6baa--- a/control-ui/components/CreateMcpServerForm/index.tsx+++ b/control-ui/components/CreateMcpServerForm/index.tsx@@@ -12,20 -12,19 +12,27 @@@ importcreateMcpSecret,createMcpServer,deleteMcpSecret,+ deleteMcpServer,+ getAgentTeams,+ getAgentUsers,getContext,- getContextTeams,- getContextUsers,- getContexts,getHosts,+ getMcpSecretRollbackRepairIdentity,listOrgImages,updateContext,} from '@/lib/api'- import type { EnvSecretKeyMapping, EnvVar, OrgImage } from '@/lib/api'- import type { EgressBinding } from '@/lib/api'- import type { SecretIdentity } from '@/lib/api'-import type { EgressBinding, EnvSecretKeyMapping, EnvVar, HostResource, OrgImage } from '@/lib/api'++import type {++ EgressBinding,++ EnvSecretKeyMapping,++ EnvVar,++ HostResource,++ OrgImage,++ SecretIdentity,++} from '@/lib/api'+ import { connectorContextAssignmentError } from '@/lib/connectorOAuthAccess'import { buildContextUpdatePayload } from '@/lib/contextMutation'import type { EgressEditorStatus } from '@/lib/egressModel'+ import { createPrivateContext } from '@/lib/privateContext'import { EgressEditor } from '../EgressEditor'import { DEFAULT_REGISTRY_HOST, buildImageCoordinate } from '../PublisherView/dockerCredential'import { MCP_SERVER_NAME_PATTERN, TRANSPORT_TYPES } from './constants'@@@ -534,44 -571,81 +579,87 @@@ export function CreateMcpServerForm(const willCreateSecret =useEnvSecret && envSecretName.trim().length > 0 && Object.keys(secretData).length > 0- let secretCreated = false+ let createdSecretName: string | null = null+ let createdSecretIdentity: SecretIdentity | undefinedtry {if (willCreateSecret) {- await createMcpSecret(envSecretName.trim(), secretData)- secretCreated = true+ const secretName = envSecretName.trim()+ const created = await createMcpSecret(secretName, secretData)+ createdSecretName = secretName+ if (created.uid && created.resourceVersion) {+ createdSecretIdentity = { uid: created.uid, resourceVersion: created.resourceVersion }+ }}- await createMcpServer({+ const createdServer = await createMcpServer({metadata: { name },spec,})- try {- const context = await getContext(contextRef)- const existingServers = context.spec?.mcpServers ?? []-- if (!existingServers.includes(name)) {- await updateContext(- contextRef,- buildContextUpdatePayload(context.metadata?.resourceVersion, {- contextId: context.spec?.contextId ?? contextRef,- description: context.spec?.description,- mcpServers: [...existingServers, name],- sharedFileSystems: context.spec?.sharedFileSystems ?? [],- })- )+ const oauthScopeError = connectorContextAssignmentError(+ createdServer.spec,+ selectedContextRefs+ )+ if (oauthScopeError) {+ const rollbackFailures: string[] = []+ try {+ await deleteMcpServer(name)+ } catch {+ rollbackFailures.push('connector')}- } catch (contextError) {- if (secretCreated) {++ if (createdSecretName) {+ try {- await deleteMcpSecret(envSecretName.trim())- secretCreated = false++ await deleteMcpSecret(createdSecretName, createdSecretIdentity)++ createdSecretName = null++ createdSecretIdentity = undefined+ } catch {+ rollbackFailures.push('Secret')+ }+ }+ setError(+ rollbackFailures.length === 0+ ? oauthScopeError+ : `${oauthScopeError} Automatic cleanup failed for the ${rollbackFailures.join(+ ' and '+ )}; remove it before retrying.`+ )+ return+ }++ // Give the selected agents access. Each agent's private scope gets an+ // additive write with its own loaded resourceVersion; failures are+ // collected so the operator knows the connector itself was created.+ const failedAgents: string[] = []+ await Promise.all(+ selectedContextRefs.map(async contextRef => {+ try {+ const context = await getContext(contextRef)+ const existingServers = context.spec?.mcpServers ?? []++ if (!existingServers.includes(name)) {+ await updateContext(+ contextRef,+ buildContextUpdatePayload(context.metadata?.resourceVersion, {+ contextId: context.spec?.contextId ?? contextRef,+ description: context.spec?.description,+ mcpServers: [...existingServers, name],+ sharedFileSystems: context.spec?.sharedFileSystems ?? [],+ })+ )+ }+ } catch {+ const affected = selectedTargets+ .filter(target => target.contextRef === contextRef)+ .map(target => target.label)+ failedAgents.push(...affected)+ }+ })+ )++ if (failedAgents.length > 0) {setError(- `Connector created, but failed to add it to Context "${contextRef}" allowlist. ` +- `Please add "${name}" to the Context manually. (${- contextError instanceof Error ? contextError.message : String(contextError)- })`+ `Connector created, but we couldn't give access to ${failedAgents.join(', ')}. ` ++ `Grant "${name}" to those agents from the Installed Connectors list.`)setSubmitting(false)returndiff --cc control-ui/components/__tests__/CreateMcpServerForm.test.tsxindex f4d21a497,ed82878f0..5caf974a2--- a/control-ui/components/__tests__/CreateMcpServerForm.test.tsx+++ b/control-ui/components/__tests__/CreateMcpServerForm.test.tsx@@@ -6,31 -6,21 +6,31 @@@ import { CreateMcpServerForm } from '..import { ToastProvider } from '../Toast'// vi.mock is hoisted before imports; factory runs lazily so references to `api` are safe.-vi.mock('../../lib/api', async () => {+vi.mock('../../lib/api', async importOriginal => {+ const actual = await importOriginal<typeof import('../../lib/api')>()- const { buildContextList, buildContextResource } =- await import('../../test/fixtures/contextResource')+ const { buildContextResource } = await import('../../test/fixtures/contextResource')const context1 = buildContextResource({metadata: { name: 'context1', resourceVersion: 'rv-context1' },})return {++ // Spread the real module so helpers the form imports directly (e.g.++ // getMcpSecretRollbackRepairIdentity) keep their real behaviour; every++ // network-touching export below is then overridden explicitly.+ ...actual,+ apiSend: vi.fn().mockResolvedValue({}),createMcpServer: vi.fn().mockResolvedValue({ metadata: { name: 'test-server' } }),- createMcpSecret: vi.fn().mockResolvedValue({ name: 'test-credentials' }),+ createMcpSecret: vi.fn().mockResolvedValue({+ name: 'test-credentials',+ namespace: 'mcp-server',+ uid: 'uid-test-credentials',+ resourceVersion: '1',+ }),deleteMcpSecret: vi.fn().mockResolvedValue({ name: 'test-credentials' }),- getContexts: vi.fn().mockResolvedValue(- buildContextList([- context1,- buildContextResource({- metadata: { name: 'research', resourceVersion: 'rv-research' },- }),- ])- ),+ deleteMcpServer: vi.fn().mockResolvedValue({ name: 'test-server' }),+ getAgentTeams: vi.fn().mockResolvedValue({ items: [] }),+ getAgentUsers: vi.fn().mockResolvedValue({ items: [] }),+ // The form no longer reads the context list; kept as a spy to lock that contract.+ getContexts: vi.fn(),getContext: vi.fn().mockResolvedValue(context1),getContextTeams: vi.fn().mockResolvedValue({ items: [] }),getContextUsers: vi.fn().mockResolvedValue({ items: [] }),diff --cc control-ui/e2e/qa-recorder-connector-edit.spec.tsindex 51b40a404,69637c878..c43aecb16--- a/control-ui/e2e/qa-recorder-connector-edit.spec.ts+++ b/control-ui/e2e/qa-recorder-connector-edit.spec.ts@@@ -1,11 -1,12 +1,13 @@@// control-ui/e2e/qa-recorder-connector-edit.spec.ts//- // MUTATING journey: creates a context + stdio discovery connector (reusing the- // spec-2 creation flow inline), then edits the connector to add external CIDR- // egress. Guarded by QA_RECORDER_CONFIRM_MUTATIONS; connector then context are- // deleted via the Control API in a finally.+ // MUTATING journey: stages a context through the Control API, creates a stdio+ // discovery connector through the create-connector wizard (which also+ // provisions the connector's own private access scope), then edits the+ // connector to add external CIDR egress. Guarded by+ // QA_RECORDER_CONFIRM_MUTATIONS; the connector and both contexts are deleted+ // via the Control API in a finally.import { type Page, expect, test } from '@playwright/test'+import { type SecretIdentity, requireSecretIdentity } from '../test-utils/secretIdentity'import {CONTROL_API_URL,CONTROL_UI_URL,@@@ -25,48 -25,32 +27,35 @@@// or non-existent image would never converge, only time out.const MOCK_MCP_IMAGE = process.env.TEST_MOCK_MCP_IMAGE ?? 'clerum/mock-mcp-server:test'-// The connector-form selects are not label-associated (no htmlFor/id), so scope-// to the wrapping `.cu-field` by its visible label text and drive its <select>.+// The connector-form's Transport Type and Managed selects are not label-associated,+// so use their visible field label as the stable local scope for those controls.async function fieldSelect(page: Page, fieldLabelText: string, value: string): Promise<void> {- const field = page.locator('.cu-field', { hasText: fieldLabelText }).first()- await field.locator('select').selectOption(value)+ await page+ .getByText(fieldLabelText, { exact: true })+ .locator('..')+ .getByRole('combobox')+ .selectOption(value)}+ // The /contexts UI is gone; stage the context out-of-band through the Control+ // API (same pattern as the rotation test below).async function createEmptyContext(page: Page, contextName: string): Promise<void> {- await page.getByRole('link', { name: 'Contexts', exact: true }).click()- await expect(page).toHaveURL(/\/contexts$/, { timeout: 20_000 })- await page.getByRole('button', { name: 'Create context', exact: true }).click()- await expect(page).toHaveURL(/\/contexts\/new$/, { timeout: 20_000 })- await page.getByLabel('Context name').fill(contextName)- await page- .getByPlaceholder('Human-readable context description')- .fill('QA recorder temporary context')- await page.getByRole('button', { name: 'Continue', exact: true }).click()- await expect(- page- .getByText('No connectors found.', { exact: true })- .or(page.getByPlaceholder('Search connectors...'))- ).toBeVisible({ timeout: 20_000 })- await page.getByRole('button', { name: 'Create context', exact: true }).click()- await expect(page).toHaveURL(new RegExp(`/contexts/${contextName}$`), { timeout: 20_000 })- await expect(- page.getByText('Review details, manage connectors, agents, teams, and members.', {- exact: true,- })- ).toBeVisible({ timeout: 20_000 })+ const res = await api(page.request, 'POST', '/api/v1/admin/contexts', {+ metadata: { name: contextName },+ spec: {+ contextId: contextName,+ description: 'QA recorder temporary context',+ mcpServers: [],+ },+ })+ expect(res.status, `create context: ${JSON.stringify(res.data)}`).toBeLessThan(300)}- async function createDiscoveryConnector(- page: Page,- connectorName: string,- contextName: string- ): Promise<void> {+ async function createDiscoveryConnector(page: Page, connectorName: string): Promise<void> {await page.getByRole('link', { name: 'Installed Connectors', exact: true }).click()await expect(page).toHaveURL(/\/connectors$/, { timeout: 20_000 })- await page.getByRole('button', { name: 'Connector actions', exact: true }).click()+ // Creation lives behind the "Connector actions" kebab (lowercase c menuitem).+ await page.getByRole('button', { name: 'Connector actions' }).click()await page.getByRole('menuitem', { name: 'Create connector', exact: true }).click()await expect(page).toHaveURL(/\/connectors\/new$/, { timeout: 20_000 })@@@ -134,9 -108,22 +121,22 @@@ test.describe('optional QA recorder: Coawait loginThroughUi(page, credentials)await createEmptyContext(page, contextName)- await createDiscoveryConnector(page, connectorName, contextName)+ await createDiscoveryConnector(page, connectorName)++ // The wizard provisions the connector's private access scope out of+ // band; capture its name so the finally can tear it down too.+ const createdRes = await api(+ page.request,+ 'GET',+ `/api/v1/admin/mcp-servers/${encodeURIComponent(connectorName)}`+ )+ expect(createdRes.status, `read connector: ${JSON.stringify(createdRes.data)}`).toBe(200)+ connectorContextName = String(+ (createdRes.data.spec as { contextRef?: string } | undefined)?.contextRef || ''+ )+ expect(connectorContextName).toMatch(new RegExp(`^${connectorName}-[0-9]{5}$`))- await page.goto(`${CONTROL_UI_URL}/connectors/${encodeURIComponent(connectorName)}/edit`)+ await openConnectorEditor(page, connectorName)await expect(page.getByRole('heading', { name: `Edit Connector: ${connectorName}`, exact: true })).toBeVisible({ timeout: 20_000 })@@@ -155,17 -161,22 +174,18 @@@const meta = page.locator('.cu-connector-edit-meta')await expect(meta).toBeVisible({ timeout: 20_000 })await expect(meta.getByText('qa-recorder/example:dev')).toBeVisible()- await expect(meta.getByText(contextName)).toBeVisible()+ // The private scope slug must NOT surface anywhere on this page.+ await expect(meta.getByText(connectorContextName)).toHaveCount(0)+ // The connector starts closed, so the following persistence check proves a+ // real edit rather than re-reading setup data.+ await expect(page.getByLabel('Egress mode')).toHaveValue('none')+// External Egress: switch to exact-CIDR mode and add one public CIDR + port.// 8.8.8.8/32 is a valid public target; the model rejects private/doc ranges.- await fieldSelect(page, 'Egress mode', 'exact-cidr')- await page- .locator('.cu-field', { hasText: 'Allowed CIDRs/IPs' })- .first()- .locator('textarea')- .fill('8.8.8.8/32')- await page- .locator('.cu-field', { hasText: 'Allowed ports' })- .first()- .locator('input')- .fill('443')+ await page.getByLabel('Egress mode').selectOption('exact-cidr')+ await page.getByLabel('Allowed CIDRs/IPs').fill('8.8.8.8/32')+ await page.getByLabel('Allowed ports').fill('443')await page.getByRole('button', { name: 'Save egress', exact: true }).click()await expect(@@@ -280,13 -275,12 +303,17 @@@).toBeVisible({ timeout: 20_000 })// The connector edit screen is split into tabs; the rotation flow lives- // on the Credentials tab — navigate there via the tab link.+ // on the Credentials tab — navigate there via the visible tab.await page.getByRole('tab', { name: 'Credentials', exact: true }).click()+ await expect(page).toHaveURL(+ new RegExp(`/connectors/${encodeURIComponent(connectorName)}/edit(/credentials)?$`),+ { timeout: 20_000 }+ )+ await expect(+ page.getByRole('heading', { name: 'Update credentials', exact: true })+ ).toBeVisible({+ timeout: 20_000,+ })// The section names the Secret and the key -> env var mapping — names// only, never the stored value.diff --cc control-ui/e2e/registry-install.spec.tsindex dc21c07a3,7239ee48b..005adacea--- a/control-ui/e2e/registry-install.spec.ts+++ b/control-ui/e2e/registry-install.spec.ts@@@ -553,12 -553,9 +553,9 @@@ async function submitRegistryInstallForawait installForm.locator('#ri-name').clear()await installForm.locator('#ri-name').fill(serverName)await installForm.getByRole('button', { name: 'Continue' }).click()- await installForm.locator('#ri-context').click()- await installForm.getByRole('option', { name: 'context1', exact: true }).click()- await installForm.getByRole('button', { name: 'Continue' }).click()const credentialInputs = installForm.locator('fieldset input')- for (let i = 0; i < (await credentialInputs.count()); i += 1) {- await credentialInputs.nth(i).fill('e2e-test-value')+ for (const credentialInput of await credentialInputs.all()) {+ await credentialInput.fill('e2e-test-value')}await installForm.getByRole('button', { name: 'Continue' }).click()await expect(@@@ -1776,18 -1766,11 +1771,13 @@@ test.describe('J. Operator Egress Editoawait page.getByPlaceholder('us-central1-docker.pkg.dev/my-project/repo/mcp-server:latest').fill('clerum/mock-mcp-server:test')- await expect(page.getByRole('button', { name: 'context1' })).toBeVisible({- timeout: 15_000,- })- await page.getByRole('button', { name: 'Continue' }).click()- await expect(page.getByRole('heading', { name: 'Runtime settings' })).toBeVisible()- await page.getByRole('button', { name: 'Continue' }).click()- await expect(page.getByRole('heading', { name: 'Network egress' })).toBeVisible()+ // Egress lives in the Advanced options disclosure on the Connector step.+ await page.getByText('Advanced options').click()const egressSection = page.locator('section', { hasText: 'External Egress' })- await egressSection.locator('select').first().selectOption('exact-host')+ const exactHostMode = egressSection.getByRole('combobox')+ await expect(exactHostMode).toHaveCount(1)+ await exactHostMode.selectOption('exact-host')await egressSection.locator('textarea[placeholder="api.example.com, auth.example.com"]').fill('api.github.com')@@@ -1835,18 -1823,11 +1830,13 @@@await page.getByPlaceholder('us-central1-docker.pkg.dev/my-project/repo/mcp-server:latest').fill('clerum/mock-mcp-server:test')- await expect(page.getByRole('button', { name: 'context1' })).toBeVisible({- timeout: 15_000,- })- await page.getByRole('button', { name: 'Continue' }).click()- await expect(page.getByRole('heading', { name: 'Runtime settings' })).toBeVisible()- await page.getByRole('button', { name: 'Continue' }).click()- await expect(page.getByRole('heading', { name: 'Network egress' })).toBeVisible()+ // Egress lives in the Advanced options disclosure on the Connector step.+ await page.getByText('Advanced options').click()const egressSection = page.locator('section', { hasText: 'External Egress' })- await egressSection.locator('select').first().selectOption('public-web')+ const publicWebMode = egressSection.getByRole('combobox')+ await expect(publicWebMode).toHaveCount(1)+ await publicWebMode.selectOption('public-web')await expect(egressSection.getByRole('alert')).toContainText('Public web egress allows')await expect(egressSection.getByRole('status')).toContainText('1 public-web binding')diff --cc deploy/scripts/control-api-runtime-access-profiles.tsvindex 6a1d61f75,07c4f9c27..62512b3cd--- a/deploy/scripts/control-api-runtime-access-profiles.tsv+++ b/deploy/scripts/control-api-runtime-access-profiles.tsv@@@ -33,8 -36,9 +36,10 @@@ llm_allowed_models legacy_dmllm_allowed_models_audit appendllm_catalog_sync_runs appendllm_model_prices legacy_dml+ llm_provider_attempt_tickets upsert+ llm_provider_attempts upsertmember_registration_credentials upsert+mcp_secret_rollback_permits legacy_dmlnotification_deliveries legacy_dmloauth_grants legacy_dmlplugin_workload_sdk_credential_ticket_jtis legacy_dmldiff --cc docs/how-to/control-api-mcp-secret-rollback-permits.mdindex 109d157c7,000000000..683ee08ccmode 100644,000000..100644--- a/docs/how-to/control-api-mcp-secret-rollback-permits.md+++ b/docs/how-to/control-api-mcp-secret-rollback-permits.md@@@ -1,65 -1,0 +1,65 @@@+# Control API MCP Secret rollback permits++This runbook covers the short-lived PostgreSQL permits used only by the legacy+bodyless rollback path of `POST /admin/mcp-secrets` followed by+`DELETE /admin/mcp-secrets/:name`.++## Deployment contract++1. Run the Control API schema migration job before changing the pod image.- 2. Verify migration `0101_mcp_secret_rollback_permits` and the runtime-access++2. Verify migration `0109_mcp_secret_rollback_permits` and the runtime-access+ profile before starting Control API.+3. Deploy Control API with its repository-owned `Recreate` strategy and one+ replica. Old and new API writers must not overlap.+4. Verify a current client can create and explicitly delete with+ UID/resourceVersion, and that a bodyless legacy rollback consumes a+ server-side permit.++The migration is additive and forward-only. It creates no foreign keys and+does not alter existing rows or tables.++## Runtime invariants++- The browser receives no rollback proof or nonce cookie.+- PostgreSQL stores a domain-separated SHA-256 digest of the admin session JTI,+ never the raw JTI.+- Permits bind namespace, name, UID, and resourceVersion and expire after at+ most 120 seconds according to the PostgreSQL clock.+- A 15-second claim lease serializes replicas. Transient failures release the+ claim; a crashed process becomes retryable after the lease expires.+- Terminal absence or identity change finalizes the permit. Kubernetes deletion+ always carries UID and resourceVersion preconditions.+- Expired rows are authorization-inert even before bounded physical cleanup.++## Image rollback after migration 0101++Rollback is **image-only**:++1. Keep migration `0101`, the new table, and the current runtime-access profile.+2. Use the current checkout's deployment and database-migration tooling.+3. Change only the Control API image to the previously verified image.+4. Re-run the current runtime-access reconciliation and exact privilege check.++The previous Control API binary ignores the additive table. Do not run an old+checkout's exact-schema verifier after `0101`; it does not know the new public+relation and will correctly refuse to certify it. Never drop the table as part+of an application-image rollback.++## Failure outcomes++- Permit persistence failure after Kubernetes create: `503 repair_required`+ includes the created UID/resourceVersion so the current UI can perform an+ explicit CAS cleanup. The API never deletes by name as compensation.+- Missing, expired, already claimed, or wrong-session permit: `428` and no+ Kubernetes read or mutation.+- PostgreSQL claim failure: `503 repair_required` and no Kubernetes read or+ mutation.+- Live identity change or Kubernetes CAS conflict: `409 repair_required`.+- Reference graph unavailable: `503 repair_required`; the claim is released so+ the legacy caller can retry within the original 120-second permit window.++## Re-open triggers++Re-audit this design if Control API changes from one replica plus `Recreate`,+the permit or claim TTL changes, a caller can bypass admin-session binding, or+any delete path stops carrying both UID and resourceVersion.diff --cc scripts/tests/test-control-api-runtime-access-contract.shindex df2986cb3,89dfb3238..6545e77c3--- a/scripts/tests/test-control-api-runtime-access-contract.sh+++ b/scripts/tests/test-control-api-runtime-access-contract.sh@@@ -9,7 -9,7 +9,7 @@@ relation_count="$(awk -F '\t' '!/^[[:spduplicate_count="$(awk -F '\t' '!/^[[:space:]]*(#|$)/ { seen[$1]++ } END { for (name in seen) if (seen[name] > 1) count++ } END { print count + 0 }' "$PROFILE_FILE")"invalid_count="$(awk -F '\t' '!/^[[:space:]]*(#|$)/ && (NF != 2 || $1 !~ /^[a-z][a-z0-9_]*$/ || $2 !~ /^(legacy_dml|upsert|append|read|link_lifecycle|none)$/) { count++ } END { print count + 0 }' "$PROFILE_FILE")"- [[ "$relation_count" == "85" ]]-[[ "$relation_count" == "88" ]]++[[ "$relation_count" == "90" ]][[ "$duplicate_count" == "0" ]][[ "$invalid_count" == "0" ]]grep -qx $'gfs_desktop_operator_links\tlink_lifecycle' "$PROFILE_FILE"diff --cc scripts/tests/test-gcp-scripts.shindex 9ec3173e6,2aa971418..31111c09a--- a/scripts/tests/test-gcp-scripts.sh+++ b/scripts/tests/test-gcp-scripts.sh@@@ -1466,7 -1466,7 +1466,7 @@@ assert_control_api_runtime_access_contrsequence_duplicate_count="$(awk -F '\t' '!/^[[:space:]]*(#|$)/ { seen[$1]++ } END { for (name in seen) if (seen[name] > 1) count++ } END { print count + 0 }' "$sequence_profile_file")"sequence_invalid_count="$(awk -F '\t' '!/^[[:space:]]*(#|$)/ && (NF != 2 || $1 !~ /^[a-z][a-z0-9_]*$/ || $2 !~ /^(legacy_rw|consume)$/) { count++ } END { print count + 0 }' "$sequence_profile_file")"- if [[ "$relation_count" == "85" && "$duplicate_count" == "0" && "$invalid_count" == "0" ]] && \- if [[ "$relation_count" == "88" && "$duplicate_count" == "0" && "$invalid_count" == "0" ]] && \++ if [[ "$relation_count" == "90" && "$duplicate_count" == "0" && "$invalid_count" == "0" ]] && \grep -qx $'gfs_upload_parts\tnone' "$profile_file" && \grep -qx $'gfs_upload_sessions\tnone' "$profile_file" && \grep -qx $'llm_allowed_models\tlegacy_dml' "$profile_file" && \