Skip to content

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

TypeScript

style(control-ui): align the full-screen LLM secret editor with the create-flow styling

Miguelon Peluchone7118326b508
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index f1533d375..5d527e424 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -8500,6 +8500,12 @@ td.cu-registry-description {
min-width: 0;
}
+/* A fallback-locked extra slot adds a `cu-chip` state marker beside the
+ remove control, so the row gains a fourth (auto) actions track. */
+.cu-llm-cred-extra--locked {
+ grid-template-columns: 1fr 1fr auto auto;
+}
+
/* Chip + optional remove icon-button on the right side of a group head. */
.cu-llm-cred-group__head-actions {
display: flex;
diff --git a/control-ui/app/secrets/llm/[name]/edit/__tests__/page.test.tsx b/control-ui/app/secrets/llm/[name]/edit/__tests__/page.test.tsx
index ebdb35287..5c04dab54 100644
--- a/control-ui/app/secrets/llm/[name]/edit/__tests__/page.test.tsx
+++ b/control-ui/app/secrets/llm/[name]/edit/__tests__/page.test.tsx
@@ -384,7 +384,7 @@ describe('Edit LLM secret page — update payload', () => {
})
describe('Edit LLM secret page — fallback credential slot guard', () => {
- it('blocks removing a stored slot still referenced by a Host fallback policy', async () => {
+ it('marks a stored slot still referenced by a Host fallback as locked and unremovable', async () => {
const fallbackSlot = 'claude-api-key-fb1'
seedSecret(['openai-api-key', fallbackSlot])
// The guard scans every Host, not just the linking surface's: any Host
@@ -395,7 +395,45 @@ describe('Edit LLM secret page — fallback credential slot guard', () => {
])
await renderEditor()
- removeExtraSlotIn('Anthropic')
+
+ // Recipe-edit parity: the row carries a locked state chip, and the remove
+ // control is disabled so the retirement cannot even be queued.
+ const lockedChip = screen.getByText('fallback-locked', { selector: '.cu-chip' })
+ expect(lockedChip).toBeInTheDocument()
+ expect(lockedChip).toHaveAttribute(
+ 'title',
+ 'An active Host fallback still references this credential slot. Update the fallback configuration before removing this key.'
+ )
+ const removeButton = within(sectionFor('Anthropic')).getByRole('button', {
+ name: 'Remove extra credential slot',
+ })
+ expect(removeButton).toBeDisabled()
+ fireEvent.click(removeButton)
+ save()
+
+ expect(screen.getAllByText(/Provide at least one API key/i).length).toBeGreaterThan(0)
+ expect(
+ apiSendMock.mock.calls.some(args => args[0] === 'PUT' && args[1] === '/api/v1/admin/secrets')
+ ).toBe(false)
+ })
+
+ it('still blocks a rename that would retire a fallback-locked slot at save time', async () => {
+ // The chip and disabled X close the click path; renaming a locked slot
+ // with a value still queues the old key for retirement, and the save-time
+ // guard refuses it with the actionable reason.
+ const fallbackSlot = 'claude-api-key-fb1'
+ seedSecret(['openai-api-key', fallbackSlot])
+ seedHosts([{ name: 'foo', secretRef: SECRET, fallbackSlot }])
+
+ await renderEditor()
+ const anthropic = sectionFor('Anthropic')
+ fireEvent.change(within(anthropic).getByLabelText(/Extra credential slot key name/i), {
+ target: { value: 'claude-api-key-fb2' },
+ })
+ // The rename commits the new key, so the row's value input is live.
+ fireEvent.change(within(anthropic).getByLabelText(/Extra credential slot value/i), {
+ target: { value: 'sk-ant-new' },
+ })
save()
expect(
diff --git a/control-ui/components/LlmCredentialFields/index.tsx b/control-ui/components/LlmCredentialFields/index.tsx
index 8f53bd1ef..de7e9fbb8 100644
--- a/control-ui/components/LlmCredentialFields/index.tsx
+++ b/control-ui/components/LlmCredentialFields/index.tsx
@@ -95,6 +95,7 @@ export function LlmCredentialFields({
existingKeys,
onRemovedKeysChange,
excludedProviders = [],
+ protectedKeys = [],
pickerInline = false,
}: LlmCredentialFieldsProps) {
const [extraSlots, setExtraSlots] = useState<ExtraSlot[]>(() =>
@@ -118,6 +119,7 @@ export function LlmCredentialFields({
const existingKeySet = useMemo(() => new Set(existingKeys ?? []), [existingKeys])
const excludedProviderSet = useMemo(() => new Set(excludedProviders), [excludedProviders])
+ const protectedKeySet = useMemo(() => new Set(protectedKeys), [protectedKeys])
const present = (dataKey: string): boolean =>
(draft[dataKey] ?? '').trim().length > 0 || existingKeySet.has(dataKey)
@@ -532,6 +534,11 @@ export function LlmCredentialFields({
const storedExtra = slot.existingKey !== null && slot.committedKey === null
const showExtraValueInput =
!storedExtra || replacingExtraKeys.has(slot.id) || slot.value.trim().length > 0
+ // Recipe-edit parity for keys a live fallback still references:
+ // a state chip on the row and a remove control that cannot be
+ // triggered. Renaming stays possible — the owning surface's
+ // save-time guard blocks retiring the key that way.
+ const locked = slot.existingKey !== null && protectedKeySet.has(slot.existingKey)
return (
<Field
key={slot.id}
@@ -543,7 +550,7 @@ export function LlmCredentialFields({
}
error={error ?? undefined}
>
- <div className="cu-llm-cred-extra">
+ <div className={cn('cu-llm-cred-extra', locked && 'cu-llm-cred-extra--locked')}>
<TextInput
monospace
value={slot.nameInput}
@@ -612,13 +619,25 @@ export function LlmCredentialFields({
</Button>
</div>
)}
+ {locked ? (
+ <span
+ className="cu-chip"
+ title="An active Host fallback still references this credential slot. Update the fallback configuration before removing this key."
+ >
+ fallback-locked
+ </span>
+ ) : null}
<button
type="button"
className="cu-btn cu-btn--icon cu-btn--danger-icon"
onClick={() => removeExtraSlot(slot.id)}
- disabled={disabled}
+ disabled={disabled || locked}
aria-label="Remove extra credential slot"
- title="Remove extra credential slot"
+ title={
+ locked
+ ? 'Fallback-locked — update the fallback configuration first'
+ : 'Remove extra credential slot'
+ }
>
<IconX width={16} height={16} />
</button>
diff --git a/control-ui/components/LlmCredentialFields/types.ts b/control-ui/components/LlmCredentialFields/types.ts
index f45d81181..932ddcb39 100644
--- a/control-ui/components/LlmCredentialFields/types.ts
+++ b/control-ui/components/LlmCredentialFields/types.ts
@@ -38,8 +38,16 @@ export type LlmCredentialFieldsProps = {
// the active primary/fallback routing editor). They stay out of this
// additive LLM Secret editor so a provider is never rendered twice.
excludedProviders?: LlmProvider[]
+ // Stored keys (a subset of `existingKeys`) still referenced by a persisted
+ // Host fallback policy. The owning surface surfaces them recipe-edit style:
+ // a `cu-chip` state marker on the row and a disabled remove control, so a
+ // live fallback reference cannot be retired by accident. The save-time
+ // guard in the owning surface remains the backstop (rename can still
+ // retire a key, and is reported through `onRemovedKeysChange`).
+ protectedKeys?: ReadonlyArray<string>
// Render the "Add provider" picker as an always-open inline list instead of a
- // popover. Scroll-clipped surfaces (the update modal) must set it — an
- // absolute-positioned menu would open below the modal's visible fold.
+ // popover. Scroll-clipped surfaces (a bounded dialog) must set it — an
+ // absolute-positioned menu would open below the visible fold. Full-screen
+ // pages leave it unset and get the popover picker.
pickerInline?: boolean
}
diff --git a/control-ui/components/LlmSecretEditor/index.tsx b/control-ui/components/LlmSecretEditor/index.tsx
index 21e733984..62222bcb5 100644
--- a/control-ui/components/LlmSecretEditor/index.tsx
+++ b/control-ui/components/LlmSecretEditor/index.tsx
@@ -117,15 +117,19 @@ export function LlmSecretEditor({
return (
<>
- <div className="cu-form-stack" style={{ maxWidth: '100%' }}>
- <p className="cu-field__hint">
- Updates the listed keys and deletes the ones you remove here; every other key already
- stored in this secret is preserved.
- </p>
+ <div className="cu-form-stack">
+ <div className="cu-banner cu-banner--info">
+ Stored values are never returned by the API: rows marked <strong>Stored</strong> already
+ have a value — keep it as is or choose <strong>Replace</strong> to overwrite it. Removing
+ an additional credential slot deletes that key on save; slots marked{' '}
+ <strong>fallback-locked</strong> are referenced by an active fallback policy and cannot be
+ removed here. Every other key already stored in this secret is preserved.
+ </div>
<LlmCredentialFields
draft={keyDraft}
onChange={(dataKey, value) => setKeyDraft(prev => ({ ...prev, [dataKey]: value }))}
existingKeys={existingKeys}
+ protectedKeys={protectedCredentialSlots}
// The editor reports on every change. Keep the parent state
// identity-stable so it does not cause an unnecessary rerender.
onRemovedKeysChange={next =>
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index da72f227f..236bd94a0 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.710",
+ "version": "0.1.711",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.710",
+ "version": "0.1.711",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --git a/control-ui/package.json b/control-ui/package.json
index 6576c8a4f..0895d2ba5 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.710",
+ "version": "0.1.711",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",