Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
feat(control-ui): author broker-backed Hosts and recipes
Alfredo Lopezffacb4684d26
diff --git a/control-ui/app/hosts/[name]/page.tsx b/control-ui/app/hosts/[name]/page.tsxindex d93ca9cc8..ff93f3d5b 100644--- a/control-ui/app/hosts/[name]/page.tsx+++ b/control-ui/app/hosts/[name]/page.tsx@@ -28,6 +28,7 @@ import {getModelOptions,getProviderLabel,isProviderUsable,+ llmChainRequiresSecret,normalizeAllowedModels,normalizeLlmPolicy,normalizeProvider,@@ -475,10 +476,16 @@ export default function HostDetailsPage() {// the Secret listed at least one key OR the operator typed a rotation. An// empty/unlisted key set is treated as unknown (the backend stays the source// of truth), so the save is never blocked by stale listing.+ const chainRequiresSecret = llmChainRequiresSecret(providerDraft, llmPolicyDraft?.fallbacks)+ if (chainRequiresSecret && !secretRefDraft.trim()) {+ setError('Select an LLM secret for the static-credentials provider in this chain.')+ return false+ }const primaryPresent = (dataKey: string): boolean =>(llmKeyDraft[dataKey] ?? '').trim().length > 0 || currentSecretKeys.includes(dataKey)const typedAnyCredential = Object.values(llmKeyDraft).some(value => value.trim().length > 0)if (+ chainRequiresSecret &&secretRefDraft.trim() &&(currentSecretKeys.length > 0 || typedAnyCredential) &&!isProviderUsable(providerDraft, primaryPresent)@@ -512,12 +519,20 @@ export default function HostDetailsPage() {const currentHost = await getHost(routeName)const nextSpec: Record<string, unknown> = {...currentHost.spec,- secretRef: secretRefDraft.trim(),model: {provider: providerDraft,name: modelNameDraft.trim(),},}+ // Host identity is metadata.name / the route slug. Never persist+ // hostRef/userId as execution authority on this write.+ delete nextSpec.hostRef+ delete nextSpec.userId+ if (chainRequiresSecret) {+ nextSpec.secretRef = secretRefDraft.trim()+ } else {+ delete nextSpec.secretRef+ }// Opt-in fallback policy: set it when configured, otherwise drop it so a// Host with no policy stays exactly as today (full-replace semantics).if (llmPolicyDraft && llmPolicyDraft.fallbacks.length > 0) {@@ -547,7 +562,11 @@ export default function HostDetailsPage() {// Rotate/retire credentials on the Host's own Secret with merge:true so// other providers' stored keys are preserved (spec Topic 1b R5). removeKeys// retires the extra slots left behind by removed fallbacks.- if (secretRefDraft.trim() && (Object.keys(rotatedData).length > 0 || removeKeys.length > 0)) {+ if (+ chainRequiresSecret &&+ secretRefDraft.trim() &&+ (Object.keys(rotatedData).length > 0 || removeKeys.length > 0)+ ) {await apiSend('PUT', '/api/v1/admin/secrets', {name: secretRefDraft.trim(),merge: true,@@ -928,10 +947,17 @@ export default function HostDetailsPage() {</div>)}</div>- <div className="cu-field">- <label htmlFor="model-secret">Secret reference</label>- <div className="cu-field__readonly">{secretRefDraft || '-'}</div>- </div>+ {llmChainRequiresSecret(providerDraft, llmPolicyDraft?.fallbacks) ? (+ <div className="cu-field">+ <label htmlFor="model-secret">Secret reference</label>+ <div className="cu-field__readonly">{secretRefDraft || '-'}</div>+ </div>+ ) : (+ <div className="cu-field">+ <label htmlFor="model-secret">Secret reference</label>+ <div className="cu-field__readonly">Broker-backed — no LLM secret required</div>+ </div>+ )}<div className="cu-field"><label htmlFor="model-fallback">Fallback policy</label>{llmPolicyDraft && llmPolicyDraft.fallbacks.length > 0 ? (@@ -966,27 +992,29 @@ export default function HostDetailsPage() {</button></div>) : null}- <div className="cu-form-stack" style={{ marginBottom: '1rem' }}>- <div className="cu-field">- <label htmlFor="host-secret">Secret reference</label>- <select- id="host-secret"- value={secretRefDraft}- onChange={e => setSecretRefDraft(e.target.value)}- disabled={busy}- >- <option value="">Select LLM secret</option>- {availableSecrets.map(secretName => (- <option key={secretName} value={secretName}>- {secretName}- </option>- ))}- {secretRefDraft && !availableSecrets.includes(secretRefDraft) ? (- <option value={secretRefDraft}>{secretRefDraft} (custom)</option>- ) : null}- </select>+ {llmChainRequiresSecret(providerDraft, llmPolicyDraft?.fallbacks) ? (+ <div className="cu-form-stack" style={{ marginBottom: '1rem' }}>+ <div className="cu-field">+ <label htmlFor="host-secret">Secret reference</label>+ <select+ id="host-secret"+ value={secretRefDraft}+ onChange={e => setSecretRefDraft(e.target.value)}+ disabled={busy}+ >+ <option value="">Select LLM secret</option>+ {availableSecrets.map(secretName => (+ <option key={secretName} value={secretName}>+ {secretName}+ </option>+ ))}+ {secretRefDraft && !availableSecrets.includes(secretRefDraft) ? (+ <option value={secretRefDraft}>{secretRefDraft} (custom)</option>+ ) : null}+ </select>+ </div></div>- </div>+ ) : null}<LlmProviderConfigprovider={providerDraft}model={modelNameDraft}@@ -1002,13 +1030,21 @@ export default function HostDetailsPage() {catalogLoading={modelsLoading}catalogError={modelsError}replacePrimaryModelWithAllowedModels- credentials={{- draft: llmKeyDraft,- onChange: (dataKey, value) =>- setLlmKeyDraft(prev => ({ ...prev, [dataKey]: value })),- existingKeys: currentSecretKeys,- }}- secretKeys={currentSecretKeys}+ credentials={+ llmChainRequiresSecret(providerDraft, llmPolicyDraft?.fallbacks)+ ? {+ draft: llmKeyDraft,+ onChange: (dataKey, value) =>+ setLlmKeyDraft(prev => ({ ...prev, [dataKey]: value })),+ existingKeys: currentSecretKeys,+ }+ : undefined+ }+ secretKeys={+ llmChainRequiresSecret(providerDraft, llmPolicyDraft?.fallbacks)+ ? currentSecretKeys+ : []+ }disabled={busy}/></>diff --git a/control-ui/components/HostWizard/index.tsx b/control-ui/components/HostWizard/index.tsxindex 3812f3f7f..06e85ad26 100644--- a/control-ui/components/HostWizard/index.tsx+++ b/control-ui/components/HostWizard/index.tsx@@ -31,6 +31,7 @@ import {getProviderLabel,getProvidersWithCompleteCredentials,isProviderUsable,+ llmChainRequiresSecret,projectCredentialDraft,resolveDefaultModel,validateLlmSecretData,@@ -43,7 +44,13 @@ import {STEPS,STEP_DETAILS,} from './constants'-import type { ContextOption, CreatedResource, HostWizardProps, WizardSelectProps } from './types'+import type {+ ContextOption,+ CreatedResource,+ HostLlmSecretMode,+ HostWizardProps,+ WizardSelectProps,+} from './types'// Stateless lifecycle support remains intact in the API and existing-agent UI;// only creation through this wizard is temporarily unavailable.@@ -232,7 +239,7 @@ function isStepValid(contextName: stringselectedExistingContext: stringselectedMcp: string[]- secretMode: 'existing' | 'new'+ secretMode: HostLlmSecretModeexistingSecret: stringnewSecretName: stringllmKeyDraft: Record<string, string>@@ -251,6 +258,11 @@ function isStepValid(return state.contextName.trim().length > 0}if (stepIndex === 2) {+ // Broker-only chains (Codex with no static fallback) need an explicit+ // catalog model and no Secret. Any static primary/fallback still requires+ // the exact credential slots (existing Secret or a complete new one).+ if (!state.modelName.trim()) return false+ if (!llmChainRequiresSecret(state.provider, state.llmPolicy?.fallbacks)) return true// New secret: the PRIMARY provider must be usable (asymmetric gate — a// fallback missing its key only warns). Cross-slot mistakes (half Bedrock// pair, malformed Vertex JSON) anywhere still block. Existing secret: the@@ -262,13 +274,11 @@ function isStepValid(state.llmKeyDraft,getActiveCredentialKeys(state.provider, state.llmPolicy))- const hasValidSecret =- state.secretMode === 'existing'- ? state.existingSecret.trim().length > 0- : toKebabCase(state.newSecretName).length > 0 &&+ return state.secretMode === 'existing'+ ? state.existingSecret.trim().length > 0+ : toKebabCase(state.newSecretName).length > 0 &&primaryCredentialUsable(state.provider, state.llmKeyDraft) &&validateLlmSecretData(projectedDraft).length === 0- return hasValidSecret && state.modelName.trim().length > 0}if (stepIndex === 3) return truereturn false@@ -309,7 +319,7 @@ export function HostWizard({// Reuse an existing shared Secret by default. Creating an agent-specific Secret// remains available when the operator explicitly chooses New credential.- const [secretMode, setSecretMode] = useState<'existing' | 'new'>('existing')+ const [secretMode, setSecretMode] = useState<HostLlmSecretMode>('existing')const [existingSecret, setExistingSecret] = useState('')const [newSecretName, setNewSecretName] = useState('')const [secretNameTouched, setSecretNameTouched] = useState(false)@@ -386,6 +396,7 @@ export function HostWizard({() => getModelOptions(allowedCatalog, provider),[allowedCatalog, provider])+ const chainRequiresSecret = llmChainRequiresSecret(provider, llmPolicy?.fallbacks)const handleExistingSecretChange = useCallback((secretName: string) => {setExistingSecret(secretName)@@ -599,21 +610,22 @@ export function HostWizard({if (step === 1 && contextMode === 'new' && !contextName.trim())return 'Context name is required.'if (step === 2 && !modelName.trim()) return 'Model name is required.'- if (step === 2 && secretMode === 'existing' && !existingSecret.trim())- return 'Select an existing secret.'- if (step === 2 && secretMode === 'new' && !toKebabCase(newSecretName)) {- return 'For a new secret, set a name.'- }- if (step === 2 && secretMode === 'new' && !primaryCredentialUsable(provider, llmKeyDraft)) {- return `Add the ${getProviderLabel(provider)} credential for the primary model.`- }- if (step === 2 && secretMode === 'new') {- const projected = projectCredentialDraft(- llmKeyDraft,- getActiveCredentialKeys(provider, llmPolicy)- )- const slotErrors = validateLlmSecretData(projected)- if (slotErrors.length > 0) return slotErrors[0]+ if (step === 2 && llmChainRequiresSecret(provider, llmPolicy?.fallbacks)) {+ if (secretMode === 'existing' && !existingSecret.trim()) return 'Select an existing secret.'+ if (secretMode === 'new' && !toKebabCase(newSecretName)) {+ return 'For a new secret, set a name.'+ }+ if (secretMode === 'new' && !primaryCredentialUsable(provider, llmKeyDraft)) {+ return `Add the ${getProviderLabel(provider)} credential for the primary model.`+ }+ if (secretMode === 'new') {+ const projected = projectCredentialDraft(+ llmKeyDraft,+ getActiveCredentialKeys(provider, llmPolicy)+ )+ const slotErrors = validateLlmSecretData(projected)+ if (slotErrors.length > 0) return slotErrors[0]+ }}return ''}, [@@ -692,7 +704,7 @@ export function HostWizard({contextMode === 'existing' ? selectedContextOption?.contextId || '' : normalizedContextNameconst normalizedSecretName = toKebabCase(newSecretName)- if (secretMode === 'new') {+ if (chainRequiresSecret && secretMode === 'new') {// Project the draft onto the active domain before writing: only the// primary provider's slots ∪ each fallback's effective slot(s) reach the// Secret — a key left behind by a since-removed provider is dropped, not@@ -759,7 +771,9 @@ export function HostWizard({const hostSpec: Record<string, unknown> = {host: normalizedHostName,contextRef: resolvedContextName,- secretRef: secretMode === 'existing' ? existingSecret : normalizedSecretName,+ ...(chainRequiresSecret+ ? { secretRef: secretMode === 'existing' ? existingSecret : normalizedSecretName }+ : {}),channels: [],model: {provider,@@ -1054,78 +1068,85 @@ export function HostWizard({{step === 2 && (<div className="cu-form-stack cu-agent-form-stack">- <div className="cu-agent-access-section">- <strong>Credentials</strong>- <span className="cu-muted cu-agent-access-hint">- Store this agent's own LLM credentials, or use a shared secret.- </span>- <div className="cu-agent-radio-group">- <label className="cu-agent-radio cu-agent-radio--card">- <input- type="radio"- checked={secretMode === 'existing'}- onChange={() => setSecretMode('existing')}- />- <span className="cu-agent-radio__copy">- <span className="cu-agent-radio__title">Use an existing secret</span>- <span className="cu-agent-radio__description">- Select a saved secret that already contains LLM API keys.+ {chainRequiresSecret ? (+ <div className="cu-agent-access-section">+ <strong>Credentials</strong>+ <span className="cu-muted cu-agent-access-hint">+ Store this agent's own LLM credentials, or use a shared secret.+ </span>+ <div className="cu-agent-radio-group">+ <label className="cu-agent-radio cu-agent-radio--card">+ <input+ type="radio"+ checked={secretMode === 'existing'}+ onChange={() => setSecretMode('existing')}+ />+ <span className="cu-agent-radio__copy">+ <span className="cu-agent-radio__title">Use an existing secret</span>+ <span className="cu-agent-radio__description">+ Select a saved secret that already contains LLM API keys.+ </span></span>- </span>- </label>- <label className="cu-agent-radio cu-agent-radio--card">- <input- type="radio"- checked={secretMode === 'new'}- onChange={() => setSecretMode('new')}- />- <span className="cu-agent-radio__copy">- <span className="cu-agent-radio__title">New secret</span>- <span className="cu-agent-radio__description">- Create a new secret for this agent. Its name is derived from the agent name.+ </label>+ <label className="cu-agent-radio cu-agent-radio--card">+ <input+ type="radio"+ checked={secretMode === 'new'}+ onChange={() => setSecretMode('new')}+ />+ <span className="cu-agent-radio__copy">+ <span className="cu-agent-radio__title">New secret</span>+ <span className="cu-agent-radio__description">+ Create a new secret for this agent. Its name is derived from the agent name.+ </span></span>- </span>- </label>- </div>- {secretMode === 'existing' ? (- <div className="cu-agent-access-section">- <strong>Credential</strong>- <WizardSelect- value={existingSecret}- placeholder="Select secret..."- options={secretOptions}- onChange={handleExistingSecretChange}- />+ </label></div>- ) : (- <Field- description="Auto-named from the agent — edit if you prefer a different name."- label="Secret name"- >- <span className="cu-agent-input-shell">- <TextInput- value={newSecretName}- onChange={e => {- setSecretNameTouched(true)- setNewSecretName(toKebabInput(e.target.value))- }}- placeholder="secret-name"+ {secretMode === 'existing' ? (+ <div className="cu-agent-access-section">+ <strong>Credential</strong>+ <WizardSelect+ value={existingSecret}+ placeholder="Select secret..."+ options={secretOptions}+ onChange={handleExistingSecretChange}/>- <span- className={cn(- 'cu-agent-input-shell__status',- !toKebabCase(newSecretName) && 'cu-agent-input-shell__status--empty'- )}- aria-label={- toKebabCase(newSecretName) ? 'Valid secret name' : 'Secret name empty'- }- >- {toKebabCase(newSecretName) ? <IconCheck width={16} height={16} /> : null}+ </div>+ ) : (+ <Field+ description="Auto-named from the agent — edit if you prefer a different name."+ label="Secret name"+ >+ <span className="cu-agent-input-shell">+ <TextInput+ value={newSecretName}+ onChange={e => {+ setSecretNameTouched(true)+ setNewSecretName(toKebabInput(e.target.value))+ }}+ placeholder="secret-name"+ />+ <span+ className={cn(+ 'cu-agent-input-shell__status',+ !toKebabCase(newSecretName) && 'cu-agent-input-shell__status--empty'+ )}+ aria-label={+ toKebabCase(newSecretName) ? 'Valid secret name' : 'Secret name empty'+ }+ >+ {toKebabCase(newSecretName) ? <IconCheck width={16} height={16} /> : null}+ </span></span>- </span>- </Field>- )}- </div>+ </Field>+ )}+ </div>+ ) : (+ <p className="cu-muted cu-agent-access-hint">+ This provider authenticates through the Codex subscription. No LLM secret is+ required unless you add a static-credentials fallback.+ </p>+ )}<LlmProviderConfigprovider={provider}model={modelName}@@ -1143,7 +1164,7 @@ export function HostWizard({modelLabel="Default model"showAllowedModels={false}credentials={- secretMode === 'new'+ chainRequiresSecret && secretMode === 'new'? {draft: llmKeyDraft,onChange: (dataKey, value) =>@@ -1151,7 +1172,7 @@ export function HostWizard({}: undefined}- secretKeys={secretMode === 'new' ? llmSecretKeys : []}+ secretKeys={chainRequiresSecret && secretMode === 'new' ? llmSecretKeys : []}fallbackProvidersInitiallyCollapseddisabled={busy}/>diff --git a/control-ui/components/HostWizard/types.ts b/control-ui/components/HostWizard/types.tsindex d3e61097c..1ce5abd57 100644--- a/control-ui/components/HostWizard/types.ts+++ b/control-ui/components/HostWizard/types.ts@@ -35,6 +35,10 @@ export type CreatedResource = {name: string}+// LLM Secret mode for Host create. A broker-only chain hides this entirely+// and omits spec.secretRef; mixed/static chains still require an exact Secret.+export type HostLlmSecretMode = 'existing' | 'new'+export type HostWizardProps = {existingSecrets: SecretMeta[]mcpServers: McpServer[]diff --git a/control-ui/components/LlmProviderConfig/index.tsx b/control-ui/components/LlmProviderConfig/index.tsxindex 812d6fce8..19cb5bde5 100644--- a/control-ui/components/LlmProviderConfig/index.tsx+++ b/control-ui/components/LlmProviderConfig/index.tsx@@ -138,15 +138,16 @@ export function LlmProviderConfig({icon: <LlmProviderIcon provider={provider} label={getProviderLabel(provider)} />,}))if (primaryModelOutOfAllowlist) {+ const saved = catalog.find(entry => entry.provider === provider && entry.model === model)options.push({value: model,label: model,icon: <LlmProviderIcon provider={provider} label={getProviderLabel(provider)} />,- badge: 'out of allowlist',+ badge: saved?.stale ? 'stale' : saved && !saved.enabled ? 'disabled' : 'out of allowlist',})}return options- }, [model, primaryModelOptions, primaryModelOutOfAllowlist, provider])+ }, [catalog, model, primaryModelOptions, primaryModelOutOfAllowlist, provider])// Replace every entry for one provider with the operator's new selection,// leaving the other providers' subsets untouched. Selecting none removes thediff --git a/control-ui/components/RecipeEditor.tsx b/control-ui/components/RecipeEditor.tsxindex 8264d6676..990188330 100644--- a/control-ui/components/RecipeEditor.tsx+++ b/control-ui/components/RecipeEditor.tsx@@ -25,6 +25,7 @@ import {} from '../lib/api'import { analyzeWorkflowRecipeEgress } from '../lib/egressModel'import type { EgressBinding, EgressEditorStatus } from '../lib/egressModel'+import { brokerBackedRecipeAuthoringError } from '../lib/llm'import { DEFAULT_OPERATOR_DEFAULTS, applyDefaults } from '../lib/recipeDefaults'import {type RecipeSecretNamespaces,@@ -292,6 +293,41 @@ const TEMPLATES: RecipeTemplate[] = [2),},+ {+ label: 'Agentic Workflow (Codex Subscription)',+ json: JSON.stringify(+ {+ apiVersion: 'clerum.io/v1alpha1',+ kind: 'WorkflowRecipe',+ metadata: { name: 'codex-subscription-workflow' },+ spec: {+ agent: {+ provider: 'codex-subscription',+ model: 'gpt-5.1',+ },+ triggers: {+ onDemand: {+ allowedActors: ['user', 'autonomous'],+ },+ },+ steps: [+ {+ id: 'draft',+ instruction: 'Draft a concise answer for: {{inputs.topic}}',+ timeoutSeconds: 600,+ },+ ],+ inputContract: {+ properties: {+ topic: { type: 'string', default: 'summarize this change' },+ },+ },+ },+ },+ null,+ 2+ ),+ },{label: 'Agentic Workload Template Resolution',json: JSON.stringify(@@ -1656,6 +1692,15 @@ export function RecipeEditor({ initial, onSaved, onCancel, pageHeader }: Props)// L2 decides if the CRD is structurally and policy-valid. Missing// declarative Secret refs come back as pending credentials and do not// block creation; real validation errors still fail closed here.+ const brokerError = brokerBackedRecipeAuthoringError(specToUse)+ if (brokerError) {+ setServerValidation({+ valid: false,+ errors: [{ field: 'spec.agent', rule: 'codexBrokerAuthoring', message: brokerError }],+ })+ return+ }+setDeployPhase('validating')const l2 = await validateRecipeServer({diff --git a/control-ui/components/RecipeSecretsPanel/index.tsx b/control-ui/components/RecipeSecretsPanel/index.tsxindex 9e2bec2ef..676a354aa 100644--- a/control-ui/components/RecipeSecretsPanel/index.tsx+++ b/control-ui/components/RecipeSecretsPanel/index.tsx@@ -9,6 +9,7 @@ import {getRecipe,getRecipeSecrets,} from '../../lib/api'+import { llmChainRequiresSecret } from '../../lib/llm'import { collectWorkflowRecipeSecretRefs } from '../../lib/workflowRecipeSecretRefs'import { useConfirmDialog } from '../ConfirmDialog'import { TablePanelHeader } from '../TablePanelHeader'@@ -54,6 +55,7 @@ export function RecipeSecretsPanel({}) {const router = useRouter()const [rows, setRows] = useState<Row[]>([])+ const [brokerBackedAgent, setBrokerBackedAgent] = useState(false)const [loading, setLoading] = useState(true)const [error, setError] = useState('')const [deletingName, setDeletingName] = useState<string | null>(null)@@ -72,6 +74,10 @@ export function RecipeSecretsPanel({const spec = (recipe.spec ?? {}) as Record<string, unknown>const refs = collectWorkflowRecipeSecretRefs(spec)+ const agent = (spec.agent ?? {}) as { provider?: string }+ setBrokerBackedAgent(+ typeof agent.provider === 'string' && !llmChainRequiresSecret(agent.provider)+ )const next: Row[] = []for (const ref of refs.values()) {@@ -199,7 +205,11 @@ export function RecipeSecretsPanel({<span className="cu-muted">Loading secrets…</span></div>) : rows.length === 0 ? (- <div className="cu-empty">This recipe declares no API-key Secret references.</div>+ <div className="cu-empty">+ {brokerBackedAgent+ ? 'This recipe uses a broker-backed agent and does not require an LLM secret.'+ : 'This recipe declares no API-key Secret references.'}+ </div>) : (<div className="cu-table-wrap"><table className="cu-table">diff --git a/control-ui/components/TokenBudgetForm/index.tsx b/control-ui/components/TokenBudgetForm/index.tsxindex 58c032fed..3636e8117 100644--- a/control-ui/components/TokenBudgetForm/index.tsx+++ b/control-ui/components/TokenBudgetForm/index.tsx@@ -14,7 +14,7 @@ import {getRecipeSecrets,} from '@lib/api'import { useLlmAllowedModels } from '@lib/hooks/useLlmAllowedModels'-import { LLM_PROVIDER_OPTIONS, getAllModelOptions } from '@lib/llm'+import { LLM_PROVIDER_OPTIONS, budgetUnitAllowedForProviders, getAllModelOptions } from '@lib/llm'import { ScopeSelector } from './ScopeSelector'import { DEFAULT_CURRENCY, DEFAULT_TIMEZONE } from './constants'import type { ScopeDimensionConfig, ScopeOption, TokenBudgetFormProps } from './types'@@ -169,8 +169,15 @@ export function TokenBudgetForm({const minStartInvalid = minStartValue === null || minStartValue < 0const maxTaskInvalid = maxTaskAmount.trim() !== '' && (maxTaskValue === null || maxTaskValue <= 0)const currencyInvalid = unit === 'cost' && currency.trim().length === 0+ const codexCostInvalid =+ unit === 'cost' && !budgetUnitAllowedForProviders('cost', scope.provider ?? [])const hasErrors =- nameInvalid || limitInvalid || minStartInvalid || maxTaskInvalid || currencyInvalid+ nameInvalid ||+ limitInvalid ||+ minStartInvalid ||+ maxTaskInvalid ||+ currencyInvalid ||+ codexCostInvalid// Live unpriced surfacing (§6.2): derived from the CURRENT form scope and the// loaded price list, not the saved snapshot — so it appears on create and@@ -237,11 +244,21 @@ export function TokenBudgetForm({autoFocus/></Field>- <Field htmlFor="budget-unit" label="Unit" required>+ <Field+ htmlFor="budget-unit"+ label="Unit"+ required+ error={+ showErrors && codexCostInvalid+ ? 'Codex subscription budgets must use unit tokens, not cost.'+ : undefined+ }+ ><SelectInputid="budget-unit"value={unit}onChange={event => setUnit(event.target.value as 'cost' | 'tokens')}+ invalid={showErrors && codexCostInvalid}disabled={saving}><option value="cost">Cost (currency)</option>diff --git a/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx b/control-ui/components/__tests__/HostDetailsPage.identity.test.tsxindex f112c249c..ebfc2b4eb 100644--- a/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx+++ b/control-ui/components/__tests__/HostDetailsPage.identity.test.tsx@@ -319,4 +319,61 @@ describe('HostDetailsPage identity integration', () => {// reverted saved ctx-a. Pre-collateral-fix this reads 'ctx-a'.expect((screen.getByRole('combobox') as HTMLSelectElement).value).toBe('ctx-b')})++ it('saves a Codex-only Host without secretRef and keeps metadata.name as identity', async () => {+ const { secretRef: _omit, ...specWithoutSecret } = host.spec+ void _omit+ const codexHost = {+ ...host,+ spec: {+ ...specWithoutSecret,+ model: { provider: 'codex-subscription', name: 'gpt-5.1' },+ },+ }+ ;(api.getHostDetailBundle as unknown as ReturnType<typeof vi.fn>).mockResolvedValue({+ host: codexHost,+ 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(codexHost)+ ;(api.getLlmModels as unknown as ReturnType<typeof vi.fn>).mockResolvedValue({+ rows: [+ {+ id: 'm-codex',+ provider: 'codex-subscription',+ model: 'gpt-5.1',+ vendor: 'OpenAI',+ display_name: null,+ context_window_tokens: null,+ enabled: true,+ stale: false,+ created_at: '',+ updated_at: '',+ },+ ],+ })+ mockParams = { name: 'foo', tab: 'model' }+ render(<HostDetailsPage />)++ expect(await screen.findByText('Broker-backed — no LLM secret required')).toBeInTheDocument()+ fireEvent.click(screen.getByRole('button', { name: 'Edit' }))+ fireEvent.click(screen.getByRole('button', { name: 'Save' }))++ await waitFor(() =>+ expect(api.apiSend).toHaveBeenCalledWith('PUT', '/api/v1/admin/hosts/foo', expect.any(Object))+ )+ const putCall = (api.apiSend as unknown as ReturnType<typeof vi.fn>).mock.calls.find(+ c => c[0] === 'PUT' && c[1] === '/api/v1/admin/hosts/foo'+ )+ const payload = putCall![2]+ expect(payload.spec.model).toEqual({ provider: 'codex-subscription', name: 'gpt-5.1' })+ expect(payload.spec.secretRef).toBeUndefined()+ expect(payload.spec.hostRef).toBeUndefined()+ expect(payload.spec.userId).toBeUndefined()+ expect(payload.metadata?.name).toBeUndefined()+ })})diff --git a/control-ui/components/__tests__/HostWizard.test.tsx b/control-ui/components/__tests__/HostWizard.test.tsxindex 3c63bbb79..d782196f1 100644--- a/control-ui/components/__tests__/HostWizard.test.tsx+++ b/control-ui/components/__tests__/HostWizard.test.tsx@@ -73,6 +73,30 @@ vi.mock('../../lib/api', () => ({created_at: '',updated_at: '',},+ {+ id: 'm4',+ provider: 'codex-subscription',+ model: 'gpt-5.1',+ vendor: 'OpenAI',+ display_name: null,+ context_window_tokens: null,+ enabled: true,+ stale: false,+ created_at: '',+ updated_at: '',+ },+ {+ id: 'm5',+ provider: 'codex-subscription',+ model: 'old-codex',+ vendor: 'OpenAI',+ display_name: null,+ context_window_tokens: null,+ enabled: true,+ stale: true,+ created_at: '',+ updated_at: '',+ },],}),isSilentApiError: vi.fn().mockReturnValue(false),@@ -201,6 +225,8 @@ async function build409(bodyObj: Record<string, unknown>): Promise<Error> {afterEach(() => {cleanup()vi.clearAllMocks()+ vi.mocked(api.apiSend).mockReset()+ vi.mocked(api.apiSend).mockResolvedValue({})})describe('HostWizard — credential draft is projected onto the active provider domain', () => {@@ -739,3 +765,87 @@ describe('HostWizard — create-only seam + compensation (R5-C1/R5-B1, V-1, V-7)expect(api.apiSend).toHaveBeenCalledWith('DELETE', '/api/v1/admin/secrets/crd-agent-llm')})})++async function walkToModelStep(opts?: { agentName?: string }) {+ const name = opts?.agentName ?? 'codex-agent'+ await waitFor(() => {+ expect(api.getAdminUsers).toHaveBeenCalled()+ })+ fireEvent.change(screen.getByPlaceholderText(/agent-name/i), { target: { value: name } })+ fireEvent.click(screen.getByRole('button', { name: 'Next' }))+ fireEvent.click(screen.getByLabelText(/Create new context/i))+ fireEvent.change(screen.getByPlaceholderText(/context-name/i), { target: { value: 'ctx1' } })+ fireEvent.click(screen.getByRole('button', { name: 'Next' }))+ await waitFor(() => {+ expect(+ screen.getByLabelText('Provider', { selector: '#llm-primary-provider' })+ ).toBeInTheDocument()+ })+}++async function selectCodexSubscription(model = 'gpt-5.1') {+ fireEvent.click(screen.getByLabelText('Provider', { selector: '#llm-primary-provider' }))+ fireEvent.click(screen.getByRole('option', { name: /OpenAI Codex Subscription/i }))+ await waitFor(() => {+ expect(screen.queryByText(/Use an existing secret/i)).not.toBeInTheDocument()+ })+ fireEvent.click(screen.getByLabelText('Default model', { selector: '#llm-primary-model' }))+ fireEvent.click(screen.getByRole('option', { name: model }))+}++describe('HostWizard — broker-backed Codex authoring', () => {+ it('creates a Codex-only Host without secretRef or a Secret POST', async () => {+ await renderWizard()+ await walkToModelStep({ agentName: 'codex-only' })+ await selectCodexSubscription()+ expect(screen.queryByLabelText(/OpenAI API key/i)).not.toBeInTheDocument()+ fireEvent.click(screen.getByLabelText('Default model', { selector: '#llm-primary-model' }))+ expect(screen.queryByRole('option', { name: 'old-codex' })).not.toBeInTheDocument()+ fireEvent.click(screen.getByRole('button', { name: 'Next' }))+ fireEvent.click(screen.getByRole('button', { name: /Create Agent/i }))++ await waitFor(() => {+ expect(api.apiSend).toHaveBeenCalledWith(+ 'POST',+ '/api/v1/admin/hosts',+ expect.objectContaining({+ metadata: { name: 'codex-only' },+ spec: expect.objectContaining({+ model: { provider: 'codex-subscription', name: 'gpt-5.1' },+ }),+ })+ )+ })+ const hostCall = vi+ .mocked(api.apiSend)+ .mock.calls.find(call => call[0] === 'POST' && call[1] === '/api/v1/admin/hosts')+ expect(hostCall?.[2]).not.toHaveProperty('spec.secretRef')+ expect((hostCall?.[2] as { spec: Record<string, unknown> }).spec.secretRef).toBeUndefined()+ expect(+ vi+ .mocked(api.apiSend)+ .mock.calls.some(call => call[0] === 'POST' && call[1] === '/api/v1/admin/secrets')+ ).toBe(false)+ })++ it('requires exact credential slots when a static fallback joins a Codex primary', async () => {+ await renderWizard()+ await walkToModelStep({ agentName: 'codex-mixed' })+ await selectCodexSubscription()+ fireEvent.click(screen.getByRole('button', { name: /Fallback providers/i }))+ fireEvent.click(screen.getByRole('button', { name: /Add fallback provider/i }))+ fireEvent.change(screen.getByLabelText('Provider', { selector: '#llm-fallback-0-provider' }), {+ target: { value: 'openai' },+ })+ await waitFor(() => {+ expect(screen.getByText(/Use an existing secret/i)).toBeInTheDocument()+ })+ expect(screen.getByRole('button', { name: 'Next' })).toBeDisabled()+ fireEvent.click(screen.getByLabelText(/Use an existing Secret/i))+ fireEvent.click(screen.getByRole('button', { name: /Select secret/i }))+ fireEvent.click(screen.getByRole('option', { name: /secret-a/i }))+ await waitFor(() => {+ expect(screen.getByRole('button', { name: 'Next' })).not.toBeDisabled()+ })+ })+})diff --git a/control-ui/components/__tests__/RecipeEditor.test.tsx b/control-ui/components/__tests__/RecipeEditor.test.tsxindex a5b1fb363..8684afd9e 100644--- a/control-ui/components/__tests__/RecipeEditor.test.tsx+++ b/control-ui/components/__tests__/RecipeEditor.test.tsx@@ -1681,4 +1681,56 @@ describe('RecipeEditor — grants in editor', () => {// Inline error surfaces in the grants panel.expect(screen.getByText(/could not be saved/)).toBeInTheDocument()})++ it('deploys a Codex-only recipe without an LLM secretRef', async () => {+ const onSaved = vi.fn()+ render(<RecipeEditor onSaved={onSaved} onCancel={vi.fn()} />)+ fireEvent.change(screen.getByRole('combobox'), {+ target: { value: 'Agentic Workflow (Codex Subscription)' },+ })+ reviewAndProceedToDeploy()+ fireEvent.click(await screen.findByText('Deploy plugin'))+ await waitFor(() => expect(api.createRecipe).toHaveBeenCalled())+ const createPayload = vi.mocked(api.createRecipe).mock.calls[0][0] as {+ spec: { agent?: { provider?: string; model?: string; secretRef?: unknown } }+ }+ expect(createPayload.spec.agent).toEqual({+ provider: 'codex-subscription',+ model: 'gpt-5.1',+ })+ expect(createPayload.spec.agent?.secretRef).toBeUndefined()+ expect(onSaved).toHaveBeenCalled()+ })++ it('blocks a Codex recipe that still declares an LLM secretRef', async () => {+ render(<RecipeEditor onSaved={vi.fn()} onCancel={vi.fn()} />)+ fireEvent.change(screen.getByRole('textbox'), {+ target: {+ value: JSON.stringify(+ {+ apiVersion: 'clerum.io/v1alpha1',+ kind: 'WorkflowRecipe',+ metadata: { name: 'codex-with-secret' },+ spec: {+ agent: {+ provider: 'codex-subscription',+ model: 'gpt-5.1',+ secretRef: { name: 'codex-oauth', key: 'refreshToken' },+ },+ triggers: { onDemand: { allowedActors: ['user'] } },+ steps: [{ id: 'draft', instruction: 'Write', timeoutSeconds: 600 }],+ },+ },+ null,+ 2+ ),+ },+ })+ reviewAndProceedToDeploy()+ fireEvent.click(await screen.findByText('Deploy plugin'))+ await waitFor(() => {+ expect(screen.getByText(/must not declare an LLM secretRef/i)).toBeInTheDocument()+ })+ expect(api.createRecipe).not.toHaveBeenCalled()+ })})diff --git a/control-ui/components/__tests__/RecipeSecretsPanel.test.tsx b/control-ui/components/__tests__/RecipeSecretsPanel.test.tsxindex febaa3a5b..8e29632e6 100644--- a/control-ui/components/__tests__/RecipeSecretsPanel.test.tsx+++ b/control-ui/components/__tests__/RecipeSecretsPanel.test.tsx@@ -130,4 +130,29 @@ describe('RecipeSecretsPanel', () => {'/secrets/recipe/operator-api-credentials/edit?namespace=sandbox-recipes')})++ it('does not invent an LLM secret row for a Codex-only recipe', async () => {+ vi.mocked(getRecipe).mockResolvedValue({+ ...recipe,+ metadata: { ...recipe.metadata, name: 'codex-recipe' },+ spec: {+ agent: { provider: 'codex-subscription', model: 'gpt-5.1' },+ steps: [{ id: 'draft', instruction: 'Write' }],+ },+ })+ vi.mocked(getRecipeSecrets).mockResolvedValue({ items: [] })++ render(+ <ToastProvider>+ <RecipeSecretsPanel recipeName="codex-recipe" />+ </ToastProvider>+ )++ expect(+ await screen.findByText(+ 'This recipe uses a broker-backed agent and does not require an LLM secret.'+ )+ ).toBeInTheDocument()+ expect(screen.queryByText('Missing')).not.toBeInTheDocument()+ })})diff --git a/control-ui/lib/__tests__/llm.test.ts b/control-ui/lib/__tests__/llm.test.tsindex d340658f5..e11509bdc 100644--- a/control-ui/lib/__tests__/llm.test.ts+++ b/control-ui/lib/__tests__/llm.test.ts@@ -5,10 +5,14 @@ import {LLM_CREDENTIAL_GROUPS,LLM_DEFAULT_MODEL_BY_PROVIDER,type LlmModelCatalogEntry,+ brokerBackedRecipeAuthoringError,+ budgetUnitAllowedForProviders,getAllModelOptions,getLlmGroupCompleteness,getModelOptions,inferProviderFromModels,+ llmChainRequiresSecret,+ providerRequiresLlmSecret,resolveDefaultModel,validateLlmSecretData,} from '../llm'@@ -43,6 +47,19 @@ describe('getModelOptions', () => {it('returns an empty list for a provider with no rows', () => {expect(getModelOptions(CATALOG, 'vertex')).toEqual([])})++ it('hides stale models from new picks unless includeStale is set', () => {+ const catalog: LlmModelCatalogEntry[] = [+ { provider: 'codex-subscription', model: 'gpt-5.1', enabled: true },+ { provider: 'codex-subscription', model: 'old-codex', enabled: true, stale: true },+ { provider: 'codex-subscription', model: 'disabled-codex', enabled: false },+ ]+ expect(getModelOptions(catalog, 'codex-subscription')).toEqual(['gpt-5.1'])+ expect(getModelOptions(catalog, 'codex-subscription', { includeStale: true })).toEqual([+ 'gpt-5.1',+ 'old-codex',+ ])+ })})describe('getAllModelOptions', () => {@@ -128,7 +145,7 @@ describe('LLM_CREDENTIAL_GROUPS (spec R4.5.1/R4.5.2)', () => {expect(codex.slots).toEqual([])expect(codex.nonSecretEnv).toEqual([])expect(LLM_DEFAULT_MODEL_BY_PROVIDER['codex-subscription']).toBeUndefined()- expect(resolveDefaultModel('codex-subscription', ['gpt-5.1'])).toBe('gpt-5.1')+ expect(resolveDefaultModel('codex-subscription', ['gpt-5.1'])).toBe('')})})@@ -145,6 +162,15 @@ describe('getLlmGroupCompleteness (spec R4.5.5)', () => {expect(getLlmGroupCompleteness(openai, () => true).usable).toBe(true)})+ it('treats a zero-slot oauth-broker provider as usable without any keys', () => {+ const codex = LLM_CREDENTIAL_GROUPS.find(g => g.provider === 'codex-subscription')!+ expect(getLlmGroupCompleteness(codex, () => false)).toEqual({+ present: 0,+ total: 0,+ usable: true,+ })+ })+it('is usable for Bedrock only when both required slots are present', () => {expect(getLlmGroupCompleteness(bedrock, k => k === 'aws-access-key-id')).toEqual({present: 1,@@ -204,3 +230,48 @@ describe('validateLlmSecretData (spec R4.5.3)', () => {).toEqual([])})})++describe('broker-backed authoring helpers', () => {+ it('requires a Secret only when any static-credentials provider is in the chain', () => {+ expect(providerRequiresLlmSecret('codex-subscription')).toBe(false)+ expect(providerRequiresLlmSecret('openai')).toBe(true)+ expect(llmChainRequiresSecret('codex-subscription')).toBe(false)+ expect(llmChainRequiresSecret('codex-subscription', [{ provider: 'openai' }])).toBe(true)+ expect(llmChainRequiresSecret('openai', [{ provider: 'codex-subscription' }])).toBe(true)+ })++ it('rejects cost-unit budgets when a broker provider is in scope', () => {+ expect(budgetUnitAllowedForProviders('tokens', ['codex-subscription'])).toBe(true)+ expect(budgetUnitAllowedForProviders('cost', ['openai'])).toBe(true)+ expect(budgetUnitAllowedForProviders('cost', ['codex-subscription'])).toBe(false)+ expect(budgetUnitAllowedForProviders('cost', ['openai', 'codex-subscription'])).toBe(false)+ })++ it('rejects Codex recipe authoring that omits the model, ships a secretRef, or uses cost', () => {+ expect(+ brokerBackedRecipeAuthoringError({+ agent: { provider: 'codex-subscription', model: 'gpt-5.1' },+ })+ ).toBeNull()+ expect(+ brokerBackedRecipeAuthoringError({+ agent: { provider: 'codex-subscription' },+ })+ ).toMatch(/explicit catalog model/)+ expect(+ brokerBackedRecipeAuthoringError({+ agent: {+ provider: 'codex-subscription',+ model: 'gpt-5.1',+ secretRef: { name: 'codex-oauth', key: 'refresh' },+ },+ })+ ).toMatch(/must not declare an LLM secretRef/)+ expect(+ brokerBackedRecipeAuthoringError({+ agent: { provider: 'codex-subscription', model: 'gpt-5.1' },+ budget: { unit: 'cost' },+ })+ ).toMatch(/unit tokens/)+ })+})diff --git a/control-ui/lib/__tests__/workflowRecipeSecretRefs.test.ts b/control-ui/lib/__tests__/workflowRecipeSecretRefs.test.tsindex 8fb5ae15e..fd2251f52 100644--- a/control-ui/lib/__tests__/workflowRecipeSecretRefs.test.ts+++ b/control-ui/lib/__tests__/workflowRecipeSecretRefs.test.ts@@ -72,4 +72,29 @@ describe('collectWorkflowRecipeSecretRefs', () => {['sandbox-ui', 'ui-creds', ['token']],])})++ it('does not invent an LLM Secret for a Codex-only agent, even if secretRef is leftover', () => {+ const refs = collectWorkflowRecipeSecretRefs({+ agent: {+ provider: 'codex-subscription',+ model: 'gpt-5.1',+ secretRef: { name: 'codex-oauth', key: 'refreshToken' },+ },+ steps: [{ id: 'draft', instruction: 'Write a note' }],+ })+ expect([...refs.values()]).toEqual([])+ })++ it('collects an agent secretRef only when the agent uses static credentials', () => {+ const refs = collectWorkflowRecipeSecretRefs({+ agent: {+ provider: 'openai',+ model: 'gpt-5.4',+ secretRef: { name: 'openai-llm', key: 'openai-api-key' },+ },+ })+ expect([...refs.values()].map(ref => [ref.namespace, ref.secretName, [...ref.keys]])).toEqual([+ ['sandbox-recipes', 'openai-llm', ['openai-api-key']],+ ])+ })})diff --git a/control-ui/lib/llm.ts b/control-ui/lib/llm.tsindex 464ce8c86..e1b9d7ae6 100644--- a/control-ui/lib/llm.ts+++ b/control-ui/lib/llm.ts@@ -1,5 +1,6 @@import {type LlmProviderId,+ PROVIDER_AUTH_MODE,PROVIDER_CREDENTIAL_SLOTS,PROVIDER_DISPLAY_LABELS,PROVIDER_IDS,@@ -55,6 +56,10 @@ export type LlmModelCatalogEntry = {provider: stringmodel: stringenabled: boolean+ // Discovery rows that vanished stay visible on already-saved Hosts but must+ // not appear as a new pick. The API always normalizes this; optional here so+ // unit fixtures can omit it (treated as not stale).+ stale?: boolean}// Wizard pre-select / fallback default per provider. This stays static on@@ -173,13 +178,17 @@ export const BEDROCK_CREDENTIAL_KEYS: string[] = PROVIDER_CREDENTIAL_SLOTS.bedroslot => slot.dataKey)-// Group completeness for the "provider usable" chip (spec R4.5.5): a provider is-// usable once every `required` slot has a value. `present` counts required slots-// filled; `usable` is true when all required slots are present.+// Completeness follows `authMode`, not "are there required slots?". A+// zero-slot oauth-broker provider is usable without a Kubernetes Secret.+// Static-credentials providers stay usable only when every required slot is+// present. `present`/`total` count required slots (always 0 for brokers).export function getLlmGroupCompleteness(group: LlmCredentialGroup,isPresent: (dataKey: string) => boolean): { present: number; total: number; usable: boolean } {+ if (PROVIDER_AUTH_MODE[group.provider] === 'oauth-broker') {+ return { present: 0, total: 0, usable: true }+ }const required = group.slots.filter(slot => slot.required)const present = required.filter(slot => isPresent(slot.dataKey)).lengthreturn {@@ -189,6 +198,59 @@ export function getLlmGroupCompleteness(}}+// True when this provider still needs a Host/recipe LLM Secret. Broker-backed+// providers (Codex) authenticate via Control API tickets, never via slots.+export function providerRequiresLlmSecret(provider: string): boolean {+ return isLlmProviderId(provider) && PROVIDER_AUTH_MODE[provider] === 'static-credentials'+}++// A Host/recipe LLM chain needs a Secret iff any target (primary or fallback)+// uses static credentials. Codex-only chains save without `secretRef`.+export function llmChainRequiresSecret(+ primary: string,+ fallbacks?: Array<{ provider: string }>+): boolean {+ if (providerRequiresLlmSecret(primary)) return true+ return (fallbacks ?? []).some(entry => providerRequiresLlmSecret(entry.provider))+}++// Codex (and any future oauth-broker) cannot be priced in currency — Token+// Budget `unit=cost` is rejected when the scoped providers include a broker.+export function providerAllowsCostBudget(provider: string): boolean {+ return !isLlmProviderId(provider) || PROVIDER_AUTH_MODE[provider] !== 'oauth-broker'+}++export function budgetUnitAllowedForProviders(+ unit: 'cost' | 'tokens',+ providers: readonly string[]+): boolean {+ if (unit !== 'cost') return true+ return providers.every(providerAllowsCostBudget)+}++// Recipe authoring guard: a broker-backed agent must name an explicit model+// and must not carry an LLM secretRef or a cost-unit budget.+export function brokerBackedRecipeAuthoringError(spec: Record<string, unknown>): string | null {+ const agent = spec.agent+ if (!agent || typeof agent !== 'object' || Array.isArray(agent)) return null+ const record = agent as Record<string, unknown>+ const provider = typeof record.provider === 'string' ? record.provider : ''+ if (!isLlmProviderId(provider) || PROVIDER_AUTH_MODE[provider] !== 'oauth-broker') {+ return null+ }+ const model = typeof record.model === 'string' ? record.model.trim() : ''+ if (!model) return 'Codex subscription requires an explicit catalog model.'+ if (record.secretRef != null) {+ return 'Codex subscription recipes must not declare an LLM secretRef.'+ }+ const budget = spec.budget+ if (budget && typeof budget === 'object' && !Array.isArray(budget)) {+ const unit = (budget as Record<string, unknown>).unit+ if (unit === 'cost') return 'Codex subscription budgets must use unit tokens, not cost.'+ }+ return null+}+// UI descriptor for a group's usable/partial/absent chip (spec R4.5.5). Single// required slot reads present/absent; multi-slot reads the filled/required ratio// (● usable / ◐ partial / ○ absent). Shared by every per-provider block so the@@ -388,10 +450,15 @@ export function formatContextWindow(value: number | null | undefined): string {export function getModelOptions(catalog: LlmModelCatalogEntry[],provider: string,- options: { includeDisabled?: boolean } = {}+ options: { includeDisabled?: boolean; includeStale?: boolean } = {}): string[] {return catalog- .filter(entry => entry.provider === provider && (options.includeDisabled || entry.enabled))+ .filter(+ entry =>+ entry.provider === provider &&+ (options.includeDisabled || entry.enabled) &&+ (options.includeStale || !entry.stale)+ ).map(entry => entry.model)}@@ -399,12 +466,13 @@ export function getModelOptions(// suggestions). De-duplicated, insertion order preserved.export function getAllModelOptions(catalog: LlmModelCatalogEntry[],- options: { includeDisabled?: boolean } = {}+ options: { includeDisabled?: boolean; includeStale?: boolean } = {}): string[] {const seen = new Set<string>()const out: string[] = []for (const entry of catalog) {if (!options.includeDisabled && !entry.enabled) continue+ if (!options.includeStale && entry.stale) continueif (seen.has(entry.model)) continueseen.add(entry.model)out.push(entry.model)@@ -417,6 +485,9 @@ export function getAllModelOptions(// the provider has no enabled models (caller shows an empty/error picker; no// hardcoded fallback per spec R4.5.1).export function resolveDefaultModel(provider: LlmProvider, enabledModels: string[]): string {+ // Broker-backed providers have no static default and must never silently+ // pick the first enabled catalog row — the operator names the model.+ if (PROVIDER_AUTH_MODE[provider] === 'oauth-broker') return ''const explicit = LLM_DEFAULT_MODEL_BY_PROVIDER[provider]if (explicit && enabledModels.includes(explicit)) return explicitreturn enabledModels[0] ?? ''diff --git a/control-ui/lib/workflowRecipeSecretRefs.ts b/control-ui/lib/workflowRecipeSecretRefs.tsindex 382118bee..740a1494f 100644--- a/control-ui/lib/workflowRecipeSecretRefs.ts+++ b/control-ui/lib/workflowRecipeSecretRefs.ts@@ -1,3 +1,5 @@+import { providerRequiresLlmSecret } from './llm'+export type WorkflowRecipeSecretRefUsage = {secretName: stringnamespace: string@@ -94,6 +96,15 @@ export function collectWorkflowRecipeSecretRefs(}}+ // Agent LLM secrets are collected only for static-credentials providers.+ // Broker-backed agents (Codex) authenticate via tickets and must never+ // invent or surface an OAuth/LLM Secret from spec.agent.+ const agent = (spec.agent ?? {}) as Record<string, unknown>+ if (typeof agent.provider === 'string' && providerRequiresLlmSecret(agent.provider)) {+ const secretRef = (agent.secretRef ?? {}) as Record<string, unknown>+ addRef(refs, secretRef.name, secretRef.key, namespaces.recipeNamespace)+ }+return refs}