Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-5185: add Codex Fast mode (#5821)
Multica Eve6992c58de3a3
diff --git a/packages/core/types/agent.ts b/packages/core/types/agent.tsindex 894ce03386..5ada701a04 100644--- a/packages/core/types/agent.ts+++ b/packages/core/types/agent.ts@@ -443,6 +443,12 @@ export interface Agent {* (MUL-2339).*/thinking_level?: string;+ /**+ * Runtime-native Codex service tier (for example `priority`, displayed as+ * Fast). Empty/undefined means no override: local Codex configuration and+ * account defaults remain authoritative.+ */+ service_tier?: string;owner_id: string | null;skills: AgentSkillSummary[];/** Runtime-local skills this agent must not inherit. Older servers omit it. */@@ -510,6 +516,8 @@ export interface CreateAgentRequest {model?: string;/** Optional runtime-native reasoning/effort token. See `Agent.thinking_level`. */thinking_level?: string;+ /** Optional Codex service-tier catalog ID. See `Agent.service_tier`. */+ service_tier?: string;/** Optional template slug used by the onboarding agent picker. Surfaced* as the `template` property on the `agent_created` PostHog event. */template?: string;@@ -671,6 +679,11 @@ export interface UpdateAgentRequest {* runtime's provider enum, rejected with 400 if not recognised*/thinking_level?: string;+ /**+ * Codex service-tier override. Omitted preserves the saved value, `""`+ * clears it, and a non-empty value stores a runtime-catalog ID.+ */+ service_tier?: string;}/**@@ -888,6 +901,17 @@ export interface RuntimeModel {* picker for this model". See MUL-2339.*/thinking?: RuntimeModelThinking;+ /** Runtime-native execution tiers advertised for this exact model. */+ service_tiers?: RuntimeModelServiceTier[];+}++export interface RuntimeModelServiceTier {+ /** Catalog ID sent to the provider protocol unchanged. */+ id: string;+ /** Provider-owned display name, for example `Fast`. */+ name: string;+ /** Optional provider-owned helper copy. */+ description?: string;}export interface RuntimeModelThinking {diff --git a/packages/core/types/index.ts b/packages/core/types/index.tsindex 791c0f6a23..7c1dd86015 100644--- a/packages/core/types/index.ts+++ b/packages/core/types/index.ts@@ -53,6 +53,7 @@ export type {RuntimeUpdate,RuntimeUpdateStatus,RuntimeModel,+ RuntimeModelServiceTier,RuntimeModelThinking,RuntimeModelThinkingLevel,RuntimeModelListRequest,diff --git a/packages/views/agents/components/agent-detail-inspector.tsx b/packages/views/agents/components/agent-detail-inspector.tsxindex 80b582e158..cdcb2e69c9 100644--- a/packages/views/agents/components/agent-detail-inspector.tsx+++ b/packages/views/agents/components/agent-detail-inspector.tsx@@ -24,6 +24,7 @@ import { ResourceLabelPicker } from "../../labels/resource-label-picker";import { ModelPicker } from "./inspector/model-picker";import { RuntimePicker } from "./inspector/runtime-picker";import { ThinkingSettingField } from "./inspector/thinking-prop-row";+import { ServiceTierSettingField } from "./inspector/service-tier-setting-field";interface InspectorProps {agent: Agent;@@ -220,12 +221,16 @@ export function AgentDetailInspector({members={members}currentUserId={currentUserId}canEdit={canEdit}- // Model and thinking level are per-runtime/per-model; clear both- // so the new runtime resolves its own defaults instead of keeping- // values it may not support (a stale thinking level would linger- // as an orphan token otherwise).+ // Model, thinking level, and service tier are runtime/model+ // native. Clear them together so the new runtime resolves its+ // own defaults instead of inheriting incompatible tokens.onChange={(id) =>- update({ runtime_id: id, model: "", thinking_level: "" })+ update({+ runtime_id: id,+ model: "",+ thinking_level: "",+ service_tier: "",+ })}/></SettingsRow>@@ -255,6 +260,15 @@ export function AgentDetailInspector({update({ thinking_level: thinkingLevel })}/>+ <ServiceTierSettingField+ label={t(($) => $.inspector.prop_speed)}+ runtimeId={agent.runtime_id}+ runtimeOnline={!!isOnline}+ model={agent.model ?? ""}+ value={agent.service_tier ?? ""}+ canEdit={canEdit}+ onChange={(serviceTier) => update({ service_tier: serviceTier })}+ /><SettingsRowlabel={t(($) => $.inspector.prop_concurrency)}size="select-wide"diff --git a/packages/views/agents/components/inspector/service-tier-setting-field.test.tsx b/packages/views/agents/components/inspector/service-tier-setting-field.test.tsxnew file mode 100644index 0000000000..0b72f95863--- /dev/null+++ b/packages/views/agents/components/inspector/service-tier-setting-field.test.tsx@@ -0,0 +1,139 @@+// @vitest-environment jsdom++import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import {+ cleanup,+ fireEvent,+ render,+ screen,+ waitFor,+} from "@testing-library/react";+import type {+ RuntimeModel,+ RuntimeModelListRequest,+} from "@multica/core/types";+import { I18nProvider } from "@multica/core/i18n/react";+import enAgents from "../../../locales/en/agents.json";+import enCommon from "../../../locales/en/common.json";+import enIssues from "../../../locales/en/issues.json";++const mockInitiateListModels = vi.hoisted(() => vi.fn());+const mockGetListModelsResult = vi.hoisted(() => vi.fn());++vi.mock("@multica/core/api", () => ({+ api: {+ initiateListModels: (...args: unknown[]) =>+ mockInitiateListModels(...args),+ getListModelsResult: (...args: unknown[]) =>+ mockGetListModelsResult(...args),+ },+}));++import { ServiceTierSettingField } from "./service-tier-setting-field";++const FAST_MODEL: RuntimeModel = {+ id: "gpt-5.6-sol",+ label: "GPT-5.6 Sol",+ service_tiers: [+ {+ id: "priority",+ name: "Fast",+ description: "1.5x speed, increased usage",+ },+ ],+};++function listResult(models: RuntimeModel[]): RuntimeModelListRequest {+ return {+ id: "request-1",+ runtime_id: "runtime-1",+ status: "completed",+ models,+ supported: true,+ created_at: "2026-07-23T00:00:00Z",+ updated_at: "2026-07-23T00:00:00Z",+ };+}++function renderField(+ props: Partial<React.ComponentProps<typeof ServiceTierSettingField>> = {},+) {+ const onChange = vi.fn();+ const queryClient = new QueryClient({+ defaultOptions: { queries: { retry: false } },+ });+ render(+ <I18nProvider+ locale="en"+ resources={{+ en: { common: enCommon, agents: enAgents, issues: enIssues },+ }}+ >+ <QueryClientProvider client={queryClient}>+ <ServiceTierSettingField+ label="Speed"+ runtimeId="runtime-1"+ runtimeOnline+ model="gpt-5.6-sol"+ value=""+ canEdit+ onChange={onChange}+ {...props}+ />+ </QueryClientProvider>+ </I18nProvider>,+ );+ return { onChange };+}++describe("ServiceTierSettingField", () => {+ beforeEach(() => {+ vi.clearAllMocks();+ mockInitiateListModels.mockResolvedValue(listResult([FAST_MODEL]));+ mockGetListModelsResult.mockResolvedValue(listResult([FAST_MODEL]));+ });++ afterEach(cleanup);++ it("renders catalog-owned Fast copy and persists its runtime id", async () => {+ const { onChange } = renderField();++ await screen.findByText("Speed");+ fireEvent.click(screen.getByRole("button"));+ expect(await screen.findByText("1.5x speed, increased usage")).toBeInTheDocument();+ fireEvent.click(screen.getByText("Fast"));++ expect(onChange).toHaveBeenCalledWith("priority");+ });++ it("hides when the model has no tiers and no value is persisted", async () => {+ mockInitiateListModels.mockResolvedValue(+ listResult([{ id: "gpt-5.4-mini", label: "GPT-5.4 mini" }]),+ );+ renderField({ model: "gpt-5.4-mini" });++ await waitFor(() => expect(mockInitiateListModels).toHaveBeenCalled());+ expect(screen.queryByText("Speed")).toBeNull();+ });++ it("fails closed for an unresolved config.toml model", async () => {+ renderField({ model: "" });++ await waitFor(() => expect(mockInitiateListModels).toHaveBeenCalled());+ expect(screen.queryByText("Speed")).toBeNull();+ });++ it("keeps a stale value visible and lets the user clear it", async () => {+ const { onChange } = renderField({+ model: "gpt-5.4-mini",+ value: "priority",+ });++ await screen.findByText("Speed");+ expect(await screen.findByText("priority")).toBeInTheDocument();+ fireEvent.click(screen.getByRole("button"));+ fireEvent.click(await screen.findByTitle(/Clear the speed override/i));+ expect(onChange).toHaveBeenCalledWith("");+ });+});diff --git a/packages/views/agents/components/inspector/service-tier-setting-field.tsx b/packages/views/agents/components/inspector/service-tier-setting-field.tsxnew file mode 100644index 0000000000..0173b6b98d--- /dev/null+++ b/packages/views/agents/components/inspector/service-tier-setting-field.tsx@@ -0,0 +1,162 @@+"use client";++import { useState, type ReactNode } from "react";+import { useQuery } from "@tanstack/react-query";+import { ChevronDown, Gauge } from "lucide-react";+import type {+ RuntimeModel,+ RuntimeModelServiceTier,+} from "@multica/core/types";+import { runtimeModelsOptions } from "@multica/core/runtimes";+import {+ PickerItem,+ PropertyPicker,+} from "../../../issues/components/pickers";+import { SettingsRow } from "../../../settings/components/settings-layout";+import { useT } from "../../../i18n";++/**+ * Full-width service-tier field for Codex agents. Capability comes from the+ * exact model's live catalog rather than a hard-coded Fast switch. An empty+ * model follows config.toml and cannot be resolved safely, so the field fails+ * closed unless a saved value needs to remain visible for explicit clearing.+ */+export function ServiceTierSettingField({+ label,+ runtimeId,+ runtimeOnline,+ model,+ value,+ canEdit,+ onChange,+}: {+ label: ReactNode;+ runtimeId: string | null;+ runtimeOnline: boolean;+ model: string;+ value: string;+ canEdit: boolean;+ onChange: (next: string) => Promise<void> | void;+}) {+ const modelsQuery = useQuery(+ runtimeModelsOptions(runtimeOnline ? runtimeId : null),+ );+ const entry = pickModelEntry(modelsQuery.data?.models ?? [], model);+ const tiers = entry?.service_tiers ?? [];++ if (tiers.length === 0 && !value) return null;++ return (+ <SettingsRow label={label} size="select-wide">+ <ServiceTierPicker+ value={value}+ tiers={tiers}+ canEdit={canEdit}+ onChange={onChange}+ />+ </SettingsRow>+ );+}++function ServiceTierPicker({+ value,+ tiers,+ canEdit,+ onChange,+}: {+ value: string;+ tiers: RuntimeModelServiceTier[];+ canEdit: boolean;+ onChange: (next: string) => Promise<void> | void;+}) {+ const { t } = useT("agents");+ const [open, setOpen] = useState(false);+ const selected = value ? tiers.find((tier) => tier.id === value) : undefined;+ const triggerLabel =+ selected?.name || value || t(($) => $.pickers.service_tier_default);+ const triggerTitle = t(($) => $.pickers.service_tier_tooltip, {+ value: triggerLabel,+ });++ const select = async (next: string) => {+ setOpen(false);+ if (next !== value) await onChange(next);+ };++ const display = (+ <div className="flex min-h-10 items-center gap-2 rounded-lg border border-input bg-input/50 px-3 text-sm text-muted-foreground">+ <Gauge className="h-4 w-4 shrink-0" aria-hidden="true" />+ <span className="min-w-0 truncate">{triggerLabel}</span>+ </div>+ );+ if (!canEdit) return display;++ return (+ <PropertyPicker+ open={open}+ onOpenChange={setOpen}+ width="w-[var(--anchor-width)] min-w-[14rem] max-w-md"+ align="start"+ tooltip={triggerTitle}+ triggerRender={+ <button+ type="button"+ className="flex min-h-10 w-full min-w-0 items-center gap-2 rounded-lg border border-input bg-transparent px-3 text-left text-sm transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50"+ aria-label={triggerTitle}+ />+ }+ trigger={+ <>+ <Gauge+ className="h-4 w-4 shrink-0 text-muted-foreground"+ aria-hidden="true"+ />+ <span className="min-w-0 flex-1 truncate">{triggerLabel}</span>+ <ChevronDown+ className={`h-4 w-4 shrink-0 text-muted-foreground transition-transform ${+ open ? "rotate-180" : ""+ }`}+ aria-hidden="true"+ />+ </>+ }+ >+ {tiers.map((tier) => (+ <PickerItem+ key={tier.id}+ selected={tier.id === value}+ onClick={() => void select(tier.id)}+ >+ <span className="block min-w-0 flex-1 text-left">+ <span className="truncate text-[13px] font-medium">+ {tier.name}+ </span>+ {tier.description ? (+ <span className="mt-0.5 block text-[11px] leading-snug text-muted-foreground">+ {tier.description}+ </span>+ ) : null}+ </span>+ </PickerItem>+ ))}+ {value ? (+ <button+ type="button"+ onClick={() => void select("")}+ className="mt-1 flex w-full items-center border-t px-3 py-2 text-left text-xs text-muted-foreground transition-colors hover:bg-accent/50"+ title={t(($) => $.pickers.service_tier_clear_title)}+ >+ {t(($) => $.pickers.service_tier_clear)}+ </button>+ ) : null}+ </PropertyPicker>+ );+}++function pickModelEntry(+ models: RuntimeModel[],+ model: string,+): RuntimeModel | undefined {+ if (!model) return undefined;+ return models.find((entry) => entry.id === model);+}diff --git a/packages/views/locales/en/agents.json b/packages/views/locales/en/agents.jsonindex a8aa8a6a01..c3f30faff2 100644--- a/packages/views/locales/en/agents.json+++ b/packages/views/locales/en/agents.json@@ -161,7 +161,7 @@"section_profile": "Profile","section_profile_hint": "Manage how this agent appears across the workspace.","section_execution": "Execution",- "section_execution_hint": "Choose the runtime, model, reasoning level, and parallel task limit.",+ "section_execution_hint": "Choose the runtime, model, reasoning level, speed, and parallel task limit.","section_access": "Access","section_access_hint": "Control who can run this agent and use its connected capabilities.","section_properties": "Properties",@@ -172,6 +172,7 @@"prop_runtime": "Runtime","prop_model": "Model","prop_thinking": "Thinking",+ "prop_speed": "Speed","prop_visibility": "Visibility","prop_concurrency": "Concurrency","prop_owner": "Owner",@@ -231,7 +232,11 @@"thinking_default": "Follow CLI config","thinking_tooltip": "Thinking · {{value}}","thinking_clear": "Follow CLI config",- "thinking_clear_title": "Clear the override and let the local CLI config (claude/codex) decide the reasoning level"+ "thinking_clear_title": "Clear the override and let the local CLI config (claude/codex) decide the reasoning level",+ "service_tier_default": "Runtime default",+ "service_tier_tooltip": "Speed · {{value}}",+ "service_tier_clear": "Runtime default",+ "service_tier_clear_title": "Clear the speed override and let the local Codex configuration decide"},"model_dropdown": {"label": "Model",diff --git a/packages/views/locales/ja/agents.json b/packages/views/locales/ja/agents.jsonindex 8ac62d985e..1f33d64235 100644--- a/packages/views/locales/ja/agents.json+++ b/packages/views/locales/ja/agents.json@@ -145,7 +145,7 @@"section_profile": "プロフィール","section_profile_hint": "ワークスペース内でのエージェントの表示を管理します。","section_execution": "実行設定",- "section_execution_hint": "ランタイム、モデル、思考レベル、同時タスク数を設定します。",+ "section_execution_hint": "ランタイム、モデル、思考レベル、速度、同時タスク数を設定します。","section_access": "アクセス","section_access_hint": "このエージェントと接続済み機能を利用できる相手を管理します。","section_properties": "プロパティ",@@ -156,6 +156,7 @@"prop_runtime": "ランタイム","prop_model": "モデル","prop_thinking": "思考",+ "prop_speed": "速度","prop_visibility": "公開範囲","prop_concurrency": "同時実行数","prop_owner": "オーナー",@@ -214,7 +215,11 @@"thinking_default": "CLI 設定に従う","thinking_tooltip": "思考 · {{value}}","thinking_clear": "CLI 設定に従う",- "thinking_clear_title": "上書きをクリアし、推論レベルをローカルの CLI 設定(claude/codex)に任せます"+ "thinking_clear_title": "上書きをクリアし、推論レベルをローカルの CLI 設定(claude/codex)に任せます",+ "service_tier_default": "ランタイムのデフォルト",+ "service_tier_tooltip": "速度 · {{value}}",+ "service_tier_clear": "ランタイムのデフォルト",+ "service_tier_clear_title": "速度の上書きをクリアし、ローカルの Codex 設定に任せます"},"model_dropdown": {"label": "モデル",diff --git a/packages/views/locales/ko/agents.json b/packages/views/locales/ko/agents.jsonindex 96107dd345..d55d17229e 100644--- a/packages/views/locales/ko/agents.json+++ b/packages/views/locales/ko/agents.json@@ -153,7 +153,7 @@"section_profile": "프로필","section_profile_hint": "워크스페이스에서 이 에이전트가 표시되는 방식을 관리합니다.","section_execution": "실행 설정",- "section_execution_hint": "런타임, 모델, 추론 수준과 병렬 작업 한도를 설정합니다.",+ "section_execution_hint": "런타임, 모델, 추론 수준, 속도와 병렬 작업 한도를 설정합니다.","section_access": "접근 권한","section_access_hint": "이 에이전트와 연결된 기능을 사용할 수 있는 대상을 관리합니다.","section_properties": "속성",@@ -164,6 +164,7 @@"prop_runtime": "런타임","prop_model": "모델","prop_thinking": "추론",+ "prop_speed": "속도","prop_visibility": "공개 범위","prop_concurrency": "동시 실행","prop_owner": "소유자",@@ -222,7 +223,11 @@"thinking_default": "CLI 설정 따르기","thinking_tooltip": "추론 · {{value}}","thinking_clear": "CLI 설정 따르기",- "thinking_clear_title": "재정의를 지우고 추론 수준을 로컬 CLI 설정(claude/codex)에 맡깁니다"+ "thinking_clear_title": "재정의를 지우고 추론 수준을 로컬 CLI 설정(claude/codex)에 맡깁니다",+ "service_tier_default": "런타임 기본값",+ "service_tier_tooltip": "속도 · {{value}}",+ "service_tier_clear": "런타임 기본값",+ "service_tier_clear_title": "속도 재정의를 지우고 로컬 Codex 설정에 맡깁니다"},"model_dropdown": {"label": "모델",diff --git a/packages/views/locales/zh-Hans/agents.json b/packages/views/locales/zh-Hans/agents.jsonindex 9d249f6130..c2a73ea7e3 100644--- a/packages/views/locales/zh-Hans/agents.json+++ b/packages/views/locales/zh-Hans/agents.json@@ -153,7 +153,7 @@"section_profile": "资料","section_profile_hint": "管理该智能体在工作区内的展示方式。","section_execution": "执行配置",- "section_execution_hint": "选择运行时、模型、思考强度和并行任务上限。",+ "section_execution_hint": "选择运行时、模型、思考强度、速度和并行任务上限。","section_access": "访问权限","section_access_hint": "控制谁可以运行该智能体并使用它已连接的能力。","section_properties": "属性",@@ -164,6 +164,7 @@"prop_runtime": "运行时","prop_model": "模型","prop_thinking": "思考",+ "prop_speed": "速度","prop_visibility": "可见性","prop_concurrency": "并发","prop_owner": "所有者",@@ -222,7 +223,11 @@"thinking_default": "跟随 CLI 配置","thinking_tooltip": "思考 · {{value}}","thinking_clear": "跟随 CLI 配置",- "thinking_clear_title": "清除覆盖,让本地 CLI(claude/codex)的配置决定推理级别"+ "thinking_clear_title": "清除覆盖,让本地 CLI(claude/codex)的配置决定推理级别",+ "service_tier_default": "运行时默认",+ "service_tier_tooltip": "速度 · {{value}}",+ "service_tier_clear": "运行时默认",+ "service_tier_clear_title": "清除速度覆盖,交由本地 Codex 配置决定"},"model_dropdown": {"label": "模型",diff --git a/server/cmd/multica/cmd_agent.go b/server/cmd/multica/cmd_agent.goindex 6052dd7b2d..011c7738f4 100644--- a/server/cmd/multica/cmd_agent.go+++ b/server/cmd/multica/cmd_agent.go@@ -164,6 +164,7 @@ func init() {agentCreateCmd.Flags().String("runtime-config", "", "Runtime config as JSON string")agentCreateCmd.Flags().String("model", "", "Model identifier (e.g. claude-sonnet-4-6, openai/gpt-4o). Prefer this over passing --model in --custom-args.")agentCreateCmd.Flags().String("thinking-level", "", "Reasoning/effort level for the agent's runtime (e.g. Claude: low|medium|high|xhigh|max; Codex values come from the runtime model catalog). The set is runtime/model-specific; malformed values are rejected server-side and the daemon validates the exact model/level pair. Empty = runtime default.")+ agentCreateCmd.Flags().String("service-tier", "", "Codex execution service tier from the selected model's runtime catalog (e.g. priority, displayed as Fast). Empty = inherit local Codex configuration.")agentCreateCmd.Flags().String("custom-args", "", "Custom CLI arguments as JSON array. For model selection prefer --model; some providers (codex app-server, openclaw) reject --model in custom_args.")agentCreateCmd.Flags().String("custom-env", "", "Custom environment variables as JSON object, e.g. '{\"KEY\":\"value\"}'. Treated as secret material — never logged by the CLI, but values passed on the command line are visible to shell history and 'ps'; prefer --custom-env-stdin or --custom-env-file for real secrets. Pass '{}' to set an empty map.")agentCreateCmd.Flags().Bool("custom-env-stdin", false, "Read the --custom-env JSON object from stdin. Keeps secrets out of shell history and 'ps'. Mutually exclusive with --custom-env and --custom-env-file.")@@ -186,6 +187,7 @@ func init() {agentUpdateCmd.Flags().String("runtime-config", "", "New runtime config as JSON string")agentUpdateCmd.Flags().String("model", "", "New model identifier. Pass an empty string to clear and fall back to the runtime default.")agentUpdateCmd.Flags().String("thinking-level", "", "New reasoning/effort level for the agent's runtime (e.g. Claude: low|medium|high|xhigh|max; Codex values come from the runtime model catalog). The set is runtime/model-specific; malformed values are rejected server-side and the daemon validates the exact model/level pair. Pass an empty string to clear and fall back to the runtime default.")+ agentUpdateCmd.Flags().String("service-tier", "", "New Codex execution service tier from the selected model's runtime catalog. Pass an empty string to clear and inherit local Codex configuration.")agentUpdateCmd.Flags().String("custom-args", "", "New custom CLI arguments as JSON array. For model selection prefer --model; some providers (codex app-server, openclaw) reject --model in custom_args.")// custom_env is intentionally NOT part of `agent update`. Use// `multica agent env set <id>` — that path is owner/admin-only,@@ -591,6 +593,10 @@ func runAgentCreate(cmd *cobra.Command, _ []string) error {v, _ := cmd.Flags().GetString("thinking-level")body["thinking_level"] = v}+ if cmd.Flags().Changed("service-tier") {+ v, _ := cmd.Flags().GetString("service-tier")+ body["service_tier"] = v+ }if cmd.Flags().Changed("visibility") {v, _ := cmd.Flags().GetString("visibility")body["visibility"] = v@@ -668,6 +674,10 @@ func runAgentUpdate(cmd *cobra.Command, args []string) error {v, _ := cmd.Flags().GetString("thinking-level")body["thinking_level"] = v}+ if cmd.Flags().Changed("service-tier") {+ v, _ := cmd.Flags().GetString("service-tier")+ body["service_tier"] = v+ }if cmd.Flags().Changed("visibility") {v, _ := cmd.Flags().GetString("visibility")body["visibility"] = v@@ -688,7 +698,7 @@ func runAgentUpdate(cmd *cobra.Command, args []string) error {}if len(body) == 0 {- return fmt.Errorf("no fields to update; use --name, --description, --instructions, --runtime-id, --runtime-config, --model, --thinking-level, --custom-args, --mcp-config, --visibility, --status, or --max-concurrent-tasks (env vars now live behind `multica agent env set <id>`)")+ return fmt.Errorf("no fields to update; use --name, --description, --instructions, --runtime-id, --runtime-config, --model, --thinking-level, --service-tier, --custom-args, --mcp-config, --visibility, --status, or --max-concurrent-tasks (env vars now live behind `multica agent env set <id>`)")}ctx, cancel := cli.APIContext(context.Background())diff --git a/server/cmd/multica/cmd_agent_test.go b/server/cmd/multica/cmd_agent_test.goindex bfb4eec523..1fa2376eb0 100644--- a/server/cmd/multica/cmd_agent_test.go+++ b/server/cmd/multica/cmd_agent_test.go@@ -1766,6 +1766,79 @@ func TestAgentCreateAndUpdateExposeThinkingLevelFlag(t *testing.T) {}}+func TestAgentServiceTierFlagsAndBodies(t *testing.T) {+ if agentCreateCmd.Flag("service-tier") == nil {+ t.Error("agent create must expose --service-tier")+ }+ if agentUpdateCmd.Flag("service-tier") == nil {+ t.Error("agent update must expose --service-tier")+ }++ t.Run("create sends catalog id", func(t *testing.T) {+ var gotBody map[string]any+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ if err := json.NewDecoder(r.Body).Decode(&gotBody); err != nil {+ t.Errorf("decode request body: %v", err)+ }+ json.NewEncoder(w).Encode(map[string]any{"id": "agent-123"})+ }))+ defer srv.Close()+ t.Setenv("MULTICA_SERVER_URL", srv.URL)+ t.Setenv("MULTICA_WORKSPACE_ID", "ws-1")+ t.Setenv("MULTICA_TOKEN", "test-token")+ t.Setenv("MULTICA_AGENT_ID", "")+ t.Setenv("MULTICA_TASK_ID", "")++ cmd := &cobra.Command{Use: "create"}+ cmd.Flags().String("name", "", "")+ cmd.Flags().String("runtime-id", "", "")+ cmd.Flags().String("service-tier", "", "")+ cmd.Flags().String("output", "json", "")+ cmd.Flags().String("profile", "", "")+ _ = cmd.Flags().Set("name", "FastAgent")+ _ = cmd.Flags().Set("runtime-id", "runtime-1")+ _ = cmd.Flags().Set("service-tier", "priority")++ if err := runAgentCreate(cmd, nil); err != nil {+ t.Fatalf("runAgentCreate: %v", err)+ }+ if gotBody["service_tier"] != "priority" {+ t.Fatalf("service_tier body = %v, want priority", gotBody["service_tier"])+ }+ })++ t.Run("update sends explicit clear", func(t *testing.T) {+ var gotBody map[string]any+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ if err := json.NewDecoder(r.Body).Decode(&gotBody); err != nil {+ t.Errorf("decode request body: %v", err)+ }+ json.NewEncoder(w).Encode(map[string]any{"id": "agent-123"})+ }))+ defer srv.Close()+ t.Setenv("MULTICA_SERVER_URL", srv.URL)+ t.Setenv("MULTICA_WORKSPACE_ID", "ws-1")+ t.Setenv("MULTICA_TOKEN", "test-token")+ t.Setenv("MULTICA_AGENT_ID", "")+ t.Setenv("MULTICA_TASK_ID", "")++ cmd := &cobra.Command{Use: "update"}+ cmd.Flags().String("service-tier", "", "")+ cmd.Flags().String("output", "json", "")+ cmd.Flags().String("profile", "", "")+ if err := cmd.Flags().Set("service-tier", ""); err != nil {+ t.Fatal(err)+ }++ if err := runAgentUpdate(cmd, []string{"agent-123"}); err != nil {+ t.Fatalf("runAgentUpdate: %v", err)+ }+ if value, ok := gotBody["service_tier"]; !ok || value != "" {+ t.Fatalf("service_tier clear body = %v (exists=%v), want empty string", value, ok)+ }+ })+}+// TestAgentCreateThinkingLevelServerRejectionSurfaces proves the CLI does not// own thinking-level validation: a runtime whose provider has no thinking// concept (or an unknown literal) is rejected server-side with a 400, and thatdiff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.goindex 807012c8e1..beea6baa3c 100644--- a/server/internal/daemon/daemon.go+++ b/server/internal/daemon/daemon.go@@ -2472,12 +2472,18 @@ func (d *Daemon) handleModelList(ctx context.Context, rt Runtime, requestID striSupportedLevels []thinkingLevelWire `json:"supported_levels"`DefaultLevel string `json:"default_level,omitempty"`}+ type modelServiceTierWire struct {+ ID string `json:"id"`+ Name string `json:"name"`+ Description string `json:"description,omitempty"`+ }type modelWire struct {- ID string `json:"id"`- Label string `json:"label"`- Provider string `json:"provider,omitempty"`- Default bool `json:"default,omitempty"`- Thinking *modelThinkingWire `json:"thinking,omitempty"`+ ID string `json:"id"`+ Label string `json:"label"`+ Provider string `json:"provider,omitempty"`+ Default bool `json:"default,omitempty"`+ Thinking *modelThinkingWire `json:"thinking,omitempty"`+ ServiceTiers []modelServiceTierWire `json:"service_tiers,omitempty"`}wire := make([]modelWire, 0, len(models))for _, m := range models {@@ -2501,6 +2507,13 @@ func (d *Daemon) handleModelList(ctx context.Context, rt Runtime, requestID striDefaultLevel: m.Thinking.DefaultLevel,}}+ for _, tier := range m.ServiceTiers {+ entry.ServiceTiers = append(entry.ServiceTiers, modelServiceTierWire{+ ID: tier.ID,+ Name: tier.Name,+ Description: tier.Description,+ })+ }wire = append(wire, entry)}d.reportModelListResult(ctx, rt, requestID, map[string]any{@@ -4594,8 +4607,33 @@ func (d *Daemon) runTask(ctx context.Context, task Task, provider string, slot imodel = entry.Model}thinkingLevel := ""+ serviceTier := ""if task.Agent != nil {thinkingLevel = task.Agent.ThinkingLevel+ serviceTier = task.Agent.ServiceTier+ }+ // service_tier is catalog-owned and currently Codex-only. As with+ // thinking_level, stale or incompatible persisted values degrade to the+ // runtime default instead of failing the task. Catalog lookup errors pass+ // through so a transient discovery failure does not silently disable a+ // previously valid user choice.+ if serviceTier != "" {+ ok, err := agent.ValidateServiceTier(ctx, provider, entry.Path, model, serviceTier)+ if err != nil {+ taskLog.Warn("service_tier: catalog lookup failed; passing through",+ "provider", provider,+ "model", model,+ "service_tier", serviceTier,+ "error", err,+ )+ } else if !ok {+ taskLog.Warn("service_tier: not valid for this (provider, model); skipping injection",+ "provider", provider,+ "model", model,+ "service_tier", serviceTier,+ )+ serviceTier = ""+ }}// Per-model guard: the server validates the literal token against the// provider's enum, but per-model gaps (Claude's `xhigh` on a non-Opus@@ -4649,6 +4687,7 @@ func (d *Daemon) runTask(ctx context.Context, task Task, provider string, slot iCustomArgs: customArgs,McpConfig: mcpConfig,ThinkingLevel: thinkingLevel,+ ServiceTier: serviceTier,OpenclawMode: openclawMode,ClaudeSettingsPath: env.ClaudeSettingsPath,}diff --git a/server/internal/daemon/types.go b/server/internal/daemon/types.goindex 9dacff19aa..a4611e5471 100644--- a/server/internal/daemon/types.go+++ b/server/internal/daemon/types.go@@ -176,6 +176,7 @@ type AgentData struct {McpConfig json.RawMessage `json:"mcp_config,omitempty"`Model string `json:"model,omitempty"`ThinkingLevel string `json:"thinking_level,omitempty"`+ ServiceTier string `json:"service_tier,omitempty"`DisabledRuntimeSkills []DisabledRuntimeSkillData `json:"disabled_runtime_skills,omitempty"`// RuntimeConfig is the per-provider runtime_config JSON as stored on// the agent record, forwarded verbatim by the claim endpoint. Thediff --git a/server/internal/handler/agent.go b/server/internal/handler/agent.goindex 12c0acbcd3..5b5a8e9650 100644--- a/server/internal/handler/agent.go+++ b/server/internal/handler/agent.go@@ -73,6 +73,9 @@ type AgentResponse struct {// for this agent (empty = use runtime default). The picker is per-runtime// per-model; the API never normalizes across providers. See MUL-2339.ThinkingLevel string `json:"thinking_level"`+ // ServiceTier is the runtime-native Codex execution tier persisted for+ // this agent (empty = inherit local Codex configuration).+ ServiceTier string `json:"service_tier"`// ComposioToolkitAllowlist is the subset of Composio toolkit slugs this// agent is allowed to mount as MCP at task dispatch — for ANY run that// passes the agent's invocation permission, using the agent OWNER's@@ -173,6 +176,7 @@ func agentToResponse(a db.Agent) AgentResponse {MaxConcurrentTasks: a.MaxConcurrentTasks,Model: a.Model.String,ThinkingLevel: a.ThinkingLevel.String,+ ServiceTier: a.ServiceTier.String,ComposioToolkitAllowlist: composioAllowlist,OwnerID: uuidToPtr(a.OwnerID),Skills: []AgentSkillSummary{},@@ -568,6 +572,7 @@ type TaskAgentData struct {McpConfig json.RawMessage `json:"mcp_config,omitempty"`Model string `json:"model,omitempty"`ThinkingLevel string `json:"thinking_level,omitempty"`+ ServiceTier string `json:"service_tier,omitempty"`DisabledRuntimeSkills []DisabledRuntimeSkill `json:"disabled_runtime_skills,omitempty"`// RuntimeConfig is the agent's saved runtime_config JSON as-is. The// daemon decodes it per-provider — e.g. the openclaw backend reads@@ -940,6 +945,7 @@ type CreateAgentRequest struct {MaxConcurrentTasks int32 `json:"max_concurrent_tasks"`Model string `json:"model"`ThinkingLevel string `json:"thinking_level"`+ ServiceTier string `json:"service_tier"`// ComposioToolkitAllowlist seeds the per-task overlay gate (MUL-3869). On// create only the calling user can be the owner, so we accept the field// unconditionally here; the cross-owner permission gate lives on PUT.@@ -1059,6 +1065,10 @@ func (h *Handler) CreateAgent(w http.ResponseWriter, r *http.Request) {writeError(w, http.StatusBadRequest, fmt.Sprintf("thinking_level %q is not a recognised value for runtime %q", req.ThinkingLevel, runtime.Provider))return}+ if !agent.IsKnownServiceTier(runtime.Provider, req.ServiceTier) {+ writeError(w, http.StatusBadRequest, fmt.Sprintf("service_tier %q is not a recognised value for runtime %q", req.ServiceTier, runtime.Provider))+ return+ }// Probe workspace agent count BEFORE the insert so the funnel has a// clean "first agent ever in this workspace" signal — Step 4 of@@ -1145,6 +1155,7 @@ func (h *Handler) CreateAgent(w http.ResponseWriter, r *http.Request) {McpConfig: mc,Model: pgtype.Text{String: req.Model, Valid: req.Model != ""},ThinkingLevel: pgtype.Text{String: req.ThinkingLevel, Valid: req.ThinkingLevel != ""},+ ServiceTier: pgtype.Text{String: req.ServiceTier, Valid: req.ServiceTier != ""},ComposioToolkitAllowlist: allowlist,})if err != nil {@@ -1300,6 +1311,9 @@ type UpdateAgentRequest struct {// Distinguishing those modes is why this is a pointer; the raw-fields// map captured at decode time tells us whether the key was sent.ThinkingLevel *string `json:"thinking_level"`+ // ServiceTier follows the same tri-state contract as ThinkingLevel:+ // omitted preserves, empty clears, and non-empty sets a Codex catalog ID.+ ServiceTier *string `json:"service_tier"`// ComposioToolkitAllowlist is a tri-state, same pattern as// thinking_level, mcp_config:// - field omitted → no change (column preserved as-is)@@ -1707,6 +1721,46 @@ func (h *Handler) UpdateAgent(w http.ResponseWriter, r *http.Request) {}}+ shouldClearServiceTier := false+ if req.ServiceTier != nil {+ value := *req.ServiceTier+ if value == "" {+ shouldClearServiceTier = true+ } else {+ provider := targetProvider+ if provider == "" {+ var ok bool+ provider, ok = h.resolveAgentProvider(r, existing.WorkspaceID, targetRuntimeID)+ if !ok {+ writeError(w, http.StatusInternalServerError, "failed to resolve runtime for service_tier validation")+ return+ }+ }+ if !agent.IsKnownServiceTier(provider, value) {+ writeError(w, http.StatusBadRequest, fmt.Sprintf("service_tier %q is not a recognised value for runtime %q", value, provider))+ return+ }+ params.ServiceTier = pgtype.Text{String: value, Valid: true}+ }+ } else if req.RuntimeID != nil && existing.ServiceTier.Valid && existing.ServiceTier.String != "" {+ provider := targetProvider+ if provider == "" {+ var ok bool+ provider, ok = h.resolveAgentProvider(r, existing.WorkspaceID, targetRuntimeID)+ if !ok {+ writeError(w, http.StatusInternalServerError, "failed to resolve runtime for service_tier validation")+ return+ }+ }+ if !agent.IsKnownServiceTier(provider, existing.ServiceTier.String) {+ writeError(w, http.StatusBadRequest, fmt.Sprintf(+ "existing service_tier %q is not valid for runtime %q; pass service_tier=\"\" to clear or set a value valid for the new runtime",+ existing.ServiceTier.String, provider,+ ))+ return+ }+ }+// composio_toolkit_allowlist handling (MUL-3869). Tri-state semantics// mirror thinking_level (see above): omitted → no change, null →// ClearAgentComposioToolkitAllowlist, slice → wholesale replace.@@ -1751,9 +1805,9 @@ func (h *Handler) UpdateAgent(w http.ResponseWriter, r *http.Request) {return}- // mcp_config / thinking_level: null/empty in the request means explicitly- // clear the field. COALESCE in UpdateAgent cannot set a column to NULL,- // so we use dedicated clear queries.+ // Nullable runtime overrides: null/empty in the request means explicitly+ // clear the field. COALESCE in UpdateAgent cannot set a column to NULL, so+ // mcp_config, thinking_level, and service_tier use dedicated clear queries.if shouldClearMcpConfig {updated, err = h.Queries.ClearAgentMcpConfig(r.Context(), updated.ID)if err != nil {@@ -1770,6 +1824,14 @@ func (h *Handler) UpdateAgent(w http.ResponseWriter, r *http.Request) {return}}+ if shouldClearServiceTier {+ updated, err = h.Queries.ClearAgentServiceTier(r.Context(), updated.ID)+ if err != nil {+ slog.Warn("clear agent service_tier failed", append(logger.RequestAttrs(r), "error", err, "agent_id", id)...)+ writeError(w, http.StatusInternalServerError, "failed to clear service_tier: "+err.Error())+ return+ }+ }if shouldClearComposioAllowlist {updated, err = h.Queries.ClearAgentComposioToolkitAllowlist(r.Context(), updated.ID)if err != nil {diff --git a/server/internal/handler/agent_thinking_test.go b/server/internal/handler/agent_thinking_test.goindex b772ef3a8a..537ae77d3a 100644--- a/server/internal/handler/agent_thinking_test.go+++ b/server/internal/handler/agent_thinking_test.go@@ -98,6 +98,70 @@ func TestCreateAgent_ThinkingLevel_ValidationConsistency(t *testing.T) {})}+func TestAgentServiceTierValidationAndTriState(t *testing.T) {+ if testHandler == nil {+ t.Skip("database not available")+ }++ ctx := context.Background()+ codexRuntimeID := createCodexProviderRuntime(t)+ claudeRuntimeID := createClaudeProviderRuntime(t)++ t.Run("create persists Codex catalog id", func(t *testing.T) {+ body := map[string]any{+ "name": "service-tier-create",+ "runtime_id": codexRuntimeID,+ "visibility": "private",+ "max_concurrent_tasks": 1,+ "model": "gpt-5.6-sol",+ "service_tier": "priority",+ }+ w := httptest.NewRecorder()+ testHandler.CreateAgent(w, newRequest(http.MethodPost, "/api/agents", body))+ if w.Code != http.StatusCreated {+ t.Fatalf("create service_tier: expected 201, got %d: %s", w.Code, w.Body.String())+ }+ var resp map[string]any+ _ = json.NewDecoder(w.Body).Decode(&resp)+ if resp["service_tier"] != "priority" {+ t.Fatalf("service_tier response = %v, want priority", resp["service_tier"])+ }+ agentID, _ := resp["id"].(string)+ t.Cleanup(func() {+ testPool.Exec(ctx, `DELETE FROM agent WHERE id = $1`, agentID)+ })++ clear := httptest.NewRecorder()+ req := withURLParam(newRequest(http.MethodPatch, "/api/agents/"+agentID, map[string]any{+ "service_tier": "",+ }), "id", agentID)+ testHandler.UpdateAgent(clear, req)+ if clear.Code != http.StatusOK {+ t.Fatalf("clear service_tier: expected 200, got %d: %s", clear.Code, clear.Body.String())+ }+ var cleared map[string]any+ _ = json.NewDecoder(clear.Body).Decode(&cleared)+ if cleared["service_tier"] != "" {+ t.Fatalf("cleared service_tier = %v, want empty", cleared["service_tier"])+ }+ })++ t.Run("non-Codex runtime rejects tier", func(t *testing.T) {+ body := map[string]any{+ "name": "service-tier-rejected",+ "runtime_id": claudeRuntimeID,+ "visibility": "private",+ "max_concurrent_tasks": 1,+ "service_tier": "priority",+ }+ w := httptest.NewRecorder()+ testHandler.CreateAgent(w, newRequest(http.MethodPost, "/api/agents", body))+ if w.Code != http.StatusBadRequest {+ t.Fatalf("Claude service_tier: expected 400, got %d: %s", w.Code, w.Body.String())+ }+ })+}+// TestUpdateAgent_ThinkingLevel_TriState covers the three modes of// the field on PATCH:// - field omitted → leave the existing value alone (the silent-cleardiff --git a/server/internal/handler/daemon.go b/server/internal/handler/daemon.goindex 41fae7aeb4..93a28cf9cd 100644--- a/server/internal/handler/daemon.go+++ b/server/internal/handler/daemon.go@@ -1647,6 +1647,7 @@ func (h *Handler) buildClaimedTaskResponse(r *http.Request, task *db.AgentTaskQuMcpConfig: mcpConfig,Model: agent.Model.String,ThinkingLevel: agent.ThinkingLevel.String,+ ServiceTier: agent.ServiceTier.String,RuntimeConfig: runtimeConfig,DisabledRuntimeSkills: disabledRuntimeSkillsFor(agent.DisabledRuntimeSkills, runtimeID, runtime.Provider),}diff --git a/server/internal/handler/runtime_models.go b/server/internal/handler/runtime_models.goindex 1bc8fd953e..af70b54eb8 100644--- a/server/internal/handler/runtime_models.go+++ b/server/internal/handler/runtime_models.go@@ -74,11 +74,18 @@ type ModelListRequest struct {// field, which is fine: the UI hides the selector and the agent runs// with the runtime default.type ModelEntry struct {- ID string `json:"id"`- Label string `json:"label"`- Provider string `json:"provider,omitempty"`- Default bool `json:"default,omitempty"`- Thinking *ModelThinking `json:"thinking,omitempty"`+ ID string `json:"id"`+ Label string `json:"label"`+ Provider string `json:"provider,omitempty"`+ Default bool `json:"default,omitempty"`+ Thinking *ModelThinking `json:"thinking,omitempty"`+ ServiceTiers []ModelServiceTier `json:"service_tiers,omitempty"`+}++type ModelServiceTier struct {+ ID string `json:"id"`+ Name string `json:"name"`+ Description string `json:"description,omitempty"`}// ModelThinking is the wire shape for the per-model thinking catalog.diff --git a/server/internal/service/builtin_skills/multica-creating-agents/SKILL.md b/server/internal/service/builtin_skills/multica-creating-agents/SKILL.mdindex 9a01e9445e..d2425a70a6 100644--- a/server/internal/service/builtin_skills/multica-creating-agents/SKILL.md+++ b/server/internal/service/builtin_skills/multica-creating-agents/SKILL.md@@ -24,8 +24,8 @@ multica agent env get <agent-id> --output json # plaintext env (owner/admin onl````agent get` returns the persisted agent including `runtime_id`, `model`,-`thinking_level`, `custom_args`, `has_custom_env`, `custom_env_key_count`, and-`skills`. It never returns plaintext `custom_env`.+`thinking_level`, `service_tier`, `custom_args`, `has_custom_env`,+`custom_env_key_count`, and `skills`. It never returns plaintext `custom_env`.## Core model@@ -58,12 +58,12 @@ multica agent create --name <name> --runtime-id <runtime-id> \`runAgentCreate` builds a JSON body and posts it to `/api/agents`. It onlyadds a key when its flag was provided — `description`/`instructions` on anon-empty value, the rest (`runtime-config`, `custom-args`, `model`,-`thinking-level`, `visibility`, …) on the flag being `Changed` — so omitted+`thinking-level`, `service-tier`, `visibility`, …) on the flag being `Changed` — so omittedflags fall through to server defaults rather than sending empty strings.The HTTP body (`CreateAgentRequest`) accepts: `name`, `description`,`instructions`, `avatar_url`, `runtime_id`, `runtime_config`, `custom_env`,-`custom_args`, `model`, `thinking_level`, `visibility`,+`custom_args`, `model`, `thinking_level`, `service_tier`, `visibility`,`max_concurrent_tasks`, `mcp_config`.## Field contracts@@ -77,6 +77,7 @@ The HTTP body (`CreateAgentRequest`) accepts: `name`, `description`,| `runtime_id` | `agent.runtime_id` | required (400) + must resolve to a runtime in this workspace | selects runtime/provider || `model` | `agent.model` (nullable) | none beyond runtime support | daemon reads; empty = runtime default || `thinking_level` | `agent.thinking_level` (nullable) | provider-level enum; unknown literal → 400 | daemon; empty = runtime default |+| `service_tier` | `agent.service_tier` (nullable) | Codex-only safe token; other providers reject; exact model/tier pair checked by daemon | daemon → Codex app-server; empty = local Codex config || `custom_args` | `agent.custom_args` (JSON array) | JSON shape checked CLI-side; server stores as-is | daemon (extra CLI switches); defaults to `[]` || `runtime_config` | `agent.runtime_config` (JSON) | JSON shape checked CLI-side; server stores as-is | runtime-specific config; defaults to `{}` || `custom_env` | `agent.custom_env` (JSON object) | — | daemon (process env); see Env & secrets |@@ -108,6 +109,14 @@ fixed-enum or safe-token gate, and the daemon performs the exact model/levelcheck. A runtime whose provider has no thinking concept rejects any non-emptyvalue with a 400.+`service_tier` is the matching first-class Codex speed control. Set it with+`--service-tier <catalog-id>` on create/update; use `--service-tier ""` on+update to clear it. The runtime model catalog owns both availability and+display copy (currently `priority`, shown as Fast). The server accepts safe+future Codex catalog IDs, while the daemon verifies the exact model/tier pair+before execution and omits a stale incompatible override. Agents without an+explicit model fail closed because the effective config.toml model is unknown.+### model vs custom_args`model` is a first-class persisted column the daemon reads directly.diff --git a/server/internal/service/builtin_skills/multica-creating-agents/references/creating-agents-source-map.md b/server/internal/service/builtin_skills/multica-creating-agents/references/creating-agents-source-map.mdindex 451eaf65fb..71fc04e02d 100644--- a/server/internal/service/builtin_skills/multica-creating-agents/references/creating-agents-source-map.md+++ b/server/internal/service/builtin_skills/multica-creating-agents/references/creating-agents-source-map.md@@ -17,21 +17,21 @@ go test ./internal/service -run TestBuiltinSkillsConformToTemplate| Contract | Line | Behavior | Safe check ||---|---|---|---|-| Create flags: `name`, `description`, `instructions`, `runtime-id` | 159–162 | Registered create flags; `name`/`runtime-id` enforced in `runAgentCreate` | `multica agent create --help` |-| `runtime-config`, `model`, `thinking-level`, `custom-args` flags | 163–166 | `model` help: "Prefer this over passing --model in --custom-args"; `thinking-level` is a thin pass-through (Codex values come from the runtime catalog; server applies a safe-token gate and the daemon checks the exact pair; empty = runtime default); `custom-args` help names codex/openclaw rejecting `--model` (CLI help only, not server-enforced) | `multica agent create --help` |-| Secret-safe env input: `custom-env`, `custom-env-stdin`, `custom-env-file` | 167–169 | `--custom-env` warns about shell history / `ps`; stdin and file modes keep secrets off the command line; mutually exclusive | `multica agent create --help` |-| Secret-safe MCP input: `mcp-config`, `mcp-config-stdin`, `mcp-config-file` (create) | 170–172 | Same three-channel pattern as `custom-env`; `--mcp-config` warns about shell history / `ps`; value must be a JSON object or `null` | `multica agent create --help` |-| MCP flags on `agent update` | 194–196 | Same three channels on update; `--mcp-config null` clears. Unlike `custom_env`, `mcp_config` IS settable via update | `multica agent update --help` |-| `thinking-level` flag on `agent update` | 184 | New reasoning/effort level; Codex values come from the runtime catalog; thin pass-through; `--thinking-level ""` clears to runtime default (mirrors `--model`) | `multica agent update --help` |-| `runAgentCreate` builds body + `POST /api/agents` | 419 | Only sets a body key when the flag `Changed`; posts to `/api/agents` (line 495) | read 419–496 |-| Body assembly: description/instructions/runtime-config/custom-args/custom-env/mcp-config/model/thinking-level | 438–488 | `resolveCustomEnv` (460) and `resolveMcpConfig` (465) gate their secret channels; `model` (470) and `thinking_level` (478) are `Changed`-gated pass-throughs; omitted flags are not sent | read 438–488 |-| `runAgentUpdate` sends `thinking_level` / `mcp_config` | 508 | `thinking_level` added when `--thinking-level` is `Changed` (556); `resolveMcpConfig` adds `mcp_config` (570); `PUT /api/agents/{id}` at 584; `custom_env` is intentionally not a flag here | read 508–585 |-| `parseMcpConfig` / `resolveMcpConfig` helpers | 1086, 1114 | Validator (object-or-`null`, content-free errors) + three-channel resolver, mirroring `parseCustomEnv`/`resolveCustomEnv` | read 1086–1170 |-| `agent skills set` = replace-all | 792 | `PUT /api/agents/{id}/skills` (810); `--skill-ids ''` clears all (798–799) | `multica agent skills set --help` |-| `agent skills add` = additive | 817 | `POST /api/agents/{id}/skills/add` (838); requires ≥1 id (823–828) | `multica agent skills add --help` |-| `agent skills list` | 760 | reads bindings, no side effect | `multica agent skills list --help` |-| `agent env get` | 894 | `GET /api/agents/{id}/env` | `multica agent env get --help` |-| `agent env set` | 929 | `PUT /api/agents/{id}/env` with full `custom_env` map (935, 949) | `multica agent env set --help` |+| Create flags: `name`, `description`, `instructions`, `runtime-id` | 160–163 | Registered create flags; `name`/`runtime-id` enforced in `runAgentCreate` | `multica agent create --help` |+| `runtime-config`, `model`, `thinking-level`, `service-tier`, `custom-args` flags | 164–168 | `model` help: "Prefer this over passing --model in --custom-args"; thinking and Codex service-tier values are thin catalog-owned pass-throughs, with exact model compatibility checked by the daemon; empty = runtime default | `multica agent create --help` |+| Secret-safe env input: `custom-env`, `custom-env-stdin`, `custom-env-file` | 169–171 | `--custom-env` warns about shell history / `ps`; stdin and file modes keep secrets off the command line; mutually exclusive | `multica agent create --help` |+| Secret-safe MCP input: `mcp-config`, `mcp-config-stdin`, `mcp-config-file` (create) | 172–174 | Same three-channel pattern as `custom-env`; `--mcp-config` warns about shell history / `ps`; value must be a JSON object or `null` | `multica agent create --help` |+| MCP flags on `agent update` | 200–202 | Same three channels on update; `--mcp-config null` clears. Unlike `custom_env`, `mcp_config` IS settable via update | `multica agent update --help` |+| `thinking-level` / `service-tier` flags on `agent update` | 189–190 | Thin pass-throughs; an explicit empty string clears the saved override and restores the runtime/local Codex default | `multica agent update --help` |+| `runAgentCreate` builds body + `POST /api/agents` | 533–624 | Only sets a body key when the flag `Changed`; posts to `/api/agents` (line 614) | read 533–624 |+| Body assembly: description/instructions/runtime-config/custom-args/custom-env/mcp-config/model/thinking-level/service-tier | 548–608 | `model`, `thinking_level`, and `service_tier` are `Changed`-gated pass-throughs; omitted flags are not sent | read the `runAgentCreate` body assembly |+| `runAgentUpdate` sends `thinking_level` / `service_tier` / `mcp_config` | 627–718 | Each override key is added only when its flag is `Changed`; `custom_env` is intentionally not a flag here | read the `runAgentUpdate` body assembly |+| `parseMcpConfig` / `resolveMcpConfig` helpers | 1210, 1238 | Validator (object-or-`null`, content-free errors) + three-channel resolver, mirroring `parseCustomEnv`/`resolveCustomEnv` | read 1210–1294 |+| `agent skills set` = replace-all | 916 | `PUT /api/agents/{id}/skills` (934); `--skill-ids ''` clears all (922–925) | `multica agent skills set --help` |+| `agent skills add` = additive | 941 | `POST /api/agents/{id}/skills/add` (962); requires ≥1 id (947–952) | `multica agent skills add --help` |+| `agent skills list` | 884 | reads bindings, no side effect | `multica agent skills list --help` |+| `agent env get` | 1018 | `GET /api/agents/{id}/env` (1028) | `multica agent env get --help` |+| `agent env set` | 1053 | `PUT /api/agents/{id}/env` with full `custom_env` map (1073) | `multica agent env set --help` |Note: the CLI no longer exposes `--from-template`. The agent-template backendstill exists (registry `server/internal/agenttmpl/`, handler `agent_template.go`,@@ -50,12 +50,13 @@ only.|---|---|---|| `maxAgentDescriptionLength = 255` | 31 | Cap is 255 **Unicode code points** (comment: counted via `utf8.RuneCountInString`, matches Postgres `char_length`) || `AgentResponse` omits plaintext `custom_env` | 33–53 | Exposes only `has_custom_env` (52) and `custom_env_key_count` (53); comment cites MUL-2600 |-| `CreateAgentRequest` fields | 919–956 | `description`, `instructions`, `avatar_url`, `runtime_config`, `custom_env`, `custom_args`, `model`, `thinking_level` (plus name/visibility/mcp_config/max_concurrent_tasks/permission inputs) |+| `CreateAgentRequest` fields | 930–970 | Includes `model`, `thinking_level`, and Codex `service_tier` alongside the profile/runtime/permission inputs || `name` required | 623–625 | 400 "name is required" || `description` ≤ 255 code points | 627–629 | `utf8.RuneCountInString(req.Description) > maxAgentDescriptionLength` → 400 || `runtime_id` required | 631–633 | `if req.RuntimeID == ""` → 400 "runtime_id is required" || `runtime_id` must resolve in workspace | 642–658 | parsed + `GetAgentRuntimeForWorkspace`; unknown → 400 "invalid runtime_id" || `thinking_level` provider-level validation | 896–903 | `!agent.IsKnownThinkingValue(runtime.Provider, req.ThinkingLevel)` → 400; fixed providers use an enum, Codex/OpenCode use safe-token syntax, and per-model gaps are deferred to daemon (MUL-2339) |+| `service_tier` provider-level validation | `agent.go` create/update paths | Non-empty values are Codex-only safe tokens; exact per-model support is daemon-owned || Defaults: `{}` config/env, `[]` args | 688–701 | `RuntimeConfig`→`{}`, `CustomEnv`→`{}`, `CustomArgs`→`[]` when nil, before insert || `visibility` default | 635–636 | `if req.Visibility == "" { req.Visibility = "private" }` — access-control field, not the runtime prompt || `max_concurrent_tasks` default | 638–639 | `if req.MaxConcurrentTasks == 0 { req.MaxConcurrentTasks = 6 }` — scheduler cap |@@ -63,7 +64,7 @@ only.| `mcp_config` redacted on read | 54, 848–851 | `redactMcpConfig` sets `McpConfigRedacted=true`; a private agent read by a member also redacts (494, 509) || Qwen Code managed-MCP injection | `pkg/agent/qwen.go` | Non-null `mcp_config` is written to a daemon-owned 0600 temporary JSON file and passed with `--mcp-config`; the file is removed after the process exits, while `null` preserves native inheritance. || Random emoji avatar default | `agent_avatar.go` 11–32; `agent.go` 1127–1133 | Omitted, empty, or whitespace-only `avatar_url` becomes a cryptographically selected `emoji:<glyph>` sentinel; explicit values are preserved. The template handler uses the same helper at `agent_template.go` 458. |-| `CreateAgent` insert params | 1127–1145 | persists avatar_url, runtime_config, instructions, custom_env, custom_args, model, thinking_level, mcp_config, visibility, max_concurrent_tasks |+| `CreateAgent` insert params | `agent.go` create path | Persists avatar_url, runtime_config, instructions, custom_env, custom_args, model, thinking_level, service_tier, mcp_config, visibility, max_concurrent_tasks || `UpdateAgent` rejects `custom_env` | 910–913 | if `custom_env` present in body → 400 "use PUT /api/agents/{id}/env (or `multica agent env set`)" || `UpdateAgent` persists / clears `mcp_config` | 944–948, 1060–1061 | Tri-state from the raw body: key omitted → no change; literal `null` → `ClearAgentMcpConfig`; object → replace. No 400 like `custom_env` — `mcp_config` IS updatable here || `description` ≤ 255 on update too | 921–924 | same cap re-checked on update |@@ -75,9 +76,10 @@ only.| Codex model-list entry point | `models.go` 94–103 | `ListModels("codex")` uses cached daemon-local discovery instead of returning the fallback catalog unconditionally || Codex fallback catalog | `models.go` 301–354 | Used for Codex <0.122.0 and failed/malformed discovery; includes current verified visible models plus legacy `gpt-5.3-codex`, with a separate `Thinking` catalog on every model || Codex discovery version gate | `thinking.go` 280, 306–337 | `codex debug models --bundled` is used only for parseable versions ≥0.122.0; unsupported versions and command/parse/empty failures return the static model + thinking fallback |-| Codex catalog projection | `thinking.go` 355–409 | Hidden models are excluded; visible `slug`/`display_name` rows and each row's `supported_reasoning_levels`/`default_reasoning_level` are preserved |+| Codex catalog projection | `thinking.go` `parseCodexModelCatalog` | Hidden models are excluded; visible model, reasoning, and `service_tiers` metadata are preserved || Per-model thinking validation | `thinking.go` 547–640 | `ValidateThinkingLevel` accepts only values in the explicit model's `Thinking.SupportedLevels`; an empty Codex model fails closed because its effective `config.toml` model is unknown || Dynamic Codex token gate | `thinking.go` 642–710 | Server persistence accepts syntactically safe Codex tokens so new catalog values do not require a Multica release; exact support remains a daemon-local per-model check |+| Per-model service-tier validation | `thinking.go` `ValidateServiceTier` | Accepts only a tier advertised for the explicit Codex model; empty model fails closed because config.toml is unknown || Daemon invalid-combination handling | `internal/daemon/daemon.go` 3860–3892 | Before execution, invalid `(provider, model, thinking_level)` combinations log a warning and omit the override rather than failing the task |## Env endpoint — `server/internal/handler/agent_env.go`@@ -102,7 +104,7 @@ only.| Fresh agent re-read on claim | 1109–1111 | `GetAgent(task.AgentID)` — claim uses persisted fields, not create output || Workspace skills FIRST | 1115 | `skills := h.TaskService.LoadAgentSkills(...)` || Built-ins appended | 1116 | `skills = append(skills, h.TaskService.BuiltinSkills()...)` |-| Runtime payload | 1130–1143 | `TaskAgentData` carries `Instructions`, `Skills`, `CustomEnv`, `CustomArgs`, `Model`, `ThinkingLevel`, `McpConfig` (1130–1131, 1140) — confirms these are runtime-consumed; `description`, `visibility`, and `max_concurrent_tasks` are absent (not runtime-prompt fields) |+| Runtime payload | `daemon.go` `TaskAgentData` | Carries `Instructions`, `Skills`, `CustomEnv`, `CustomArgs`, `Model`, `ThinkingLevel`, `ServiceTier`, and `McpConfig`; metadata-only fields remain absent |## Skill loading — `server/internal/service/task.go`@@ -121,7 +123,7 @@ only.| Contract | Line | Behavior ||---|---|---|-| `CreateAgent` INSERT | 730–736 | columns include `runtime_config, runtime_id, instructions, custom_env, custom_args, mcp_config, model, thinking_level` |-| `CreateAgentParams` | 739–756 | typed params: `RuntimeConfig []byte`, `Instructions string`, `CustomEnv []byte`, `CustomArgs []byte`, `Model pgtype.Text`, `ThinkingLevel pgtype.Text` |-| `UpdateAgent` SET | 2552–2566 | COALESCE updates of `runtime_config, instructions, custom_env, custom_args, model, thinking_level` — note `custom_env` is COALESCE-guarded but the handler rejects it before this query runs |+| `CreateAgent` INSERT | generated from `queries/agent.sql` | columns include `runtime_config, runtime_id, instructions, custom_env, custom_args, mcp_config, model, thinking_level, service_tier` |+| `CreateAgentParams` | generated from `queries/agent.sql` | typed params include nullable `Model`, `ThinkingLevel`, and `ServiceTier` |+| `UpdateAgent` SET | generated from `queries/agent.sql` | COALESCE updates include model/thinking/service tier; dedicated clear queries restore each nullable override || `UpdateAgentCustomEnv` (called by the `UpdateAgentEnv` handler) | 2652 | `SET custom_env = $2` — the only write path for env values |diff --git a/server/migrations/212_agent_service_tier.down.sql b/server/migrations/212_agent_service_tier.down.sqlnew file mode 100644index 0000000000..04f1d2480a--- /dev/null+++ b/server/migrations/212_agent_service_tier.down.sql@@ -0,0 +1 @@+ALTER TABLE agent DROP COLUMN IF EXISTS service_tier;diff --git a/server/migrations/212_agent_service_tier.up.sql b/server/migrations/212_agent_service_tier.up.sqlnew file mode 100644index 0000000000..69ca325014--- /dev/null+++ b/server/migrations/212_agent_service_tier.up.sql@@ -0,0 +1,5 @@+-- Per-agent Codex service-tier override. The value is the runtime-native+-- catalog ID reported by `codex debug models --bundled` (for example,+-- "priority", displayed by Codex as "Fast"). NULL means "inherit the local+-- Codex configuration / account default" and produces no RPC override.+ALTER TABLE agent ADD COLUMN service_tier TEXT;diff --git a/server/pkg/agent/agent.go b/server/pkg/agent/agent.goindex 2932d4649c..178a15f90f 100644--- a/server/pkg/agent/agent.go+++ b/server/pkg/agent/agent.go@@ -65,6 +65,10 @@ type ExecOptions struct {// the field rather than fail (so MUL-2339 can grow runtime support// incrementally without breaking unrelated agents).ThinkingLevel string+ // ServiceTier is a runtime-native Codex execution tier (for example+ // "priority", displayed as Fast). Empty means inherit local Codex config.+ // Other providers ignore this field.+ ServiceTier string// OpenclawMode chooses between local (embedded) and gateway routing for// the openclaw backend. "" or "local" keeps the historical behaviour —// the daemon spawns `openclaw agent --local …` and the agent loop runsdiff --git a/server/pkg/agent/codex.go b/server/pkg/agent/codex.goindex 8492aa95ef..af00e8ead3 100644--- a/server/pkg/agent/codex.go+++ b/server/pkg/agent/codex.go@@ -31,6 +31,11 @@ var codexBlockedArgs = map[string]blockedArgMode{"--listen": blockedWithValue, // stdio:// transport for daemon communication}+const (+ codexFastServiceTier = "priority"+ codexFastModeFeature = "fast_mode"+)+// codexStderrTailBytes bounds the stderr tail captured for inclusion in// error messages when codex exits before the JSON-RPC handshake (e.g. the// user supplied a custom_args flag that the `app-server` subcommand@@ -164,15 +169,21 @@ type codexBackend struct {func buildCodexArgs(opts ExecOptions, logger *slog.Logger) []string {args := []string{"app-server", "--listen", "stdio://"}- return append(args, NormalizeCodexLaunchArgs(opts.ExtraArgs, opts.CustomArgs, opts.McpConfig, logger)...)+ launchArgs := NormalizeCodexLaunchArgs(opts.ExtraArgs, opts.CustomArgs, opts.McpConfig, logger)+ if opts.ServiceTier == codexFastServiceTier {+ launchArgs = enforceCodexFastMode(launchArgs, logger)+ }+ return append(args, launchArgs...)}// NormalizeCodexLaunchArgs returns the user-supplied Codex args (extra then-// custom) exactly as buildCodexArgs hands them to the launched process: shell-// quoting stripped, protocol-critical flags removed, and — when a managed+// custom) after lower-priority normalization: shell quoting stripped,+// protocol-critical flags removed, and — when a managed// mcp_config owns the mcp_servers namespace — stray `-c mcp_servers.*`-// overrides dropped. buildCodexArgs only prepends the fixed-// `app-server --listen stdio://` transport flags to this result.+// overrides dropped. buildCodexArgs prepends the fixed+// `app-server --listen stdio://` transport flags and may append an+// agent-owned runtime override (currently `--enable fast_mode`) after this+// result.//// It is exported so the daemon can reconstruct the *effective* launch args when// deciding the Windows sandbox mode. A `-c windows.sandbox=…` opt-in may arrive@@ -201,6 +212,56 @@ func NormalizeCodexLaunchArgs(extraArgs, customArgs []string, mcpConfig json.Rawreturn out}+// enforceCodexFastMode makes the explicit agent service-tier selection+// authoritative over daemon ExtraArgs, per-agent CustomArgs, and inherited+// config.toml. Codex's `--disable fast_mode` wins over `--enable fast_mode`+// regardless of argv order, so conflicting lower-priority disable flags must+// be removed before the managed enable is appended. Conflicting `-c` /+// `--config features.fast_mode=...` overrides are removed for the same+// precedence reason, even though current Codex versions let `--enable` win:+// the final argv should encode one unambiguous owner for this setting.+//+// Other disabled features are preserved, and this helper is used only for the+// catalog-owned `priority` tier. Future service tiers must not accidentally+// inherit Fast mode semantics.+func enforceCodexFastMode(args []string, logger *slog.Logger) []string {+ args = filterCodexConfigOverrides(+ args,+ codexManagedFastModeConfigKeyRe,+ "features.fast_mode",+ logger,+ )+ filtered := make([]string, 0, len(args)+2)+ for i := 0; i < len(args); i++ {+ arg := args[i]+ flag := arg+ value := ""+ hasInlineValue := false+ if idx := strings.Index(arg, "="); idx > 0 {+ flag = arg[:idx]+ value = arg[idx+1:]+ hasInlineValue = true+ }+ if flag == "--disable" {+ if !hasInlineValue && i+1 < len(args) {+ value = args[i+1]+ }+ if value == codexFastModeFeature {+ if logger != nil {+ logger.Warn("codex: ignored lower-priority feature disable",+ "feature", codexFastModeFeature)+ }+ if !hasInlineValue {+ i+++ }+ continue+ }+ }+ filtered = append(filtered, arg)+ }+ return append(filtered, "--enable", codexFastModeFeature)+}+// hasManagedCodexMcpConfig reports whether the agent's mcp_config field is// "present" in the API three-state sense: a non-null JSON value. Both// `{}` and `{"mcpServers":{}}` count as present (the admin saved an empty@@ -217,6 +278,9 @@ func hasManagedCodexMcpConfig(raw json.RawMessage) bool {// `$CODEX_HOME/config.toml`.var codexManagedMcpConfigKeyRe = regexp.MustCompile(`^\s*mcp_servers(?:\s*\.|\s*=|\s*$)`)+var codexManagedFastModeConfigKeyRe = regexp.MustCompile(+ `^\s*features\s*\.\s*fast_mode\s*(?:=|$)`)+// A daemon-managed shell_environment_policy must also win over profile and// custom-arg overrides. Match root and profile policy keys without catching an// unrelated table field that happens to use the same final key name.@@ -1228,6 +1292,7 @@ func (b *codexBackend) executeOnce(ctx context.Context, prompt string, opts Exec// MUL-2339 — Trump's constraint that the three injection points// must not drift independently).applyCodexReasoningEffort(turnParams, opts.ThinkingLevel)+ applyCodexServiceTier(turnParams, opts.ServiceTier)waitingForTurn := truevar timeoutDiagnostic codexTimeoutDiagnosticvar processExitErr error@@ -1497,6 +1562,7 @@ func (c *codexClient) startOrResumeThread(ctx context.Context, opts ExecOptions,// agent's thinking_level since. See MUL-2339 — Elon flagged that// resume must honour the live config, not the stored one.applyCodexReasoningEffort(resumeParams, opts.ThinkingLevel)+ applyCodexServiceTier(resumeParams, opts.ServiceTier)resumeResult, err := c.request(ctx, "thread/resume", resumeParams)if err == nil {if threadID := extractThreadID(resumeResult); threadID != "" {@@ -1528,6 +1594,7 @@ func (c *codexClient) startOrResumeThread(ctx context.Context, opts ExecOptions,"persistExtendedHistory": true,}applyCodexReasoningEffort(startParams, opts.ThinkingLevel)+ applyCodexServiceTier(startParams, opts.ServiceTier)c.threadStartSent = truec.threadStartStarted = time.Now()logger.Info("codex lifecycle",@@ -1614,6 +1681,16 @@ func applyCodexReasoningEffort(params map[string]any, level string) {params["config"] = cfg}+// applyCodexServiceTier writes the catalog-owned service tier to the+// app-server's top-level serviceTier field. All three execution requests+// accept the same shape. Empty is a no-op so config.toml remains authoritative.+func applyCodexServiceTier(params map[string]any, tier string) {+ if params == nil || tier == "" {+ return+ }+ params["serviceTier"] = tier+}+func resetTimer(timer *time.Timer, d time.Duration) {if !timer.Stop() {select {diff --git a/server/pkg/agent/codex_test.go b/server/pkg/agent/codex_test.goindex ae48f56d84..d908ccea51 100644--- a/server/pkg/agent/codex_test.go+++ b/server/pkg/agent/codex_test.go@@ -3526,6 +3526,50 @@ func TestBuildCodexArgsExtraArgsBeforeCustomArgsAndFiltersBoth(t *testing.T) {}}+func TestBuildCodexArgsExplicitFastOverridesLowerPriorityDisable(t *testing.T) {+ t.Parallel()++ args := buildCodexArgs(ExecOptions{+ ServiceTier: codexFastServiceTier,+ ExtraArgs: []string{+ "--disable", codexFastModeFeature,+ "--disable", "memory_tool",+ "-c", "features.fast_mode=false",+ "-c", "features.memory_tool=false",+ },+ CustomArgs: []string{+ "'--disable=fast_mode'",+ `--config=features.fast_mode="false"`,+ "--enable", "multi_agent",+ },+ }, slog.Default())++ want := []string{+ "app-server", "--listen", "stdio://",+ "--disable", "memory_tool",+ "-c", "features.memory_tool=false",+ "--enable", "multi_agent",+ "--enable", codexFastModeFeature,+ }+ if !reflect.DeepEqual(args, want) {+ t.Fatalf("buildCodexArgs explicit Fast = %v, want %v", args, want)+ }+}++func TestBuildCodexArgsFutureServiceTierDoesNotForceFastMode(t *testing.T) {+ t.Parallel()++ args := buildCodexArgs(ExecOptions{+ ServiceTier: "future-tier",+ CustomArgs: []string{"--disable", codexFastModeFeature},+ }, slog.Default())++ want := []string{"app-server", "--listen", "stdio://", "--disable", codexFastModeFeature}+ if !reflect.DeepEqual(args, want) {+ t.Fatalf("buildCodexArgs future tier = %v, want %v", args, want)+ }+}+func TestBuildCodexArgsDoesNotLeakMcpToArgv(t *testing.T) {t.Parallel()diff --git a/server/pkg/agent/models.go b/server/pkg/agent/models.goindex f4d4ac99da..fd06bc8be0 100644--- a/server/pkg/agent/models.go+++ b/server/pkg/agent/models.go@@ -28,10 +28,11 @@ import (// default, which is always closer to what the user's account /// environment actually supports than a static guess here.type Model struct {- ID string `json:"id"`- Label string `json:"label"`- Provider string `json:"provider,omitempty"`- Default bool `json:"default,omitempty"`+ ID string `json:"id"`+ Label string `json:"label"`+ Provider string `json:"provider,omitempty"`+ Default bool `json:"default,omitempty"`+ ServiceTiers []ModelServiceTier `json:"service_tiers,omitempty"`// Thinking advertises the runtime's reasoning/effort catalog for this// model. nil means the runtime/model has no thinking-level control// (or the daemon couldn't discover one); the UI hides its picker. The@@ -41,6 +42,15 @@ type Model struct {Thinking *ModelThinking `json:"thinking,omitempty"`}+// ModelServiceTier is one runtime-native execution tier advertised for a+// model. ID is sent back to the provider protocol unchanged; Name and+// Description are display copy owned by the runtime catalog.+type ModelServiceTier struct {+ ID string `json:"id"`+ Name string `json:"name"`+ Description string `json:"description,omitempty"`+}+// ModelThinking carries the per-model reasoning/effort catalog// surfaced by an agent runtime. Values are runtime-native — Codex can emit// "none|minimal|low|medium|high|xhigh|max|ultra"; Claude emits@@ -320,7 +330,9 @@ func claudeStaticModels() []Model {// sync with the visible entries in the newest locally verified bundled// catalog, plus still-common models from older Codex releases. Each entry// carries its own reasoning catalog so old/offline CLIs retain the same model-// + thinking picker contract as dynamic discovery.+// + thinking picker contract as dynamic discovery. Service tiers are+// intentionally NOT guessed here: they are runtime/version/account-sensitive,+// so a discovery failure hides the speed picker and fails the override closed.func codexStaticModels() []Model {// `Default` here is NOT a user-facing "default model" badge — the picker// stopped rendering that (Multica follows the CLI config when the model isdiff --git a/server/pkg/agent/models_test.go b/server/pkg/agent/models_test.goindex 49cbc6c901..4b3961ce1c 100644--- a/server/pkg/agent/models_test.go+++ b/server/pkg/agent/models_test.go@@ -3,6 +3,7 @@ package agentimport ("context""path/filepath"+ "reflect""runtime""strconv""strings"@@ -1021,7 +1022,7 @@ func TestParseAntigravityModels(t *testing.T) {t.Fatalf("parseAntigravityModels len = %d, want %d (%+v)", len(got), len(want), got)}for i := range want {- if got[i] != want[i] {+ if !reflect.DeepEqual(got[i], want[i]) {t.Errorf("model[%d] = %+v, want %+v", i, got[i], want[i])}}diff --git a/server/pkg/agent/thinking.go b/server/pkg/agent/thinking.goindex 457e86ba6c..31b29d88f7 100644--- a/server/pkg/agent/thinking.go+++ b/server/pkg/agent/thinking.go@@ -240,8 +240,8 @@ func projectClaudeLevels(superset []string, allow map[string]bool) []ThinkingLev// ── Codex ────────────────────────────────────────────────────────────//-// `codex debug models --bundled` is the structured discovery hook for both-// the visible model catalog and each model's reasoning catalog. OpenAI added+// `codex debug models --bundled` is the structured discovery hook for the+// visible model catalog, each model's reasoning catalog, and service tiers. OpenAI added// the command and `--bundled` flag together in Codex 0.122.0 (openai/codex// #18625). Older versions, failed invocations, and malformed/empty payloads// use codexStaticModels so the picker remains usable.@@ -261,7 +261,7 @@ func projectClaudeLevels(superset []string, allow map[string]bool) []ThinkingLev// need for validation.//// The static fallback deliberately mirrors a recently verified bundled-// catalog, including thinking metadata, rather than guessing model IDs.+// model/thinking catalog. It does not guess service-tier availability.// codexEffortLabel is the human display string for each Codex effort// value, matching Codex's own TUI (`Extra high`, `Minimal`, …) so@@ -292,6 +292,7 @@ type codexDebugModel struct {Visibility string `json:"visibility"`DefaultReasoningLevel string `json:"default_reasoning_level"`SupportedReasoningLevel []codexDebugReasoningLevel `json:"supported_reasoning_levels"`+ ServiceTiers []codexDebugServiceTier `json:"service_tiers"`}type codexDebugReasoningLevel struct {@@ -299,6 +300,12 @@ type codexDebugReasoningLevel struct {Description string `json:"description"`}+type codexDebugServiceTier struct {+ ID string `json:"id"`+ Name string `json:"name"`+ Description string `json:"description"`+}+// discoverCodexModels returns the installed Codex binary's bundled visible// catalog, including reasoning metadata. Version detection happens before the// debug command so old binaries do not log a predictable "unknown command"@@ -367,10 +374,11 @@ func parseCodexModelCatalog(raw []byte) ([]Model, error) {label = m.Slug}models = append(models, Model{- ID: m.Slug,- Label: label,- Provider: "openai",- Thinking: codexThinkingFromDebugModel(m),+ ID: m.Slug,+ Label: label,+ Provider: "openai",+ Thinking: codexThinkingFromDebugModel(m),+ ServiceTiers: codexServiceTiersFromDebugModel(m),})}if len(models) > 0 {@@ -379,6 +387,25 @@ func parseCodexModelCatalog(raw []byte) ([]Model, error) {return models, nil}+func codexServiceTiersFromDebugModel(m codexDebugModel) []ModelServiceTier {+ tiers := make([]ModelServiceTier, 0, len(m.ServiceTiers))+ for _, tier := range m.ServiceTiers {+ if tier.ID == "" {+ continue+ }+ name := tier.Name+ if name == "" {+ name = tier.ID+ }+ tiers = append(tiers, ModelServiceTier{+ ID: tier.ID,+ Name: name,+ Description: tier.Description,+ })+ }+ return tiers+}+func codexThinkingFromDebugModel(m codexDebugModel) *ModelThinking {levels := make([]ThinkingLevel, 0, len(m.SupportedReasoningLevel))for _, lvl := range m.SupportedReasoningLevel {@@ -625,6 +652,35 @@ func ValidateThinkingLevel(ctx context.Context, providerType, executablePath, moreturn false, nil}+// ValidateServiceTier reports whether value is advertised by the current+// Codex catalog for the explicit model. An empty value is always valid and+// means "inherit runtime configuration". An empty Codex model fails closed:+// its effective model comes from config.toml and may not support the tier.+func ValidateServiceTier(ctx context.Context, providerType, executablePath, model, value string) (bool, error) {+ if value == "" {+ return true, nil+ }+ if providerType != "codex" || model == "" {+ return false, nil+ }+ models, err := ListModels(ctx, providerType, executablePath)+ if err != nil {+ return false, err+ }+ for _, m := range models {+ if m.ID != model {+ continue+ }+ for _, tier := range m.ServiceTiers {+ if tier.ID == value {+ return true, nil+ }+ }+ return false, nil+ }+ return false, nil+}+func anyModelSupportsThinkingValue(models []Model, value string) bool {for _, m := range models {if m.Thinking == nil {@@ -698,6 +754,17 @@ func IsKnownThinkingValue(providerType, value string) bool {return enum[value]}+// IsKnownServiceTier is the server-side literal gate. The exact per-model+// catalog lives on the daemon host, so Codex accepts safe future catalog IDs+// here and ValidateServiceTier performs the execution-time compatibility+// check. Other providers do not currently expose service tiers.+func IsKnownServiceTier(providerType, value string) bool {+ if value == "" {+ return true+ }+ return providerType == "codex" && isValidDynamicThinkingValue(value)+}+func isValidDynamicThinkingValue(value string) bool {if len(value) > 64 {return falsediff --git a/server/pkg/agent/thinking_test.go b/server/pkg/agent/thinking_test.goindex e4151f4d71..6338f79619 100644--- a/server/pkg/agent/thinking_test.go+++ b/server/pkg/agent/thinking_test.go@@ -232,6 +232,9 @@ func TestParseCodexModelCatalog(t *testing.T) {{"effort": "max", "description": "Maximum"},{"effort": "ultra", "description": "Delegates"},{"effort": "future", "description": "New CLI value"}+ ],+ "service_tiers": [+ {"id": "priority", "name": "Fast", "description": "1.5x speed, increased usage"}]},{@@ -261,6 +264,9 @@ func TestParseCodexModelCatalog(t *testing.T) {if got[0].Thinking == nil || got[0].Thinking.DefaultLevel != "low" || !hasThinkingLevel(got[0].Thinking, "max") || !hasThinkingLevel(got[0].Thinking, "ultra") || !hasThinkingLevel(got[0].Thinking, "future") {t.Errorf("unexpected per-model thinking catalog: %+v", got[0].Thinking)}+ if len(got[0].ServiceTiers) != 1 || got[0].ServiceTiers[0].ID != "priority" || got[0].ServiceTiers[0].Name != "Fast" {+ t.Errorf("unexpected service-tier catalog: %+v", got[0].ServiceTiers)+ }if got[1].ID != "no-reasoning" || got[1].Thinking != nil {t.Errorf("model without reasoning should remain selectable without a thinking picker: %+v", got[1])}@@ -776,8 +782,8 @@ func writeFakeCodexModelsBinary(t *testing.T) string {"if [ \"$1\" = \"debug\" ]; then\n" +"cat <<'EOF'\n" +`{"models":[` +- `{"slug":"gpt-5.6-sol","default_reasoning_level":"high","supported_reasoning_levels":[{"effort":"low"},{"effort":"medium"},{"effort":"high"},{"effort":"xhigh"},{"effort":"max"},{"effort":"ultra"}]},` +- `{"slug":"gpt-5.6-terra","default_reasoning_level":"high","supported_reasoning_levels":[{"effort":"low"},{"effort":"medium"},{"effort":"high"},{"effort":"xhigh"},{"effort":"max"},{"effort":"ultra"}]},` ++ `{"slug":"gpt-5.6-sol","default_reasoning_level":"high","supported_reasoning_levels":[{"effort":"low"},{"effort":"medium"},{"effort":"high"},{"effort":"xhigh"},{"effort":"max"},{"effort":"ultra"}],"service_tiers":[{"id":"priority","name":"Fast","description":"1.5x speed"}]},` ++ `{"slug":"gpt-5.6-terra","default_reasoning_level":"high","supported_reasoning_levels":[{"effort":"low"},{"effort":"medium"},{"effort":"high"},{"effort":"xhigh"},{"effort":"max"},{"effort":"ultra"}],"service_tiers":[{"id":"priority","name":"Fast"}]},` +`{"slug":"gpt-5.6-luna","default_reasoning_level":"medium","supported_reasoning_levels":[{"effort":"low"},{"effort":"medium"},{"effort":"high"},{"effort":"xhigh"},{"effort":"max"}]}` +`]}` + "\n" +"EOF\n" +@@ -788,6 +794,51 @@ func writeFakeCodexModelsBinary(t *testing.T) string {return path}+func TestValidateServiceTierCodexPerModelCatalog(t *testing.T) {+ t.Parallel()+ fake := writeFakeCodexModelsBinary(t)+ for _, tc := range []struct {+ provider string+ model string+ tier string+ want bool+ }{+ {provider: "codex", model: "gpt-5.6-sol", tier: "priority", want: true},+ {provider: "codex", model: "gpt-5.6-luna", tier: "priority", want: false},+ {provider: "codex", model: "", tier: "priority", want: false},+ {provider: "claude", model: "gpt-5.6-sol", tier: "priority", want: false},+ {provider: "codex", model: "gpt-5.6-sol", tier: "", want: true},+ } {+ got, err := ValidateServiceTier(context.Background(), tc.provider, fake, tc.model, tc.tier)+ if err != nil {+ t.Fatalf("ValidateServiceTier(%q, %q, %q): %v", tc.provider, tc.model, tc.tier, err)+ }+ if got != tc.want {+ t.Errorf("ValidateServiceTier(%q, %q, %q) = %v, want %v", tc.provider, tc.model, tc.tier, got, tc.want)+ }+ }+}++func TestIsKnownServiceTier(t *testing.T) {+ t.Parallel()+ for _, tc := range []struct {+ provider string+ value string+ want bool+ }{+ {provider: "codex", value: "", want: true},+ {provider: "claude", value: "", want: true},+ {provider: "codex", value: "priority", want: true},+ {provider: "codex", value: "future.fast", want: true},+ {provider: "codex", value: "../priority", want: false},+ {provider: "claude", value: "priority", want: false},+ } {+ if got := IsKnownServiceTier(tc.provider, tc.value); got != tc.want {+ t.Errorf("IsKnownServiceTier(%q, %q) = %v, want %v", tc.provider, tc.value, got, tc.want)+ }+ }+}+// ── Cache key invalidation ───────────────────────────────────────────func TestThinkingCacheKeyDistinct(t *testing.T) {@@ -980,6 +1031,30 @@ func TestApplyCodexReasoningEffort_PreservesPreExistingConfig(t *testing.T) {}}+func TestApplyCodexServiceTier_ThreePoints(t *testing.T) {+ t.Parallel()+ for _, tier := range []string{"", "priority", "future-fast"} {+ t.Run(tier, func(t *testing.T) {+ for _, params := range []map[string]any{+ {"model": "gpt-5.6-sol", "cwd": "/work"},+ {"threadId": "prior", "cwd": "/work"},+ {"threadId": "thread", "input": []map[string]any{{"type": "text", "text": "hi"}}},+ } {+ applyCodexServiceTier(params, tier)+ got, exists := params["serviceTier"]+ if tier == "" {+ if exists {+ t.Errorf("empty tier emitted serviceTier=%v", got)+ }+ } else if !exists || got != tier {+ t.Errorf("serviceTier = %v (exists=%v), want %q", got, exists, tier)+ }+ }+ })+ }+ applyCodexServiceTier(nil, "priority")+}+// ── End-to-end: build*Args + thinking_level wiring ───────────────────func TestBuildClaudeArgs_InjectsEffort(t *testing.T) {diff --git a/server/pkg/db/generated/agent.sql.go b/server/pkg/db/generated/agent.sql.goindex 084222f2d9..3186f75841 100644--- a/server/pkg/db/generated/agent.sql.go+++ b/server/pkg/db/generated/agent.sql.go@@ -14,7 +14,7 @@ import (const archiveAgent = `-- name: ArchiveAgent :oneUPDATE agent SET archived_at = now(), archived_by = $2, updated_at = now()WHERE id = $1-RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier`type ArchiveAgentParams struct {@@ -53,6 +53,7 @@ func (q *Queries) ArchiveAgent(ctx context.Context, arg ArchiveAgentParams) (Age&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}@@ -61,7 +62,7 @@ const archiveAgentsByIDs = `-- name: ArchiveAgentsByIDs :manyUPDATE agentSET archived_at = now(), archived_by = $1, updated_at = now()WHERE id = ANY($2::uuid[]) AND archived_at IS NULL-RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier`type ArchiveAgentsByIDsParams struct {@@ -114,6 +115,7 @@ func (q *Queries) ArchiveAgentsByIDs(ctx context.Context, arg ArchiveAgentsByIDs&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,); err != nil {return nil, err}@@ -129,7 +131,7 @@ const archiveAgentsByRuntime = `-- name: ArchiveAgentsByRuntime :manyUPDATE agentSET archived_at = now(), archived_by = $1, updated_at = now()WHERE runtime_id = ANY($2::uuid[]) AND archived_at IS NULL-RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier`type ArchiveAgentsByRuntimeParams struct {@@ -178,6 +180,7 @@ func (q *Queries) ArchiveAgentsByRuntime(ctx context.Context, arg ArchiveAgentsB&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,); err != nil {return nil, err}@@ -1036,7 +1039,7 @@ func (q *Queries) ClaimChatFinalizeDeferred(ctx context.Context, id pgtype.UUID)const clearAgentComposioToolkitAllowlist = `-- name: ClearAgentComposioToolkitAllowlist :oneUPDATE agent SET composio_toolkit_allowlist = NULL, updated_at = now()WHERE id = $1-RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier`// Explicit NULL-clear for composio_toolkit_allowlist. The COALESCE-based@@ -1076,6 +1079,7 @@ func (q *Queries) ClearAgentComposioToolkitAllowlist(ctx context.Context, id pgt&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}@@ -1083,7 +1087,7 @@ func (q *Queries) ClearAgentComposioToolkitAllowlist(ctx context.Context, id pgtconst clearAgentMcpConfig = `-- name: ClearAgentMcpConfig :oneUPDATE agent SET mcp_config = NULL, updated_at = now()WHERE id = $1-RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier`func (q *Queries) ClearAgentMcpConfig(ctx context.Context, id pgtype.UUID) (Agent, error) {@@ -1117,6 +1121,51 @@ func (q *Queries) ClearAgentMcpConfig(ctx context.Context, id pgtype.UUID) (Agen&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,+ )+ return i, err+}++const clearAgentServiceTier = `-- name: ClearAgentServiceTier :one+UPDATE agent SET service_tier = NULL, updated_at = now()+WHERE id = $1+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier+`++// Explicit NULL-clear for service_tier. COALESCE-based UpdateAgent cannot+// set the column back to NULL, so the API routes "Runtime default" here.+func (q *Queries) ClearAgentServiceTier(ctx context.Context, id pgtype.UUID) (Agent, error) {+ row := q.db.QueryRow(ctx, clearAgentServiceTier, id)+ var i Agent+ err := row.Scan(+ &i.ID,+ &i.WorkspaceID,+ &i.Name,+ &i.AvatarUrl,+ &i.RuntimeMode,+ &i.RuntimeConfig,+ &i.Visibility,+ &i.Status,+ &i.MaxConcurrentTasks,+ &i.OwnerID,+ &i.CreatedAt,+ &i.UpdatedAt,+ &i.Description,+ &i.RuntimeID,+ &i.Instructions,+ &i.ArchivedAt,+ &i.ArchivedBy,+ &i.CustomEnv,+ &i.CustomArgs,+ &i.McpConfig,+ &i.Model,+ &i.ThinkingLevel,+ &i.ComposioToolkitAllowlist,+ &i.PermissionMode,+ &i.Kind,+ &i.SystemKey,+ &i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}@@ -1124,7 +1173,7 @@ func (q *Queries) ClearAgentMcpConfig(ctx context.Context, id pgtype.UUID) (Agenconst clearAgentThinkingLevel = `-- name: ClearAgentThinkingLevel :oneUPDATE agent SET thinking_level = NULL, updated_at = now()WHERE id = $1-RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier`// Explicit NULL-clear for thinking_level. COALESCE-based UpdateAgent cannot@@ -1161,6 +1210,7 @@ func (q *Queries) ClearAgentThinkingLevel(ctx context.Context, id pgtype.UUID) (&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}@@ -1256,15 +1306,17 @@ INSERT INTO agent (workspace_id, name, description, avatar_url, runtime_mode,runtime_config, runtime_id, visibility, max_concurrent_tasks, owner_id,instructions, custom_env, custom_args, mcp_config, model, thinking_level,+ service_tier,composio_toolkit_allowlist, permission_mode) VALUES ($1, $2, $3, $4, $5,$6, $7, $8, $9, $10,$11, $12, $13, $14, $15, $16,- $17::text[],- COALESCE($18, 'private')+ $17,+ $18::text[],+ COALESCE($19, 'private'))-RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier`type CreateAgentParams struct {@@ -1284,6 +1336,7 @@ type CreateAgentParams struct {McpConfig []byte `json:"mcp_config"`Model pgtype.Text `json:"model"`ThinkingLevel pgtype.Text `json:"thinking_level"`+ ServiceTier pgtype.Text `json:"service_tier"`ComposioToolkitAllowlist []string `json:"composio_toolkit_allowlist"`PermissionMode interface{} `json:"permission_mode"`}@@ -1306,6 +1359,7 @@ func (q *Queries) CreateAgent(ctx context.Context, arg CreateAgentParams) (Agentarg.McpConfig,arg.Model,arg.ThinkingLevel,+ arg.ServiceTier,arg.ComposioToolkitAllowlist,arg.PermissionMode,)@@ -1338,6 +1392,7 @@ func (q *Queries) CreateAgent(ctx context.Context, arg CreateAgentParams) (Agent&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}@@ -1352,7 +1407,7 @@ INSERT INTO agent ('private', 'private', 1, $5, $6,'{}'::jsonb, '[]'::jsonb, $7, 'system', $8)-RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier`type CreateAgentBuilderParams struct {@@ -1410,6 +1465,7 @@ func (q *Queries) CreateAgentBuilder(ctx context.Context, arg CreateAgentBuilder&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}@@ -2374,7 +2430,7 @@ func (q *Queries) FailStaleTasks(ctx context.Context, arg FailStaleTasksParams)}const getAgent = `-- name: GetAgent :one-SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills FROM agent+SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier FROM agentWHERE id = $1`@@ -2409,12 +2465,13 @@ func (q *Queries) GetAgent(ctx context.Context, id pgtype.UUID) (Agent, error) {&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}const getAgentForClaimUpdate = `-- name: GetAgentForClaimUpdate :one-SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills FROM agent+SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier FROM agentWHERE id = $1FOR UPDATE`@@ -2450,12 +2507,13 @@ func (q *Queries) GetAgentForClaimUpdate(ctx context.Context, id pgtype.UUID) (A&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}const getAgentForUpdate = `-- name: GetAgentForUpdate :one-SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills FROM agent+SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier FROM agentWHERE id = $1FOR UPDATE`@@ -2493,12 +2551,13 @@ func (q *Queries) GetAgentForUpdate(ctx context.Context, id pgtype.UUID) (Agent,&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}const getAgentInWorkspace = `-- name: GetAgentInWorkspace :one-SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills FROM agent+SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier FROM agentWHERE id = $1 AND workspace_id = $2 AND kind = 'user'`@@ -2538,6 +2597,7 @@ func (q *Queries) GetAgentInWorkspace(ctx context.Context, arg GetAgentInWorkspa&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}@@ -3048,7 +3108,7 @@ func (q *Queries) LinkTaskToIssue(ctx context.Context, arg LinkTaskToIssueParams}const listActiveAgentsByRuntime = `-- name: ListActiveAgentsByRuntime :many-SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills FROM agent+SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier FROM agentWHERE runtime_id = $1 AND archived_at IS NULL AND kind = 'user'ORDER BY name ASC`@@ -3096,6 +3156,7 @@ func (q *Queries) ListActiveAgentsByRuntime(ctx context.Context, runtimeID pgtyp&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,); err != nil {return nil, err}@@ -3108,7 +3169,7 @@ func (q *Queries) ListActiveAgentsByRuntime(ctx context.Context, runtimeID pgtyp}const listActiveAgentsByRuntimeForUpdate = `-- name: ListActiveAgentsByRuntimeForUpdate :many-SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills FROM agent+SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier FROM agentWHERE runtime_id = $1 AND archived_at IS NULL AND kind = 'user'ORDER BY name ASCFOR UPDATE@@ -3159,6 +3220,7 @@ func (q *Queries) ListActiveAgentsByRuntimeForUpdate(ctx context.Context, runtim&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,); err != nil {return nil, err}@@ -3324,7 +3386,7 @@ func (q *Queries) ListAgentTasks(ctx context.Context, agentID pgtype.UUID) ([]Ag}const listAgents = `-- name: ListAgents :many-SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills FROM agent+SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier FROM agentWHERE workspace_id = $1 AND archived_at IS NULL AND kind = 'user'ORDER BY created_at ASC`@@ -3366,6 +3428,7 @@ func (q *Queries) ListAgents(ctx context.Context, workspaceID pgtype.UUID) ([]Ag&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,); err != nil {return nil, err}@@ -3378,7 +3441,7 @@ func (q *Queries) ListAgents(ctx context.Context, workspaceID pgtype.UUID) ([]Ag}const listAllAgents = `-- name: ListAllAgents :many-SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills FROM agent+SELECT id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier FROM agentWHERE workspace_id = $1 AND kind = 'user'ORDER BY created_at ASC`@@ -3420,6 +3483,7 @@ func (q *Queries) ListAllAgents(ctx context.Context, workspaceID pgtype.UUID) ([&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,); err != nil {return nil, err}@@ -4360,7 +4424,7 @@ SET runtime_id = $1,model = $3,updated_at = now()WHERE id = $4 AND kind = 'system' AND system_key LIKE 'agent_builder:%'-RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier`type RebindAgentBuilderRuntimeParams struct {@@ -4422,6 +4486,7 @@ func (q *Queries) RebindAgentBuilderRuntime(ctx context.Context, arg RebindAgent&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}@@ -4709,7 +4774,7 @@ SET status = CASE WHEN EXISTS () THEN 'working' ELSE 'idle' END,updated_at = now()WHERE a.id = $1-RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier`func (q *Queries) RefreshAgentStatusFromTasks(ctx context.Context, id pgtype.UUID) (Agent, error) {@@ -4743,6 +4808,7 @@ func (q *Queries) RefreshAgentStatusFromTasks(ctx context.Context, id pgtype.UUI&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}@@ -4830,7 +4896,7 @@ func (q *Queries) RequeueAgentTaskAfterClaimFailure(ctx context.Context, arg Reqconst restoreAgent = `-- name: RestoreAgent :oneUPDATE agent SET archived_at = NULL, archived_by = NULL, updated_at = now()WHERE id = $1-RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier`func (q *Queries) RestoreAgent(ctx context.Context, id pgtype.UUID) (Agent, error) {@@ -4864,6 +4930,7 @@ func (q *Queries) RestoreAgent(ctx context.Context, id pgtype.UUID) (Agent, erro&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}@@ -5004,10 +5071,11 @@ UPDATE agent SETmcp_config = COALESCE($15, mcp_config),model = COALESCE($16, model),thinking_level = COALESCE($17, thinking_level),- composio_toolkit_allowlist = COALESCE($18::text[], composio_toolkit_allowlist),+ service_tier = COALESCE($18, service_tier),+ composio_toolkit_allowlist = COALESCE($19::text[], composio_toolkit_allowlist),updated_at = now()WHERE id = $1-RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier`type UpdateAgentParams struct {@@ -5028,6 +5096,7 @@ type UpdateAgentParams struct {McpConfig []byte `json:"mcp_config"`Model pgtype.Text `json:"model"`ThinkingLevel pgtype.Text `json:"thinking_level"`+ ServiceTier pgtype.Text `json:"service_tier"`ComposioToolkitAllowlist []string `json:"composio_toolkit_allowlist"`}@@ -5056,6 +5125,7 @@ func (q *Queries) UpdateAgent(ctx context.Context, arg UpdateAgentParams) (Agentarg.McpConfig,arg.Model,arg.ThinkingLevel,+ arg.ServiceTier,arg.ComposioToolkitAllowlist,)var i Agent@@ -5087,6 +5157,7 @@ func (q *Queries) UpdateAgent(ctx context.Context, arg UpdateAgentParams) (Agent&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}@@ -5095,7 +5166,7 @@ const updateAgentCustomEnv = `-- name: UpdateAgentCustomEnv :oneUPDATE agentSET custom_env = $2, updated_at = now()WHERE id = $1-RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier`type UpdateAgentCustomEnvParams struct {@@ -5139,6 +5210,7 @@ func (q *Queries) UpdateAgentCustomEnv(ctx context.Context, arg UpdateAgentCusto&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}@@ -5147,7 +5219,7 @@ const updateAgentDisabledRuntimeSkills = `-- name: UpdateAgentDisabledRuntimeSkiUPDATE agentSET disabled_runtime_skills = $2, updated_at = now()WHERE id = $1-RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier`type UpdateAgentDisabledRuntimeSkillsParams struct {@@ -5186,6 +5258,7 @@ func (q *Queries) UpdateAgentDisabledRuntimeSkills(ctx context.Context, arg Upda&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}@@ -5193,7 +5266,7 @@ func (q *Queries) UpdateAgentDisabledRuntimeSkills(ctx context.Context, arg Updaconst updateAgentStatus = `-- name: UpdateAgentStatus :oneUPDATE agent SET status = $2, updated_at = now()WHERE id = $1-RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills+RETURNING id, workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, status, max_concurrent_tasks, owner_id, created_at, updated_at, description, runtime_id, instructions, archived_at, archived_by, custom_env, custom_args, mcp_config, model, thinking_level, composio_toolkit_allowlist, permission_mode, kind, system_key, disabled_runtime_skills, service_tier`type UpdateAgentStatusParams struct {@@ -5232,6 +5305,7 @@ func (q *Queries) UpdateAgentStatus(ctx context.Context, arg UpdateAgentStatusPa&i.Kind,&i.SystemKey,&i.DisabledRuntimeSkills,+ &i.ServiceTier,)return i, err}diff --git a/server/pkg/db/generated/models.go b/server/pkg/db/generated/models.goindex 24dc762c15..996a2babab 100644--- a/server/pkg/db/generated/models.go+++ b/server/pkg/db/generated/models.go@@ -51,6 +51,7 @@ type Agent struct {Kind string `json:"kind"`SystemKey pgtype.Text `json:"system_key"`DisabledRuntimeSkills []byte `json:"disabled_runtime_skills"`+ ServiceTier pgtype.Text `json:"service_tier"`}// Allow-list of who may invoke a public_to agent (MUL-3963). One row per (agent, target_type, target); targets stack and canInvokeAgent OR-matches. workspace rows store the agent workspace_id in target_id; member rows store the user id; team rows are reserved and inert in V1. Rows only matter when agent.permission_mode = public_to. No DB foreign keys: agent_id / created_by / member target_id relationships are maintained in the application layer (see migration comment).diff --git a/server/pkg/db/queries/agent.sql b/server/pkg/db/queries/agent.sqlindex a89addc33f..0ad0e27721 100644--- a/server/pkg/db/queries/agent.sql+++ b/server/pkg/db/queries/agent.sql@@ -28,11 +28,13 @@ INSERT INTO agent (workspace_id, name, description, avatar_url, runtime_mode,runtime_config, runtime_id, visibility, max_concurrent_tasks, owner_id,instructions, custom_env, custom_args, mcp_config, model, thinking_level,+ service_tier,composio_toolkit_allowlist, permission_mode) VALUES ($1, $2, $3, $4, $5,$6, $7, $8, $9, $10,$11, $12, $13, $14, $15, $16,+ $17,sqlc.narg('composio_toolkit_allowlist')::text[],COALESCE(sqlc.narg('permission_mode'), 'private'))@@ -110,6 +112,7 @@ UPDATE agent SETmcp_config = COALESCE(sqlc.narg('mcp_config'), mcp_config),model = COALESCE(sqlc.narg('model'), model),thinking_level = COALESCE(sqlc.narg('thinking_level'), thinking_level),+ service_tier = COALESCE(sqlc.narg('service_tier'), service_tier),composio_toolkit_allowlist = COALESCE(sqlc.narg('composio_toolkit_allowlist')::text[], composio_toolkit_allowlist),updated_at = now()WHERE id = $1@@ -134,6 +137,13 @@ UPDATE agent SET thinking_level = NULL, updated_at = now()WHERE id = $1RETURNING *;+-- name: ClearAgentServiceTier :one+-- Explicit NULL-clear for service_tier. COALESCE-based UpdateAgent cannot+-- set the column back to NULL, so the API routes "Runtime default" here.+UPDATE agent SET service_tier = NULL, updated_at = now()+WHERE id = $1+RETURNING *;+-- name: ClearAgentMcpConfig :oneUPDATE agent SET mcp_config = NULL, updated_at = now()WHERE id = $1