Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

feat: several visual changes

Miguelon Peluchon76edf786996d
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index 447729271..0b0c8eabf 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -322,6 +322,12 @@ body.cu-body {
max-width: min(28rem, 100%);
}
+/* Detail-page forms that need more room for their selects and embedded cards
+ (agent Models & creds). */
+.cu-form-stack--wide {
+ max-width: min(35rem, 100%);
+}
+
.cu-connector-credentials-form {
display: grid;
gap: var(--cu-space-3);
@@ -1810,6 +1816,10 @@ textarea.cu-input {
margin: 0;
}
+.cu-tabs--nested {
+ margin-top: var(--cu-space-4);
+}
+
.cu-tabs--tight {
margin: 0 0 1rem;
}
@@ -6633,8 +6643,14 @@ textarea.cu-input {
line-height: 1.25;
}
-.cu-agent-select__providers-label {
- margin-right: 0.1rem;
+.cu-agent-select__group {
+ display: block;
+ padding: var(--cu-space-2) 0.65rem var(--cu-space-05);
+ color: var(--cu-text-muted);
+ font-size: var(--cu-font-size-2xs);
+ font-weight: var(--cu-font-weight-bold);
+ letter-spacing: 0.05em;
+ text-transform: uppercase;
}
.cu-agent-select__provider {
@@ -8509,19 +8525,9 @@ textarea.cu-input {
}
/* OpenAI ships a white-on-transparent mark, so on light surfaces it needs to be
- knocked back to black. Scoped to provider-level controls — the model dropdown
- reuses the same icon on a different treatment and must not inherit this. */
+ knocked back to black — provider pickers, credential dropdowns, model
+ dropdowns, chips, and filters all sit on light surfaces in this theme. */
:root[data-theme='light']
- :is(
- .cu-llm-config__provider-select,
- .cu-llm-cred-add,
- .cu-llm-model-group__toggle,
- .cu-filter-select__copy,
- .cu-filter-select__icon,
- .cu-chip,
- .cu-px-provider,
-
- )
.cu-llm-provider-icon:is([data-provider='openai'], [data-provider='codex-subscription'])
img {
filter: brightness(0);
diff --git a/control-ui/app/hosts/[name]/page.tsx b/control-ui/app/hosts/[name]/page.tsx
index dd27c2f9f..3ea5644ba 100644
--- a/control-ui/app/hosts/[name]/page.tsx
+++ b/control-ui/app/hosts/[name]/page.tsx
@@ -86,15 +86,6 @@ function parseHostTab(value: string | undefined): HostTab {
return HOST_TABS.find(tab => TAB_SLUGS[tab] === value) ?? HOST_DEFAULT_TAB
}
-// Cron×stateless: map the machine-readable suspend-blocked reason to
-// operator-friendly text. Every other reason renders verbatim.
-function friendlyLifecycleReason(reason: string): string {
- if (reason === 'SuspendBlocked: activeCronSchedules') {
- return 'Not suspending: active scheduled tasks keep this agent awake'
- }
- return reason
-}
-
function contextResourceName(context: ContextResource | null): string {
return String(context?.metadata?.name || context?.spec?.contextId || '').trim()
}
@@ -280,11 +271,6 @@ export default function HostDetailsPage() {
memberNames: string[]
teamNames: string[]
}>({ memberCount: 0, teamCount: 0, memberNames: [], teamNames: [] })
- const [statelessDraft, setStatelessDraft] = useState(false)
- const [savedStateless, setSavedStateless] = useState(false)
- const [lifecycleState, setLifecycleState] = useState('')
- const [lifecycleReason, setLifecycleReason] = useState('')
- const [statelessRejectionMessage, setStatelessRejectionMessage] = useState('')
const providerModelOptions = useMemo(
() => getModelOptions(catalogForEditor, providerDraft),
@@ -433,7 +419,6 @@ export default function HostDetailsPage() {
hostDisplay: String(spec.host || host.metadata?.name || routeName),
contextRef: String(spec.contextRef || ''),
channels: Array.isArray(spec.channels) ? spec.channels.map(String).filter(Boolean) : [],
- stateless: spec.lifecycle?.stateless === true,
}
setHostNameDraft(overview.hostName)
setHostDisplayDraft(overview.hostDisplay)
@@ -442,7 +427,6 @@ export default function HostDetailsPage() {
setHostDescription(String(spec.description || '').trim())
setContextRefDraft(overview.contextRef)
setChannelsDraft(overview.channels)
- setStatelessDraft(overview.stateless)
// Overview read-only summary: linked context's MCP servers + access counts.
const ref = overview.contextRef.trim()
const matched = (contextsList || []).find(
@@ -525,22 +509,6 @@ export default function HostDetailsPage() {
setGuardrailsData(
rawGuardrails && typeof rawGuardrails === 'object' ? rawGuardrails : undefined
)
- const specStateless = spec.lifecycle?.stateless === true
- setSavedStateless(specStateless)
- setLifecycleState(String(host.status?.lifecycle?.state ?? ''))
- setLifecycleReason(String(host.status?.lifecycle?.reason ?? ''))
- const rejection = (host.status?.conditions ?? []).find(
- condition => condition.type === 'StatelessEnableRejected' && condition.status === 'True'
- )
- setStatelessRejectionMessage(
- rejection
- ? String(
- rejection.message ||
- rejection.reason ||
- 'Stateless mode was rejected by the platform.'
- )
- : ''
- )
// Map each Secret to its data-key NAMES (never values), already carried by
// the detail bundle. Feeds the fallback credentialSlot dropdown's extra
@@ -667,6 +635,7 @@ export default function HostDetailsPage() {
const toOption = (name: string, keys: string[]): LlmSecretSelectOption => {
const providers = getProvidersWithCompleteCredentials(keys)
return {
+ group: 'API keys',
value: name,
label: name,
meta:
@@ -692,7 +661,7 @@ export default function HostDetailsPage() {
value: credentialSelectValue('', row.connectionKey),
label: row.displayName || row.connectionKey,
meta: 'ChatGPT subscription',
- providers: [{ id: 'codex-subscription', label: 'ChatGPT' }],
+ providers: [{ id: 'codex-subscription', label: 'ChatGPT Subscription' }],
})
}
if (
@@ -707,7 +676,7 @@ export default function HostDetailsPage() {
value: credentialSelectValue('', connectionRefDraft),
label: `${connectionRefDraft} (unavailable)`,
meta: 'ChatGPT subscription',
- providers: [{ id: 'codex-subscription', label: 'ChatGPT' }],
+ providers: [{ id: 'codex-subscription', label: 'ChatGPT Subscription' }],
})
}
return options
@@ -752,10 +721,7 @@ export default function HostDetailsPage() {
[availableConnectorNames, contextMcpServers]
)
- async function saveHost(
- nextDisplayName = hostDisplayDraft,
- nextStateless = statelessDraft
- ): Promise<boolean> {
+ async function saveHost(nextDisplayName = hostDisplayDraft): Promise<boolean> {
const nextHostName = hostNameDraft.trim()
if (!nextHostName) return false
@@ -765,23 +731,18 @@ export default function HostDetailsPage() {
// Re-fetch to preserve fields that aren't editable in this form. K8s
// replaceNamespacedCustomObject is a full replace, not a merge.
const currentHost = await getHost(routeName)
- const currentLifecycle = currentHost.spec?.lifecycle
const currentWorkflowControl = currentHost.spec?.workflowControl
// Overview owns only identity/shape fields (name, display, context,
- // channels, lifecycle). Model, secret, fallback policy and the per-host
+ // channels). Model, secret, fallback policy and the per-host
// model allowlist are owned by the "Model & credentials" tab and are
// preserved here via the `...currentHost.spec` spread (full-replace
- // semantics — omitting them is what keeps them intact).
+ // semantics — omitting them is what keeps them intact). spec.lifecycle
+ // is not editable here and passes through the spread unchanged.
const nextSpec: Record<string, unknown> = {
...currentHost.spec,
host: nextDisplayName.trim() || nextHostName,
contextRef: contextRefDraft.trim(),
channels: channelsDraft,
- // Echo spec.lifecycle explicitly: the admin facade full-replaces the
- // spec, so leaving lifecycle implicit would strip the stateless flag.
- ...(nextStateless || currentLifecycle
- ? { lifecycle: { ...currentLifecycle, stateless: nextStateless } }
- : {}),
...(channelsDraft.length > 0 && currentWorkflowControl === undefined
? { workflowControl: { scopes: [...FIRST_PARTY_CHANNEL_WORKFLOW_CONTROL_SCOPES] } }
: {}),
@@ -1131,17 +1092,9 @@ export default function HostDetailsPage() {
modelProviderLine={
modelNameDraft ? `${getProviderLabel(providerDraft)} · ${modelNameDraft}` : ''
}
- stateless={statelessDraft}
- lifecycleState={lifecycleState}
- lifecycleReason={friendlyLifecycleReason(lifecycleReason)}
- statelessRejectionMessage={statelessRejectionMessage}
accessSummary={accessSummary}
onNavigate={tab => selectTab(tab)}
onSaveDisplayName={nextDisplayName => saveHost(nextDisplayName)}
- onSaveLifecycle={nextStateless => {
- setStatelessDraft(nextStateless)
- return saveHost(hostDisplaySaved, nextStateless)
- }}
createdAt={hostCreatedAt}
/>
)}
@@ -1170,7 +1123,7 @@ export default function HostDetailsPage() {
</div>
</div>
- <div className="cu-form-stack">
+ <div className="cu-form-stack cu-form-stack--wide">
<div className="cu-field">
<label htmlFor="model-secret">{credentialFieldLabel}</label>
<div className="cu-llm-secret-control">
diff --git a/control-ui/components/HostOverviewTab/index.tsx b/control-ui/components/HostOverviewTab/index.tsx
index 5ecee1de4..73c17a31b 100644
--- a/control-ui/components/HostOverviewTab/index.tsx
+++ b/control-ui/components/HostOverviewTab/index.tsx
@@ -90,10 +90,6 @@ export function HostOverviewTab({
contextMcpTotal,
modelPrimary,
modelProviderLine,
- stateless,
- lifecycleState,
- lifecycleReason,
- statelessRejectionMessage,
accessSummary,
editingName,
nameDraft,
@@ -101,23 +97,15 @@ export function HostOverviewTab({
onNameDraftChange,
onNavigate,
onSaveDisplayName,
- onSaveLifecycle,
onStartNameEdit,
createdAt,
}: HostOverviewTabProps) {
const shownName = displayName.trim() || hostName
const [savingName, setSavingName] = React.useState(false)
- const [editingLifecycle, setEditingLifecycle] = React.useState(false)
- const [lifecycleDraft, setLifecycleDraft] = React.useState(stateless)
- const [savingLifecycle, setSavingLifecycle] = React.useState(false)
const hasContext = Boolean(contextRef.trim())
const trimmedDescription = description.trim()
const shownDescription = truncateDescription(trimmedDescription) || 'No description provided.'
- React.useEffect(() => {
- if (!editingLifecycle) setLifecycleDraft(stateless)
- }, [editingLifecycle, stateless])
-
async function saveName() {
const nextName = nameDraft.trim()
if (!nextName || savingName) return
@@ -130,316 +118,207 @@ export function HostOverviewTab({
}
}
- async function saveLifecycle() {
- if (savingLifecycle) return
-
- setSavingLifecycle(true)
- try {
- if (await onSaveLifecycle(lifecycleDraft)) setEditingLifecycle(false)
- } finally {
- setSavingLifecycle(false)
- }
- }
-
- function cancelLifecycleEdit() {
- setLifecycleDraft(stateless)
- setEditingLifecycle(false)
- }
-
return (
- <>
- {statelessRejectionMessage ? (
- <div className="cu-banner cu-banner--warning" style={{ marginBottom: '1rem' }}>
- <strong>Stateless mode rejected:</strong> {statelessRejectionMessage}
- </div>
- ) : null}
- <div className="cu-host-overview">
- <section className="cu-host-overview-identity" aria-label="Agent identity">
- <div className="cu-host-overview-identity__name-row">
- {editingName ? (
- <div className="cu-host-overview-identity__name-editor">
+ <div className="cu-host-overview">
+ <section className="cu-host-overview-identity" aria-label="Agent identity">
+ <div className="cu-host-overview-identity__name-row">
+ {editingName ? (
+ <div className="cu-host-overview-identity__name-editor">
+ <span className="cu-host-overview-identity__icon" aria-hidden="true">
+ <IconRobot />
+ </span>
+ <input
+ className="cu-input cu-host-overview-identity__name-input"
+ value={nameDraft}
+ onChange={event => onNameDraftChange(event.target.value)}
+ onKeyDown={event => {
+ if (event.key === 'Enter') void saveName()
+ if (event.key === 'Escape') onCancelNameEdit()
+ }}
+ aria-label="Agent name"
+ disabled={savingName}
+ autoFocus
+ />
+ <button
+ type="button"
+ className="cu-btn cu-btn--icon cu-btn--toolbar"
+ onClick={() => void saveName()}
+ disabled={savingName || !nameDraft.trim()}
+ aria-label="Save agent name"
+ title="Save agent name"
+ >
+ <IconCheck width={16} height={16} />
+ </button>
+ <button
+ type="button"
+ className="cu-btn cu-btn--icon cu-btn--ghost"
+ onClick={onCancelNameEdit}
+ disabled={savingName}
+ aria-label="Cancel editing agent name"
+ title="Cancel editing agent name"
+ >
+ <IconX width={16} height={16} />
+ </button>
+ </div>
+ ) : (
+ <>
+ <div className="cu-host-overview-identity__name">
<span className="cu-host-overview-identity__icon" aria-hidden="true">
<IconRobot />
</span>
- <input
- className="cu-input cu-host-overview-identity__name-input"
- value={nameDraft}
- onChange={event => onNameDraftChange(event.target.value)}
- onKeyDown={event => {
- if (event.key === 'Enter') void saveName()
- if (event.key === 'Escape') onCancelNameEdit()
- }}
- aria-label="Agent name"
- disabled={savingName}
- autoFocus
- />
- <button
- type="button"
- className="cu-btn cu-btn--icon cu-btn--toolbar"
- onClick={() => void saveName()}
- disabled={savingName || !nameDraft.trim()}
- aria-label="Save agent name"
- title="Save agent name"
- >
- <IconCheck width={16} height={16} />
- </button>
- <button
- type="button"
- className="cu-btn cu-btn--icon cu-btn--ghost"
- onClick={onCancelNameEdit}
- disabled={savingName}
- aria-label="Cancel editing agent name"
- title="Cancel editing agent name"
- >
- <IconX width={16} height={16} />
- </button>
+ {shownName}
</div>
- ) : (
- <>
- <div className="cu-host-overview-identity__name">
- <span className="cu-host-overview-identity__icon" aria-hidden="true">
- <IconRobot />
- </span>
- {shownName}
- </div>
- <button
- type="button"
- className="cu-btn cu-btn--icon cu-btn--ghost cu-host-overview-identity__edit"
- onClick={onStartNameEdit}
- disabled={savingName}
- aria-label="Edit agent name"
- title="Edit agent name"
- >
- <IconPencil width={16} height={16} />
- </button>
- </>
- )}
- </div>
- <div
- className="cu-host-overview-identity__description"
- title={trimmedDescription || undefined}
- >
- {shownDescription}
- </div>
- <div className="cu-host-overview-identity__status">
- <StatusDot tone={statusTone} />
- <span>{statusLabel}</span>
- </div>
- {stateless && lifecycleState ? (
- <span className="cu-chip">
- {`Lifecycle: ${lifecycleState}${lifecycleReason ? ` — ${lifecycleReason}` : ''}`}
- </span>
- ) : null}
+ <button
+ type="button"
+ className="cu-btn cu-btn--icon cu-btn--ghost cu-host-overview-identity__edit"
+ onClick={onStartNameEdit}
+ disabled={savingName}
+ aria-label="Edit agent name"
+ title="Edit agent name"
+ >
+ <IconPencil width={16} height={16} />
+ </button>
+ </>
+ )}
+ </div>
+ <div
+ className="cu-host-overview-identity__description"
+ title={trimmedDescription || undefined}
+ >
+ {shownDescription}
+ </div>
+ <div className="cu-host-overview-identity__status">
+ <StatusDot tone={statusTone} />
+ <span>{statusLabel}</span>
+ </div>
- <div className="cu-host-overview-identity__divider" />
+ <div className="cu-host-overview-identity__divider" />
- <NavHeader label="Access" tab="access" onNavigate={onNavigate} />
- <div className="cu-host-overview-identity__counts">
- <div>
- <div className="cu-host-overview-identity__count-value">
- {accessSummary.memberCount}
- </div>
- <div className="cu-host-overview-identity__count-label">
- {accessSummary.memberCount === 1 ? 'member' : 'members'}
- </div>
+ <NavHeader label="Access" tab="access" onNavigate={onNavigate} />
+ <div className="cu-host-overview-identity__counts">
+ <div>
+ <div className="cu-host-overview-identity__count-value">
+ {accessSummary.memberCount}
</div>
- <div className="cu-host-overview-identity__count-sep" aria-hidden="true" />
- <div>
- <div className="cu-host-overview-identity__count-value">
- {accessSummary.teamCount}
- </div>
- <div className="cu-host-overview-identity__count-label">
- {accessSummary.teamCount === 1 ? 'team' : 'teams'}
- </div>
+ <div className="cu-host-overview-identity__count-label">
+ {accessSummary.memberCount === 1 ? 'member' : 'members'}
+ </div>
+ </div>
+ <div className="cu-host-overview-identity__count-sep" aria-hidden="true" />
+ <div>
+ <div className="cu-host-overview-identity__count-value">{accessSummary.teamCount}</div>
+ <div className="cu-host-overview-identity__count-label">
+ {accessSummary.teamCount === 1 ? 'team' : 'teams'}
</div>
</div>
+ </div>
- <div className="cu-host-overview-identity__divider" />
+ <div className="cu-host-overview-identity__divider" />
- <NavHeader label="Connectors" tab="connectors" onNavigate={onNavigate} />
- <div className="cu-host-overview-identity__counts">
- <div>
- <div className="cu-host-overview-identity__count-value">
- {contextMcpServers.length}
- </div>
- <div className="cu-host-overview-identity__count-label">
- {contextMcpServers.length === 1 ? 'connector' : 'connectors'}
- </div>
+ <NavHeader label="Connectors" tab="connectors" onNavigate={onNavigate} />
+ <div className="cu-host-overview-identity__counts">
+ <div>
+ <div className="cu-host-overview-identity__count-value">{contextMcpServers.length}</div>
+ <div className="cu-host-overview-identity__count-label">
+ {contextMcpServers.length === 1 ? 'connector' : 'connectors'}
</div>
</div>
+ </div>
- <div className="cu-host-overview-identity__divider" />
+ <div className="cu-host-overview-identity__divider" />
- <dl className="cu-host-overview-identity__meta">
- <dt>Created</dt>
- <dd>{formatTimestamp(createdAt) || '—'}</dd>
- </dl>
+ <dl className="cu-host-overview-identity__meta">
+ <dt>Created</dt>
+ <dd>{formatTimestamp(createdAt) || '—'}</dd>
+ </dl>
+ </section>
+
+ <div className="cu-host-overview-right">
+ <section className="cu-card" aria-label="Configuration">
+ <div className="cu-card__body">
+ <NavHeader label="Configuration" tab="model" onNavigate={onNavigate} />
+ <div className="cu-host-overview-config">
+ <ConfigRow setting="Primary model" value={modelPrimary} />
+ <ConfigRow setting="Provider · Model" value={modelProviderLine} />
+ </div>
+ </div>
</section>
- <div className="cu-host-overview-right">
- <section className="cu-card" aria-label="Lifecycle">
- <div className="cu-card__body">
- <div
- style={{
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'space-between',
- gap: '0.75rem',
- }}
- >
- <div>
- <h3 className="cu-section-title" style={{ margin: 0 }}>
- Lifecycle
- </h3>
- <p className="cu-muted" style={{ margin: '0.35rem 0 0', fontSize: '0.8125rem' }}>
- Choose whether this agent stays running or suspends when idle.
- </p>
+ <section className="cu-card" aria-label="Access summary">
+ <div className="cu-card__body">
+ <NavHeader label="Access" tab="access" onNavigate={onNavigate} />
+
+ <div className="cu-host-overview-access__columns">
+ <div className="cu-host-overview-access__group">
+ <div className="cu-host-overview-access__head">
+ <span className="cu-host-overview-access__head-label">Members</span>
+ <span className="cu-host-overview-access__head-count">
+ {accessSummary.memberCount}
+ </span>
</div>
- {!editingLifecycle ? (
- <button
- type="button"
- className="cu-btn cu-btn--ghost cu-btn--sm"
- onClick={() => {
- setLifecycleDraft(stateless)
- setEditingLifecycle(true)
- }}
- disabled={savingLifecycle}
- >
- Edit lifecycle
- </button>
- ) : null}
- </div>
- <div className="cu-field" style={{ marginTop: '1rem', marginBottom: 0 }}>
- <label htmlFor="host-agent-type">Type</label>
- {editingLifecycle ? (
- <>
- <select
- id="host-agent-type"
- value={lifecycleDraft ? 'stateless' : 'stateful'}
- onChange={event => setLifecycleDraft(event.target.value === 'stateless')}
- disabled={savingLifecycle}
- >
- <option value="stateful">Stateful (always on)</option>
- <option value="stateless">Stateless (suspends when idle)</option>
- </select>
- <span className="cu-field__hint">
- Stateless agents suspend after the idle window and wake on demand.
- Communication channels may keep them always-on.
- </span>
- <div className="cu-create-actions" style={{ marginTop: '0.75rem' }}>
- <button
- type="button"
- className="cu-btn cu-btn--ghost cu-btn--sm"
- onClick={cancelLifecycleEdit}
- disabled={savingLifecycle}
- >
- Cancel lifecycle
- </button>
- <button
- type="button"
- className="cu-btn cu-btn--primary"
- onClick={() => void saveLifecycle()}
- disabled={savingLifecycle}
- >
- {savingLifecycle ? 'Saving…' : 'Save lifecycle'}
- </button>
- </div>
- </>
+ {accessSummary.memberNames.length > 0 ? (
+ <ul className="cu-host-overview-access__people">
+ {accessSummary.memberNames.map(name => (
+ <li key={name} className="cu-host-overview-access__person">
+ <span className="cu-host-overview-access__dot" aria-hidden="true" />
+ <span className="cu-host-overview-access__person-name">{name}</span>
+ </li>
+ ))}
+ </ul>
) : (
- <div id="host-agent-type" className="cu-field__readonly">
- {stateless ? 'Stateless (suspends when idle)' : 'Stateful (always on)'}
- </div>
+ <p className="cu-host-overview-access__empty">No members yet.</p>
)}
</div>
- </div>
- </section>
-
- <section className="cu-card" aria-label="Configuration">
- <div className="cu-card__body">
- <NavHeader label="Configuration" tab="model" onNavigate={onNavigate} />
- <div className="cu-host-overview-config">
- <ConfigRow setting="Primary model" value={modelPrimary} />
- <ConfigRow setting="Provider · Model" value={modelProviderLine} />
- </div>
- </div>
- </section>
- <section className="cu-card" aria-label="Access summary">
- <div className="cu-card__body">
- <NavHeader label="Access" tab="access" onNavigate={onNavigate} />
-
- <div className="cu-host-overview-access__columns">
- <div className="cu-host-overview-access__group">
- <div className="cu-host-overview-access__head">
- <span className="cu-host-overview-access__head-label">Members</span>
- <span className="cu-host-overview-access__head-count">
- {accessSummary.memberCount}
- </span>
- </div>
- {accessSummary.memberNames.length > 0 ? (
- <ul className="cu-host-overview-access__people">
- {accessSummary.memberNames.map(name => (
- <li key={name} className="cu-host-overview-access__person">
- <span className="cu-host-overview-access__dot" aria-hidden="true" />
- <span className="cu-host-overview-access__person-name">{name}</span>
- </li>
- ))}
- </ul>
- ) : (
- <p className="cu-host-overview-access__empty">No members yet.</p>
- )}
- </div>
-
- <div className="cu-host-overview-access__group">
- <div className="cu-host-overview-access__head">
- <span className="cu-host-overview-access__head-label">Teams</span>
- <span className="cu-host-overview-access__head-count">
- {accessSummary.teamCount}
- </span>
- </div>
- {accessSummary.teamNames.length > 0 ? (
- <ul className="cu-host-overview-access__people">
- {accessSummary.teamNames.map(name => (
- <li key={name} className="cu-host-overview-access__person">
- <span className="cu-host-overview-access__dot" aria-hidden="true" />
- <span className="cu-host-overview-access__person-name">{name}</span>
- </li>
- ))}
- </ul>
- ) : (
- <p className="cu-host-overview-access__empty">No teams yet.</p>
- )}
+ <div className="cu-host-overview-access__group">
+ <div className="cu-host-overview-access__head">
+ <span className="cu-host-overview-access__head-label">Teams</span>
+ <span className="cu-host-overview-access__head-count">
+ {accessSummary.teamCount}
+ </span>
</div>
+ {accessSummary.teamNames.length > 0 ? (
+ <ul className="cu-host-overview-access__people">
+ {accessSummary.teamNames.map(name => (
+ <li key={name} className="cu-host-overview-access__person">
+ <span className="cu-host-overview-access__dot" aria-hidden="true" />
+ <span className="cu-host-overview-access__person-name">{name}</span>
+ </li>
+ ))}
+ </ul>
+ ) : (
+ <p className="cu-host-overview-access__empty">No teams yet.</p>
+ )}
</div>
</div>
- </section>
+ </div>
+ </section>
- <section className="cu-card" aria-label="Connectors">
- <div className="cu-card__body">
- <NavHeader
- label="Connectors"
- tab="connectors"
- count={contextMcpTotal}
- onNavigate={onNavigate}
- />
- {contextMcpServers.length > 0 ? (
- <ul className="cu-host-overview-mcp__list">
- {contextMcpServers.map(server => (
- <li key={server} className="cu-host-overview-mcp__chip" title={server}>
- <span className="cu-host-overview-mcp__dot" aria-hidden="true" />
- {server}
- </li>
- ))}
- </ul>
- ) : (
- <p className="cu-muted" style={{ margin: '0.5rem 0 0', fontSize: '0.875rem' }}>
- {hasContext ? 'No connectors attached.' : 'No connectors attached yet.'}
- </p>
- )}
- </div>
- </section>
- </div>
+ <section className="cu-card" aria-label="Connectors">
+ <div className="cu-card__body">
+ <NavHeader
+ label="Connectors"
+ tab="connectors"
+ count={contextMcpTotal}
+ onNavigate={onNavigate}
+ />
+ {contextMcpServers.length > 0 ? (
+ <ul className="cu-host-overview-mcp__list">
+ {contextMcpServers.map(server => (
+ <li key={server} className="cu-host-overview-mcp__chip" title={server}>
+ <span className="cu-host-overview-mcp__dot" aria-hidden="true" />
+ {server}
+ </li>
+ ))}
+ </ul>
+ ) : (
+ <p className="cu-muted" style={{ margin: '0.5rem 0 0', fontSize: '0.875rem' }}>
+ {hasContext ? 'No connectors attached.' : 'No connectors attached yet.'}
+ </p>
+ )}
+ </div>
+ </section>
</div>
- </>
+ </div>
)
}
diff --git a/control-ui/components/HostOverviewTab/types.ts b/control-ui/components/HostOverviewTab/types.ts
index 4ddfbb552..cd7d52b0c 100644
--- a/control-ui/components/HostOverviewTab/types.ts
+++ b/control-ui/components/HostOverviewTab/types.ts
@@ -18,10 +18,6 @@ export type HostOverviewTabProps = {
contextMcpTotal: number
modelPrimary: string
modelProviderLine: string
- stateless: boolean
- lifecycleState: string
- lifecycleReason: string
- statelessRejectionMessage: string
accessSummary: HostOverviewAccessSummary
editingName: boolean
nameDraft: string
@@ -29,7 +25,6 @@ export type HostOverviewTabProps = {
onNameDraftChange: (value: string) => void
onNavigate: (tab: HostTabKey) => void
onSaveDisplayName: (displayName: string) => Promise<boolean>
- onSaveLifecycle: (stateless: boolean) => Promise<boolean>
onStartNameEdit: () => void
createdAt: string
}
diff --git a/control-ui/components/HostWizard/index.tsx b/control-ui/components/HostWizard/index.tsx
index 44c24adad..da80b39e6 100644
--- a/control-ui/components/HostWizard/index.tsx
+++ b/control-ui/components/HostWizard/index.tsx
@@ -335,7 +335,7 @@ export function HostWizard({
value: credentialSelectValue('', row.connectionKey),
label: row.displayName || row.connectionKey,
meta: 'ChatGPT subscription',
- providers: [{ id: 'codex-subscription', label: 'ChatGPT' }],
+ providers: [{ id: 'codex-subscription', label: 'ChatGPT Subscription' }],
})),
],
[codexConnections, existingSecrets]
diff --git a/control-ui/components/LlmSecretSelect/index.tsx b/control-ui/components/LlmSecretSelect/index.tsx
index 663d2b393..ea5f8304c 100644
--- a/control-ui/components/LlmSecretSelect/index.tsx
+++ b/control-ui/components/LlmSecretSelect/index.tsx
@@ -16,7 +16,6 @@ function ProviderSummary({
return (
<span className="cu-agent-select__providers">
- <span className="cu-agent-select__providers-label">Providers: </span>
{providers.map((provider, index) => (
<Fragment key={provider.id}>
{index > 0 ? ', ' : null}
@@ -85,7 +84,7 @@ export function LlmSecretSelect({
options.map((option, index) => (
<Fragment key={option.value}>
{option.group && option.group !== options[index - 1]?.group ? (
- <span className="cu-agent-select__empty">{option.group}</span>
+ <span className="cu-agent-select__group">{option.group}</span>
) : null}
<button
type="button"
diff --git a/control-ui/components/LlmSecretsSubTabs/index.tsx b/control-ui/components/LlmSecretsSubTabs/index.tsx
index f84e590d5..17460be03 100644
--- a/control-ui/components/LlmSecretsSubTabs/index.tsx
+++ b/control-ui/components/LlmSecretsSubTabs/index.tsx
@@ -10,7 +10,7 @@ export function LlmSecretsSubTabs({ activeValue }: { activeValue: LlmSecretsSubT
<TabBar<LlmSecretsSubTab>
ariaLabel="LLM secret kinds"
activeValue={activeValue}
- className="cu-tabs--flush"
+ className="cu-tabs--flush cu-tabs--nested"
options={[
{ value: 'api-key', href: CONTROL_ROUTES.secrets.llm, label: 'API-KEY' },
{
diff --git a/control-ui/components/RecipeEditor.tsx b/control-ui/components/RecipeEditor.tsx
index 243893601..f1c233192 100644
--- a/control-ui/components/RecipeEditor.tsx
+++ b/control-ui/components/RecipeEditor.tsx
@@ -1125,8 +1125,7 @@ export function extractSecrets(
const uiRef = (spec?.ui as Record<string, unknown> | undefined)?.workloadRef
for (const workload of workloads ?? []) {
const envSecret = workload.envSecret as
- | { name?: string; keys?: Array<{ secretKey?: string; envVar?: string }> }
- | undefined
+ { name?: string; keys?: Array<{ secretKey?: string; envVar?: string }> } | undefined
if (!envSecret?.name || !Array.isArray(envSecret.keys)) continue
const namespace =
workload.transport !== undefined && workload.transport !== null
@@ -1691,7 +1690,7 @@ export function RecipeEditor({ initial, onSaved, onCancel, pageHeader }: Props)
value: credentialSelectValue('', row.connectionKey),
label: row.displayName || row.connectionKey,
meta: 'ChatGPT subscription',
- providers: [{ id: 'codex-subscription', label: 'ChatGPT' }],
+ providers: [{ id: 'codex-subscription', label: 'ChatGPT Subscription' }],
}))
if (
codexConnectionRef &&
@@ -1705,7 +1704,7 @@ export function RecipeEditor({ initial, onSaved, onCancel, pageHeader }: Props)
value: credentialSelectValue('', codexConnectionRef),
label: `${codexConnectionRef} (unavailable)`,
meta: 'ChatGPT subscription',
- providers: [{ id: 'codex-subscription', label: 'ChatGPT' }],
+ providers: [{ id: 'codex-subscription', label: 'ChatGPT Subscription' }],
})
}
return options
diff --git a/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx b/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx
index c723b8faf..19260058e 100644
--- a/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx
+++ b/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx
@@ -201,7 +201,7 @@ describe('HostDetailsPage identity integration', () => {
fireEvent.click(screen.getByRole('button', { name: 'LLM Secret' }))
const zaiOption = screen.getByRole('option', { name: /zai-secret/ })
- expect(zaiOption).toHaveTextContent('Providers: Z.AI')
+ expect(zaiOption).toHaveTextContent('Z.AI')
expect(zaiOption.querySelector('img')).toHaveAttribute('src', '/provider-icons/zai.svg')
})
diff --git a/control-ui/components/__tests__/HostDetailsPage.lifecycle.test.tsx b/control-ui/components/__tests__/HostDetailsPage.lifecycle.test.tsx
deleted file mode 100644
index ed0f28e01..000000000
--- a/control-ui/components/__tests__/HostDetailsPage.lifecycle.test.tsx
+++ /dev/null
@@ -1,359 +0,0 @@
-import React from 'react'
-import type { ReactNode } from 'react'
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
-import { cleanup, fireEvent, render as rtlRender, screen, waitFor } from '@testing-library/react'
-import HostDetailsPage from '../../app/hosts/[name]/page'
-import * as api from '../../lib/api'
-import { ToastProvider } from '../Toast'
-
-const replaceMock = vi.fn()
-const pushMock = vi.fn()
-let mockParams: { name: string; tab?: string } = { name: 'foo' }
-
-vi.mock('next/navigation', () => ({
- useParams: () => mockParams,
- usePathname: () => '/agents/foo',
- useRouter: () => ({ push: pushMock, replace: replaceMock }),
- useSearchParams: () => new URLSearchParams(),
-}))
-
-vi.mock('../AuthContext', () => ({
- useAuth: () => ({ logout: vi.fn() }),
-}))
-
-vi.mock('../Sidebar', () => ({
- Sidebar: () => <aside data-testid="sidebar" />,
-}))
-
-vi.mock('../HostIdentityTab', () => ({
- HostIdentityTab: ({ hostName }: { hostName: string }) => (
- <div data-testid="identity-tab">Identity editor for {hostName}</div>
- ),
-}))
-
-vi.mock('../HostAccessTab', () => ({
- HostAccessTab: ({ hostName }: { hostName: string }) => (
- <div data-testid="access-tab">Access editor for {hostName}</div>
- ),
-}))
-
-vi.mock('../../lib/api', () => ({
- apiGet: vi.fn(),
- apiSend: vi.fn(),
- getAdminTeamAgents: vi.fn(),
- getAdminUserAgents: vi.fn(),
- getAgentTeams: vi.fn(),
- getAgentUsers: vi.fn(),
- getHost: vi.fn(),
- getHostDetailBundle: vi.fn(),
- getMcpServers: vi.fn(),
- getLlmModels: vi.fn().mockResolvedValue({ rows: [] }),
- isSilentApiError: vi.fn().mockReturnValue(false),
- updateAdminTeamAgents: vi.fn(),
- updateAdminUserAgents: vi.fn(),
- updateContext: vi.fn(),
-}))
-
-const baseSpec = {
- approval: { tools: { shell_exec: true } },
- channels: [],
- contextRef: 'ctx',
- host: 'foo-display',
- model: { name: 'gpt-5.4-mini', provider: 'openai' },
- secretRef: 'openai-secret',
-}
-
-type TestHost = {
- metadata: { name: string }
- spec: Record<string, unknown>
- status?: Record<string, unknown>
-}
-
-const statefulHost: TestHost = {
- metadata: { name: 'foo' },
- spec: { ...baseSpec },
-}
-
-const statelessHost: TestHost = {
- metadata: { name: 'foo' },
- spec: { ...baseSpec, lifecycle: { stateless: true } },
- status: {
- lifecycle: { state: 'active', reason: 'SuspendBlocked: pendingResults' },
- },
-}
-
-const rejectedHost: TestHost = {
- metadata: { name: 'foo' },
- spec: { ...baseSpec, lifecycle: { stateless: true } },
- status: {
- lifecycle: { state: 'active', reason: '' },
- conditions: [
- {
- type: 'StatelessEnableRejected',
- status: 'True',
- reason: 'ActiveCommunicationChannels',
- message: 'Host has active communication channels.',
- },
- ],
- },
-}
-
-// Addendum 6 (issue #791): a CONFIRMED CommunicationChannel association hard-rejects
-// the requested stateless lifecycle. HCC selects the stateful template at replicas 1
-// and writes a StatelessEnableRejected condition whose message names the channel
-// count AND the disassociation recovery action. control-ui renders that condition
-// message verbatim in the warning banner.
-const channelHardRejectedHost: TestHost = {
- metadata: { name: 'foo' },
- spec: { ...baseSpec, lifecycle: { stateless: true } },
- status: {
- lifecycle: {
- state: 'active',
- reason:
- '2 CommunicationChannel(s) reference this Host; disassociate them to enable the requested stateless lifecycle',
- },
- conditions: [
- {
- type: 'StatelessEnableRejected',
- status: 'True',
- reason: 'ActiveCommunicationChannels',
- message:
- '2 CommunicationChannel(s) reference this Host; disassociate them to enable the requested stateless lifecycle',
- },
- ],
- },
-}
-
-// The same Host after the operator disassociates the channels: HCC clears the
-// rejection and activates the requested stateless mode on the next reconcile.
-const disassociatedStatelessHost: TestHost = {
- metadata: { name: 'foo' },
- spec: { ...baseSpec, lifecycle: { stateless: true } },
- status: {
- lifecycle: { state: 'active' },
- },
-}
-
-function setupApiMocks(host: TestHost) {
- ;(api.getHostDetailBundle as unknown as ReturnType<typeof vi.fn>).mockResolvedValue({
- host,
- contexts: [{ metadata: { name: 'ctx' }, spec: { contextId: 'ctx' } }],
- secrets: [{ name: 'openai-secret' }],
- users: [],
- teams: [],
- agentUsers: [],
- agentTeams: [],
- })
- ;(api.getHost as unknown as ReturnType<typeof vi.fn>).mockResolvedValue(host)
- ;(api.apiSend as unknown as ReturnType<typeof vi.fn>).mockResolvedValue({})
-}
-
-function render(children: ReactNode) {
- return rtlRender(<ToastProvider>{children}</ToastProvider>)
-}
-
-async function openOverviewEdit() {
- const overviewEditButton = await screen.findByRole('button', { name: 'Edit lifecycle' })
- await waitFor(() => expect(overviewEditButton).toBeEnabled())
- fireEvent.click(overviewEditButton)
-}
-
-async function saveOverviewAndGetPayload(): Promise<{ spec: Record<string, unknown> }> {
- fireEvent.click(screen.getByRole('button', { name: 'Save lifecycle' }))
- await waitFor(() =>
- expect(api.apiSend).toHaveBeenCalledWith('PUT', '/api/v1/admin/hosts/foo', expect.any(Object))
- )
- const call = (api.apiSend as unknown as ReturnType<typeof vi.fn>).mock.calls.find(
- args => args[0] === 'PUT' && args[1] === '/api/v1/admin/hosts/foo'
- )
- expect(call).toBeDefined()
- return call![2] as { spec: Record<string, unknown> }
-}
-
-afterEach(() => {
- cleanup()
-})
-
-describe('HostDetailsPage stateless lifecycle', () => {
- beforeEach(() => {
- vi.clearAllMocks()
- mockParams = { name: 'foo' }
- })
-
- it('shows Stateful (always on) for a host without spec.lifecycle', async () => {
- setupApiMocks(statefulHost)
- render(<HostDetailsPage />)
-
- expect(await screen.findByText('Stateful (always on)')).toBeInTheDocument()
- expect(screen.queryByText(/^Lifecycle:/)).not.toBeInTheDocument()
- })
-
- it('loads spec.lifecycle.stateless=true into the Type field', async () => {
- setupApiMocks(statelessHost)
- render(<HostDetailsPage />)
-
- expect(await screen.findByText('Stateless (suspends when idle)')).toBeInTheDocument()
- })
-
- it('renders the lifecycle state chip with state and reason for stateless hosts', async () => {
- setupApiMocks(statelessHost)
- render(<HostDetailsPage />)
-
- expect(
- await screen.findByText('Lifecycle: active — SuspendBlocked: pendingResults')
- ).toBeInTheDocument()
- })
-
- it('maps the activeCronSchedules reason to friendly text on the lifecycle chip (cron×stateless)', async () => {
- setupApiMocks({
- metadata: { name: 'foo' },
- spec: { ...baseSpec, lifecycle: { stateless: true } },
- status: {
- lifecycle: { state: 'active', reason: 'SuspendBlocked: activeCronSchedules' },
- },
- })
- render(<HostDetailsPage />)
-
- expect(
- await screen.findByText(
- 'Lifecycle: active — Not suspending: active scheduled tasks keep this agent awake'
- )
- ).toBeInTheDocument()
- expect(screen.queryByText(/SuspendBlocked: activeCronSchedules/)).not.toBeInTheDocument()
- })
-
- it('echoes spec.lifecycle when saving Overview unchanged (full-replace safety)', async () => {
- setupApiMocks(statelessHost)
- render(<HostDetailsPage />)
- await openOverviewEdit()
-
- const payload = await saveOverviewAndGetPayload()
-
- expect(payload.spec.host).toBe('foo-display')
- expect(payload.spec.lifecycle).toEqual({ stateless: true })
- expect(payload.spec.approval).toEqual(baseSpec.approval)
- })
-
- it('keeps spec.lifecycle absent when a stateful host is saved unchanged (absent = disabled)', async () => {
- setupApiMocks(statefulHost)
- render(<HostDetailsPage />)
- await openOverviewEdit()
-
- const payload = await saveOverviewAndGetPayload()
-
- expect('lifecycle' in payload.spec).toBe(false)
- })
-
- it('declares workflow-control scopes when saving a host that already has channel ingress', async () => {
- setupApiMocks({
- metadata: { name: 'foo' },
- spec: { ...baseSpec, channels: ['foo-channel'] },
- })
- render(<HostDetailsPage />)
- await openOverviewEdit()
-
- const payload = await saveOverviewAndGetPayload()
-
- expect(payload.spec.workflowControl).toEqual({
- scopes: [
- 'workflow:list',
- 'workflow:read',
- 'workflow:trigger',
- 'workflow:approval:resolve',
- 'workflow:approval:decide',
- ],
- })
- })
-
- it('writes spec.lifecycle.stateless=true when the operator switches to Stateless', async () => {
- setupApiMocks(statefulHost)
- render(<HostDetailsPage />)
- await openOverviewEdit()
-
- fireEvent.change(screen.getByLabelText('Type'), { target: { value: 'stateless' } })
- const payload = await saveOverviewAndGetPayload()
-
- expect(payload.spec.lifecycle).toEqual({ stateless: true })
- })
-
- it('writes spec.lifecycle.stateless=false when a stateless host is switched back to Stateful', async () => {
- setupApiMocks(statelessHost)
- render(<HostDetailsPage />)
- await openOverviewEdit()
-
- fireEvent.change(screen.getByLabelText('Type'), { target: { value: 'stateful' } })
- const payload = await saveOverviewAndGetPayload()
-
- expect(payload.spec.lifecycle).toEqual({ stateless: false })
- })
-
- it('renders the StatelessEnableRejected condition prominently', async () => {
- setupApiMocks(rejectedHost)
- render(<HostDetailsPage />)
-
- expect(await screen.findByText('Stateless mode rejected:')).toBeInTheDocument()
- expect(screen.getByText(/Host has active communication channels\./)).toBeInTheDocument()
- })
-
- it('renders the CommunicationChannel hard-rejection banner with the disassociation recovery action verbatim (Addendum 6)', async () => {
- setupApiMocks(channelHardRejectedHost)
- render(<HostDetailsPage />)
-
- // Prominent warning banner on the (default) details view.
- const bannerLabel = await screen.findByText('Stateless mode rejected:')
- const banner = bannerLabel.closest('.cu-banner')
- expect(banner).not.toBeNull()
- // The banner surfaces the status condition message VERBATIM: the channel
- // count (the reason) AND the operator recovery action (disassociate).
- expect(banner).toHaveTextContent(
- '2 CommunicationChannel(s) reference this Host; disassociate them to enable the requested stateless lifecycle'
- )
- })
-
- it('clears the hard-rejection banner after the operator disassociates the channels and the view reloads', async () => {
- // First load: hard-rejected (channels still associated). After the operator
- // removes the channels, the overview save reloads the Host, which now reports
- // stateless-active with no StatelessEnableRejected condition.
- ;(api.getHostDetailBundle as unknown as ReturnType<typeof vi.fn>)
- .mockResolvedValueOnce({
- host: channelHardRejectedHost,
- contexts: [{ metadata: { name: 'ctx' }, spec: { contextId: 'ctx' } }],
- secrets: [{ name: 'openai-secret' }],
- users: [],
- teams: [],
- agentUsers: [],
- agentTeams: [],
- })
- .mockResolvedValue({
- host: disassociatedStatelessHost,
- contexts: [{ metadata: { name: 'ctx' }, spec: { contextId: 'ctx' } }],
- secrets: [{ name: 'openai-secret' }],
- users: [],
- teams: [],
- agentUsers: [],
- agentTeams: [],
- })
- ;(api.getHost as unknown as ReturnType<typeof vi.fn>).mockResolvedValue(channelHardRejectedHost)
- ;(api.apiSend as unknown as ReturnType<typeof vi.fn>).mockResolvedValue({})
-
- render(<HostDetailsPage />)
-
- expect(await screen.findByText('Stateless mode rejected:')).toBeInTheDocument()
-
- await openOverviewEdit()
- fireEvent.click(screen.getByRole('button', { name: 'Save lifecycle' }))
-
- await waitFor(() =>
- expect(screen.queryByText('Stateless mode rejected:')).not.toBeInTheDocument()
- )
- expect(screen.queryByText(/disassociate them to enable/)).not.toBeInTheDocument()
- })
-
- it('does not render the rejection banner when no condition is present', async () => {
- setupApiMocks(statelessHost)
- render(<HostDetailsPage />)
-
- await screen.findByText('Stateless (suspends when idle)')
- expect(screen.queryByText('Stateless mode rejected:')).not.toBeInTheDocument()
- })
-})
diff --git a/control-ui/components/__tests__/HostWizard.test.tsx b/control-ui/components/__tests__/HostWizard.test.tsx
index 384384b07..c1d299ef3 100644
--- a/control-ui/components/__tests__/HostWizard.test.tsx
+++ b/control-ui/components/__tests__/HostWizard.test.tsx
@@ -269,7 +269,7 @@ describe('HostWizard — credential draft is projected onto the active provider
fireEvent.click(screen.getByRole('button', { name: /Select LLM Secret/i }))
const option = screen.getByRole('option', { name: /shared-llm-keys/ })
- expect(option).toHaveTextContent(/Providers: OpenAI, Amazon Bedrock/)
+ expect(option).toHaveTextContent(/OpenAI, Amazon Bedrock/)
})
it('matches the primary provider to the selected credential', async () => {
diff --git a/control-ui/e2e/host-stateless-channel-rejection.spec.ts b/control-ui/e2e/host-stateless-channel-rejection.spec.ts
deleted file mode 100644
index 3467625f3..000000000
--- a/control-ui/e2e/host-stateless-channel-rejection.spec.ts
+++ /dev/null
@@ -1,232 +0,0 @@
-/**
- * E2E -- Operator visibility: stateless × CommunicationChannel hard-rejection banner
- *
- * Validates plan Addendum 6 item 4 (issue #791) on the LIVE control-ui host detail
- * view: a stateless Host that has a CONFIRMED CommunicationChannel association is
- * hard-rejected by HCC (effectiveMode=stateful + StatelessEnableRejected condition),
- * and the operator sees a prominent warning banner carrying the status reason
- * VERBATIM plus the disassociation recovery action. Removing the channel clears it.
- *
- * Why this spec arranges via a direct CRD write (kubectl), not the control-api:
- * The normal control-api/UI path CANNOT reach this state by design — control-api
- * rejects associating a CommunicationChannel with a stateless Host, and rejects
- * flipping a channel-bound Host to stateless, both with 409
- * `stateless_host_communication_channel_conflict`
- * (control-api/src/routes/admin/resources.ts). The hard-rejection is HCC's
- * defensive backstop for direct/racing CRD writes (AP-7,
- * docs/architecture/stateless-invariants.md). So this spec reproduces exactly that
- * race: it `kubectl apply`s a CommunicationChannel referencing a dedicated stateless
- * Host, then asserts the operator-facing banner.
- *
- * Opt-in: this spec is skipped unless E2E_STATELESS_CHANNEL_REJECTION=1, because it
- * requires a dedicated stateless Host and a kubectl context.
- *
- * KNOWN RED in this repository, for a reason unrelated to the executor fix: the
- * assertion below reads `status.lifecycle.effectiveMode`, which is NOT part of this
- * repo's HostLifecycleStatus (see host-context-controller/src/types.ts) and is never
- * written by this tree's HCC. The channel hard-rejection itself DOES work here — it is
- * observable through the StatelessEnableRejected condition, the stateful pod template,
- * and the banner text — but this spec will fail on the effectiveMode token until the
- * upstream hostLifecycleDecision model is ported. Do not weaken the assertion to make
- * it pass; port the model, or assert on the condition instead.
- *
- * Prerequisites (when enabled):
- * 1. Port-forwards running (control-ui :3000, control-api :8090).
- * 2. Admin credentials: ADMIN_USER, ADMIN_PASS.
- * 3. E2E_STATELESS_HOST — a dedicated Host with spec.lifecycle.stateless=true that is
- * NOT chatllm-stateless (avoids colliding with the transient Test 2d window of
- * scripts/e2e/e2e-stateless-suspend-wake.sh on a shared profile).
- * 4. E2E_KUBECONTEXT (or CONTEXT) — an allowed kubectl context (clerum-test /
- * clerum-codex-* / gke_<project>_<zone>_<cluster>). Passed to every kubectl call.
- */
-import { type Page, expect, test } from '@playwright/test'
-import { execFileSync } from 'node:child_process'
-
-const BASE_UI = process.env.CONTROL_UI_URL || 'http://localhost:3000'
-const ADMIN_USER = process.env.ADMIN_USER || 'admin'
-const ADMIN_PASS = process.env.ADMIN_PASS || 'admin123!'
-
-const ENABLED = process.env.E2E_STATELESS_CHANNEL_REJECTION === '1'
-const HOST = process.env.E2E_STATELESS_HOST || ''
-const KUBECONTEXT = process.env.E2E_KUBECONTEXT || process.env.CONTEXT || ''
-const HOSTS_NS = process.env.E2E_HOSTS_NAMESPACE || 'mcp-host'
-const CHANNELS_NS = process.env.E2E_CHANNELS_NAMESPACE || 'channels'
-const REJECTED_CONDITION = 'StatelessEnableRejected'
-
-// Unique per run so parallel/leftover runs never collide, and cleanup is targeted.
-const CC_NAME = `e2e-vis-stateless-reject-${Date.now()}`
-
-function kubectl(args: string[], input?: string): string {
- if (!KUBECONTEXT) {
- throw new Error(
- 'E2E_KUBECONTEXT (or CONTEXT) must be set to an allowed context; kubectl context is never inferred.'
- )
- }
- return execFileSync('kubectl', ['--context', KUBECONTEXT, ...args], {
- encoding: 'utf8',
- ...(input !== undefined ? { input } : {}),
- })
-}
-
-function getHostJson(): {
- effectiveMode?: string
- rejected?: boolean
- rejectionMessage?: string
-} {
- const raw = kubectl(['get', 'host', HOST, '-n', HOSTS_NS, '-o', 'json'])
- const obj = JSON.parse(raw) as {
- status?: {
- lifecycle?: { effectiveMode?: string }
- conditions?: Array<{ type?: string; status?: string; message?: string }>
- }
- }
- const condition = obj.status?.conditions?.find(c => c.type === REJECTED_CONDITION)
- return {
- effectiveMode: obj.status?.lifecycle?.effectiveMode,
- rejected: condition?.status === 'True',
- rejectionMessage: condition?.message,
- }
-}
-
-function applyChannel(): void {
- const manifest = `apiVersion: clerum.io/v1alpha1
-kind: CommunicationChannel
-metadata:
- name: ${CC_NAME}
- namespace: ${CHANNELS_NS}
-spec:
- hostRef: ${HOST}
- email:
- - channelId: "INBOX"
- emails:
-`
- kubectl(['apply', '-n', CHANNELS_NS, '-f', '-'], manifest)
-}
-
-function deleteChannel(): void {
- try {
- kubectl(['delete', 'communicationchannel', CC_NAME, '-n', CHANNELS_NS, '--ignore-not-found'])
- } catch (err) {
- // Cleanup is best-effort; surface it but never mask a prior assertion failure.
- console.warn(`[e2e] failed to delete CommunicationChannel ${CC_NAME}: ${String(err)}`)
- }
-}
-
-async function login(page: Page) {
- await page.goto(BASE_UI)
- await page.waitForSelector('text=Sign in', { timeout: 15_000 })
- const inputs = page.locator('input')
- await inputs.nth(0).fill(ADMIN_USER)
- await inputs.nth(1).fill(ADMIN_PASS)
- await page.locator('button:has-text("Sign in")').last().click()
- await page.waitForSelector('text=Marketplace', { timeout: 20_000 })
-}
-
-test.describe('operator sees the stateless × CommunicationChannel hard-rejection banner', () => {
- test.skip(
- !ENABLED,
- 'opt-in: set E2E_STATELESS_CHANNEL_REJECTION=1 (with E2E_STATELESS_HOST, E2E_KUBECONTEXT) and deploy the Addendum-6 executor fix'
- )
-
- test.beforeAll(() => {
- // Fail loud on missing prerequisites rather than skipping silently.
- if (!HOST) throw new Error('E2E_STATELESS_HOST must name a dedicated stateless Host.')
- if (!KUBECONTEXT)
- throw new Error('E2E_KUBECONTEXT (or CONTEXT) must be set to an allowed context.')
- const host = getHostJson()
- // Guard: the target must actually be a stateless Host, or the whole scenario is invalid.
- const statelessRaw = kubectl([
- 'get',
- 'host',
- HOST,
- '-n',
- HOSTS_NS,
- '-o',
- 'jsonpath={.spec.lifecycle.stateless}',
- ]).trim()
- if (statelessRaw !== 'true') {
- throw new Error(
- `E2E_STATELESS_HOST "${HOST}" must have spec.lifecycle.stateless=true (got "${statelessRaw}"). Host status: ${JSON.stringify(host)}`
- )
- }
- // Ensure a clean slate from any aborted prior run.
- deleteChannel()
- })
-
- test.afterAll(() => {
- deleteChannel()
- })
-
- test('renders the hard-rejection warning verbatim and clears it after disassociation', async ({
- page,
- }) => {
- // Arrange: the AP-7 racing CRD write — associate a channel with the stateless Host.
- applyChannel()
-
- // HCC hard-rejects on the next reconcile: effectiveMode=stateful + rejected condition.
- // Bounded, fail-loud poll — on timeout the last observed status is reported.
- await expect
- .poll(() => JSON.stringify(getHostJson()), {
- timeout: 120_000,
- intervals: [2_000],
- message:
- 'HCC did not hard-reject the stateless Host after the CommunicationChannel was applied ' +
- '(requires the Addendum-6 executor fix deployed).',
- })
- .toMatch(
- /"effectiveMode":"stateful".*"rejected":true|"rejected":true.*"effectiveMode":"stateful"/
- )
-
- const rejectionMessage = getHostJson().rejectionMessage
- expect(rejectionMessage, 'StatelessEnableRejected condition must carry a message').toBeTruthy()
- // Contract (Addendum 6): the message names the channel count AND the recovery action.
- expect(rejectionMessage).toMatch(/disassociate/i)
-
- // Assert the operator-facing banner shows the status message VERBATIM.
- // The verbatim reason renders on TWO deliberate operator-visibility surfaces —
- // the warning banner AND the lifecycle chip — so scope each assertion to its
- // own surface rather than letting an unscoped getByText(reason) collide across
- // both (strict-mode violation).
- await login(page)
- await page.goto(`${BASE_UI}/hosts/${encodeURIComponent(HOST)}`)
- // Anchor on the banner CONTAINER, not the 'Stateless mode rejected:' text —
- // that phrase lives in a <strong> leaf whose text is only the prefix, so the
- // reason (a sibling text node in the same .cu-banner--warning div) is not part
- // of the leaf. Match the container by class + its heading text, then assert
- // the reason WITHIN it.
- const rejectionBanner = page.locator('.cu-banner--warning', {
- hasText: 'Stateless mode rejected:',
- })
- await expect(rejectionBanner).toBeVisible({ timeout: 20_000 })
- // (1) the warning banner container carries the reason verbatim
- await expect(rejectionBanner).toContainText(rejectionMessage as string, { timeout: 20_000 })
- // (2) the lifecycle chip is a second visibility surface — assert it deliberately
- await expect(page.locator('.cu-chip', { hasText: rejectionMessage as string })).toBeVisible({
- timeout: 20_000,
- })
-
- // Disassociation recovery: remove the channel; HCC clears the rejection.
- // Strict delete (not the best-effort cleanup helper) so a real failure here
- // fails the test loudly instead of being swallowed mid-scenario.
- kubectl(['delete', 'communicationchannel', CC_NAME, '-n', CHANNELS_NS, '--ignore-not-found'])
- await expect
- .poll(() => JSON.stringify(getHostJson()), {
- timeout: 120_000,
- intervals: [2_000],
- message: 'HCC did not clear the hard-rejection after the CommunicationChannel was removed.',
- })
- .toMatch(/"rejected":false/)
-
- // BOTH surfaces must clear once the Host reports stateless-active again: the
- // warning banner disappears AND the rejection reason no longer renders on any
- // surface (banner or lifecycle chip).
- await page.reload()
- await expect(
- page.locator('.cu-banner--warning', { hasText: 'Stateless mode rejected:' })
- ).toHaveCount(0, { timeout: 20_000 })
- await expect(page.getByText(rejectionMessage as string, { exact: false })).toHaveCount(0, {
- timeout: 20_000,
- })
- })
-})
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index d5b00a90d..c6c1e8790 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.475",
+ "version": "0.1.476",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.475",
+ "version": "0.1.476",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/llm-providers": "file:../packages/llm-providers",
diff --git a/control-ui/package.json b/control-ui/package.json
index c5a43e394..bcf1f477a 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.475",
+ "version": "0.1.476",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",