Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(agents): add per-agent runtime skill controls (#5686)
Jiayuan Zhang5d9295ac65f2
diff --git a/packages/core/api/client.ts b/packages/core/api/client.tsindex b62ae414e1..51c4d99c80 100644--- a/packages/core/api/client.ts+++ b/packages/core/api/client.ts@@ -53,6 +53,7 @@ import type {CreateSkillRequest,UpdateSkillRequest,SetAgentSkillsRequest,+ SetAgentRuntimeSkillEnabledRequest,PersonalAccessToken,CreatePersonalAccessTokenRequest,CreatePersonalAccessTokenResponse,@@ -1930,6 +1931,16 @@ export class ApiClient {});}+ async setAgentRuntimeSkillEnabled(+ agentId: string,+ data: SetAgentRuntimeSkillEnabledRequest,+ ): Promise<void> {+ await this.fetch(`/api/agents/${agentId}/runtime-skills/enabled`, {+ method: "PUT",+ body: JSON.stringify(data),+ });+ }+async removeAgentSkill(agentId: string, skillId: string): Promise<void> {await this.fetch(`/api/agents/${agentId}/skills/${skillId}`, {method: "DELETE",diff --git a/packages/core/types/agent.ts b/packages/core/types/agent.tsindex 10fc345ee4..14c6dae27a 100644--- a/packages/core/types/agent.ts+++ b/packages/core/types/agent.ts@@ -445,12 +445,32 @@ export interface Agent {thinking_level?: string;owner_id: string | null;skills: AgentSkillSummary[];+ /** Runtime-local skills this agent must not inherit. Older servers omit it. */+ disabled_runtime_skills?: DisabledRuntimeSkill[];created_at: string;updated_at: string;archived_at: string | null;archived_by: string | null;}+export interface DisabledRuntimeSkill {+ runtime_id: string;+ provider: string;+ root: "provider" | "universal" | "plugin";+ key: string;+ name?: string;+ plugin?: string;+}++export interface SetAgentRuntimeSkillEnabledRequest {+ runtime_id: string;+ root: "provider" | "universal" | "plugin";+ key: string;+ name: string;+ plugin?: string;+ enabled: boolean;+}+/*** Minimal skill shape embedded in an Agent payload (`GET /api/agents`,* `GET /api/agents/:id`). Only id/name/description are populated — the@@ -942,6 +962,8 @@ export interface RuntimeLocalSkillSummary {root?: "provider" | "universal" | "plugin";/** Enabled runtime plugin that contributed this skill, when applicable. */plugin?: string;+ /** New daemons set this only when they can enforce per-agent disablement. */+ can_disable?: boolean;file_count: number;}diff --git a/packages/core/types/index.ts b/packages/core/types/index.tsindex 7516c0f714..323a5334ed 100644--- a/packages/core/types/index.ts+++ b/packages/core/types/index.ts@@ -35,6 +35,8 @@ export type {Skill,SkillSummary,AgentSkillSummary,+ DisabledRuntimeSkill,+ SetAgentRuntimeSkillEnabledRequest,SkillFile,CreateSkillRequest,UpdateSkillRequest,diff --git a/packages/views/agents/components/tabs/skills-tab.test.tsx b/packages/views/agents/components/tabs/skills-tab.test.tsxindex 6d82e9c8ca..ed6d04a4c6 100644--- a/packages/views/agents/components/tabs/skills-tab.test.tsx+++ b/packages/views/agents/components/tabs/skills-tab.test.tsx@@ -14,6 +14,7 @@ const TEST_RESOURCES = { en: { common: enCommon, agents: enAgents } };const mockListSkills = vi.hoisted(() => vi.fn());const mockGetSkill = vi.hoisted(() => vi.fn());const mockSetAgentSkillEnabled = vi.hoisted(() => vi.fn());+const mockSetAgentRuntimeSkillEnabled = vi.hoisted(() => vi.fn());const mockRemoveAgentSkill = vi.hoisted(() => vi.fn());const mockRuntimeCapabilities = vi.hoisted(() => vi.fn());@@ -43,6 +44,8 @@ vi.mock("@multica/core/api", () => ({getSkill: (...args: unknown[]) => mockGetSkill(...args),setAgentSkills: vi.fn(),setAgentSkillEnabled: (...args: unknown[]) => mockSetAgentSkillEnabled(...args),+ setAgentRuntimeSkillEnabled: (...args: unknown[]) =>+ mockSetAgentRuntimeSkillEnabled(...args),removeAgentSkill: (...args: unknown[]) => mockRemoveAgentSkill(...args),},ApiError,@@ -135,6 +138,7 @@ describe("SkillsTab", () => {vi.clearAllMocks();mockListSkills.mockResolvedValue([]);mockSetAgentSkillEnabled.mockResolvedValue(undefined);+ mockSetAgentRuntimeSkillEnabled.mockResolvedValue(undefined);mockRemoveAgentSkill.mockResolvedValue(undefined);mockRuntimeCapabilities.mockResolvedValue({skills: [],@@ -201,6 +205,81 @@ describe("SkillsTab", () => {expect(screen.getByText("Host-level review workflow")).toBeInTheDocument();});+ it("turns a controllable inherited skill off for this agent", async () => {+ const user = userEvent.setup();+ mockRuntimeCapabilities.mockResolvedValue({+ skills: [+ {+ key: "local-review",+ name: "Local review",+ source_path: "~/.codex/skills/local-review",+ provider: "codex",+ root: "provider",+ can_disable: true,+ file_count: 1,+ },+ ],+ supported: true,+ mcpServers: [],+ mcpSupported: true,+ });++ renderSkillsTab({}, onlineRuntime);+ await user.click(+ await screen.findByRole("switch", {+ name: /Toggle inherited Local review/i,+ }),+ );++ expect(mockSetAgentRuntimeSkillEnabled).toHaveBeenCalledWith("agent-1", {+ runtime_id: "runtime-1",+ root: "provider",+ key: "local-review",+ name: "Local review",+ plugin: undefined,+ enabled: false,+ });+ });++ it("renders a persisted inherited-skill override as off", async () => {+ mockRuntimeCapabilities.mockResolvedValue({+ skills: [+ {+ key: "local-review",+ name: "Local review",+ source_path: "~/.codex/skills/local-review",+ provider: "codex",+ root: "provider",+ can_disable: true,+ file_count: 1,+ },+ ],+ supported: true,+ mcpServers: [],+ mcpSupported: true,+ });++ renderSkillsTab(+ {+ disabled_runtime_skills: [+ {+ runtime_id: "runtime-1",+ provider: "codex",+ root: "provider",+ key: "local-review",+ },+ ],+ },+ onlineRuntime,+ );++ expect(+ await screen.findByRole("switch", {+ name: /Toggle inherited Local review/i,+ }),+ ).not.toBeChecked();+ });+it("shows a permission notice when capability discovery is forbidden", async () => {mockRuntimeCapabilities.mockRejectedValue(new ApiError("insufficient permissions", 403, "Forbidden"),diff --git a/packages/views/agents/components/tabs/skills-tab.tsx b/packages/views/agents/components/tabs/skills-tab.tsxindex 439bb23d00..44bfdf51c0 100644--- a/packages/views/agents/components/tabs/skills-tab.tsx+++ b/packages/views/agents/components/tabs/skills-tab.tsx@@ -14,6 +14,7 @@ import { toast } from "sonner";import type {Agent,AgentRuntime,+ DisabledRuntimeSkill,RuntimeLocalSkillSummary,} from "@multica/core/types";import { api, ApiError } from "@multica/core/api";@@ -103,6 +104,34 @@ export function SkillsTab({}};+ const handleRuntimeToggle = async (+ skill: RuntimeLocalSkillSummary,+ enabled: boolean,+ ) => {+ if (!runtime || !skill.root) return;+ const busyKey = runtimeSkillIdentity(skill);+ setBusyId(busyKey);+ try {+ await api.setAgentRuntimeSkillEnabled(agent.id, {+ runtime_id: runtime.id,+ root: skill.root,+ key: skill.key,+ name: skill.name,+ plugin: skill.plugin,+ enabled,+ });+ await refreshAgent();+ } catch (error) {+ toast.error(+ error instanceof Error+ ? error.message+ : t(($) => $.tab_body.skills.runtime_toggle_failed_toast),+ );+ } finally {+ setBusyId(null);+ }+ };+const runtimeSkills = runtimeQuery.data?.skills ?? [];return (@@ -245,25 +274,66 @@ export function SkillsTab({<RuntimeNotice text={t(($) => $.tab_body.skills.runtime_empty)} />) : (<ul className="divide-y rounded-lg border bg-surface-raised/40">- {runtimeSkills.map((skill) => (- <li key={`${skill.root ?? "unknown"}:${skill.key}`}>- <button- type="button"- onClick={() => setSelected({ kind: "runtime", skill })}- className="flex w-full items-center gap-3 p-3 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"+ {runtimeSkills.map((skill) => {+ const disabled = isRuntimeSkillDisabled(+ agent.disabled_runtime_skills,+ runtime?.id,+ skill,+ );+ const busyKey = runtimeSkillIdentity(skill);+ const busy = busyId === busyKey;+ return (+ <li+ key={`${skill.root ?? "unknown"}:${skill.key}`}+ className="flex items-center gap-3 p-3">- <span className="flex size-9 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground">- <Server className="h-4 w-4" />- </span>- <span className="min-w-0 flex-1">- <span className="block text-sm font-medium">{skill.name}</span>- <span className="block truncate text-xs text-muted-foreground">- {skill.description || skill.source_path}+ <button+ type="button"+ onClick={() => setSelected({ kind: "runtime", skill })}+ className="flex min-w-0 flex-1 items-center gap-3 rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-ring"+ >+ <span+ className={cn(+ "flex size-9 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",+ disabled && "opacity-50",+ )}+ >+ <Server className="h-4 w-4" />+ </span>+ <span className="min-w-0 flex-1">+ <span+ className={cn(+ "block text-sm font-medium",+ disabled && "text-muted-foreground",+ )}+ >+ {skill.name}+ </span>+ <span className="block truncate text-xs text-muted-foreground">+ {skill.description || skill.source_path}+ </span></span>- </span>- </button>- </li>- ))}+ </button>+ {canEdit &&+ skill.can_disable === true &&+ skill.root &&+ (busy ? (+ <Loader2 className="h-4 w-4 animate-spin text-muted-foreground motion-reduce:animate-none" />+ ) : (+ <Switch+ checked={!disabled}+ onCheckedChange={(checked) =>+ handleRuntimeToggle(skill, checked)+ }+ aria-label={t(+ ($) => $.tab_body.skills.runtime_toggle_aria,+ { name: skill.name },+ )}+ />+ ))}+ </li>+ );+ })}</ul>)}</CapabilitySection>@@ -279,6 +349,26 @@ export function SkillsTab({);}+function runtimeSkillIdentity(skill: RuntimeLocalSkillSummary): string {+ return `runtime:${skill.root ?? "unknown"}:${skill.key}:${skill.plugin ?? ""}`;+}++function isRuntimeSkillDisabled(+ disabledSkills: DisabledRuntimeSkill[] | undefined,+ runtimeId: string | undefined,+ skill: RuntimeLocalSkillSummary,+): boolean {+ if (!runtimeId || !skill.root) return false;+ return (disabledSkills ?? []).some(+ (disabled) =>+ disabled.runtime_id === runtimeId &&+ disabled.provider === skill.provider &&+ disabled.root === skill.root &&+ disabled.key === skill.key &&+ (disabled.plugin ?? "") === (skill.plugin ?? ""),+ );+}+function CapabilitySection({title,description,diff --git a/packages/views/locales/en/agents.json b/packages/views/locales/en/agents.jsonindex f1a3d12a54..1572dd428b 100644--- a/packages/views/locales/en/agents.json+++ b/packages/views/locales/en/agents.json@@ -582,7 +582,7 @@"save_failed_toast": "Failed to save routing config"},"skills": {- "intro": "This is the agent's effective skill set. Workspace skills are managed here; local runtime skills are discovered automatically and inherited read-only.",+ "intro": "This is the agent's effective skill set. Workspace skills are managed here; inherited Codex and Claude Code skills can also be turned off per agent.","assigned_title": "Assigned to agent","assigned_hint": "Workspace skills travel with the agent. Turn one off temporarily without removing it.","runtime_title": "Inherited from runtime",@@ -594,6 +594,8 @@"toggle_aria": "Toggle {{name}}","remove_aria": "Remove {{name}}","toggle_failed_toast": "Failed to change skill status",+ "runtime_toggle_aria": "Toggle inherited {{name}}",+ "runtime_toggle_failed_toast": "Failed to change inherited skill status","runtime_missing": "Assign a local runtime to discover inherited skills.","runtime_offline": "The local runtime is offline. Reconnect it to refresh inherited skills.","runtime_discovering": "Discovering skills from the local runtime…",diff --git a/packages/views/locales/ja/agents.json b/packages/views/locales/ja/agents.jsonindex 5112064e66..37bf2953ee 100644--- a/packages/views/locales/ja/agents.json+++ b/packages/views/locales/ja/agents.json@@ -482,6 +482,8 @@"toggle_aria": "{{name}} の有効・無効を切り替え","remove_aria": "{{name}} を削除","toggle_failed_toast": "スキルの状態を変更できませんでした",+ "runtime_toggle_aria": "継承した {{name}} の有効・無効を切り替え",+ "runtime_toggle_failed_toast": "継承スキルの状態を変更できませんでした","runtime_missing": "継承スキルを検出するには、ローカルランタイムを割り当ててください。","runtime_offline": "ローカルランタイムはオフラインです。再接続すると更新できます。","runtime_discovering": "ローカルランタイムからスキルを検出中…",@@ -496,7 +498,7 @@"detail_plugin": "プラグイン","detail_files": "ファイル","detail_supporting_files": "関連ファイル",- "intro": "このエージェントに割り当てられたワークスペースのスキルです。ローカルランタイムのスキルは常に自動的に利用できます。",+ "intro": "このエージェントの有効なスキルです。Codex と Claude Code から継承したスキルも、エージェントごとに無効化できます。","add_action": "スキルを追加","empty_title": "割り当てられたスキルがありません","empty_hint": "ワークスペースのスキルを追加して、チームの知識をこのエージェントと共有しましょう。",diff --git a/packages/views/locales/ko/agents.json b/packages/views/locales/ko/agents.jsonindex c6819f3718..0132a52d04 100644--- a/packages/views/locales/ko/agents.json+++ b/packages/views/locales/ko/agents.json@@ -490,6 +490,8 @@"toggle_aria": "{{name}} 켜기 또는 끄기","remove_aria": "{{name}} 제거","toggle_failed_toast": "스킬 상태를 변경하지 못했습니다",+ "runtime_toggle_aria": "상속된 {{name}} 켜기 또는 끄기",+ "runtime_toggle_failed_toast": "상속된 스킬 상태를 변경하지 못했습니다","runtime_missing": "상속된 스킬을 탐색하려면 로컬 런타임을 할당하세요.","runtime_offline": "로컬 런타임이 오프라인입니다. 다시 연결하면 새로고침할 수 있습니다.","runtime_discovering": "로컬 런타임에서 스킬을 탐색하는 중…",@@ -504,7 +506,7 @@"detail_plugin": "플러그인","detail_files": "파일","detail_supporting_files": "지원 파일",- "intro": "이 에이전트에 할당된 워크스페이스 스킬입니다. 로컬 런타임 스킬은 항상 자동으로 사용할 수 있습니다.",+ "intro": "이 에이전트의 유효한 스킬입니다. Codex와 Claude Code에서 상속된 스킬도 에이전트별로 끌 수 있습니다.","add_action": "스킬 추가","empty_title": "할당된 스킬이 없습니다","empty_hint": "워크스페이스 스킬을 추가해 이 에이전트와 팀 지식을 공유하세요.",diff --git a/packages/views/locales/zh-Hans/agents.json b/packages/views/locales/zh-Hans/agents.jsonindex e332c2537e..f22824dc05 100644--- a/packages/views/locales/zh-Hans/agents.json+++ b/packages/views/locales/zh-Hans/agents.json@@ -571,7 +571,7 @@"save_failed_toast": "保存路由配置失败"},"skills": {- "intro": "这里展示该智能体实际拥有的全部 skill。工作区 skill 可在此管理;本地运行时 skill 会自动发现并以只读方式继承。",+ "intro": "这里展示该智能体实际拥有的全部 skill。工作区 skill 可在此管理;从 Codex 和 Claude Code 继承的 skill 也可以按智能体单独关闭。","assigned_title": "分配给智能体","assigned_hint": "工作区 skill 会跟随智能体。你可以临时关闭,而不必将其移除。","runtime_title": "从运行时继承",@@ -583,6 +583,8 @@"toggle_aria": "启用或关闭 {{name}}","remove_aria": "移除 {{name}}","toggle_failed_toast": "修改 skill 状态失败",+ "runtime_toggle_aria": "启用或关闭继承的 {{name}}",+ "runtime_toggle_failed_toast": "修改继承 skill 状态失败","runtime_missing": "请先分配一个本地运行时,以发现继承的 skill。","runtime_offline": "本地运行时处于离线状态,重新连接后即可刷新继承的 skill。","runtime_discovering": "正在从本地运行时发现 skill…",diff --git a/server/cmd/server/router.go b/server/cmd/server/router.goindex e51b5705eb..843641c56b 100644--- a/server/cmd/server/router.go+++ b/server/cmd/server/router.go@@ -1218,6 +1218,7 @@ func NewRouterWithOptions(pool *pgxpool.Pool, hub *realtime.Hub, bus *events.Busr.Post("/labels", h.AttachLabelToAgent)r.Delete("/labels/{labelId}", h.DetachLabelFromAgent)r.Put("/skills/{skillId}/enabled", h.SetAgentSkillEnabled)+ r.Put("/runtime-skills/enabled", h.SetAgentRuntimeSkillEnabled)r.Delete("/skills/{skillId}", h.RemoveAgentSkill)// Dedicated env-management endpoint. Owner/admin only;// agent actors are denied. Every reveal / write isdiff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.goindex 4e67fb4b98..c1053241c3 100644--- a/server/internal/daemon/daemon.go+++ b/server/internal/daemon/daemon.go@@ -4076,6 +4076,7 @@ func (d *Daemon) runTask(ctx context.Context, task Task, provider string, slot iAgentName: agentName,AgentInstructions: instructions,AgentSkills: convertSkillsForEnv(skills),+ DisabledRuntimeSkills: convertDisabledRuntimeSkillsForEnv(task.Agent, task.RuntimeID, provider),Repos: convertReposForEnv(task.Repos),ProjectID: task.ProjectID,ProjectTitle: task.ProjectTitle,@@ -4583,12 +4584,13 @@ func (d *Daemon) runTask(ctx context.Context, task Task, provider string, slot i// survived to here, the backend must disclose to the user when the live// resume still fails — even across the fresh-session retry below, which// clears ResumeSessionID but not this (MUL-4424).- ResumeExpected: task.PriorSessionID != "",- ExtraArgs: extraArgs,- CustomArgs: customArgs,- McpConfig: mcpConfig,- ThinkingLevel: thinkingLevel,- OpenclawMode: openclawMode,+ ResumeExpected: task.PriorSessionID != "",+ ExtraArgs: extraArgs,+ CustomArgs: customArgs,+ McpConfig: mcpConfig,+ ThinkingLevel: thinkingLevel,+ OpenclawMode: openclawMode,+ ClaudeSettingsPath: env.ClaudeSettingsPath,}// Some providers do not reliably load the per-task runtime config files we// write into the task workdir:@@ -5561,6 +5563,25 @@ func convertSkillsForEnv(skills []SkillData) []execenv.SkillContextForEnv {return result}+func convertDisabledRuntimeSkillsForEnv(agentData *AgentData, runtimeID, provider string) []execenv.RuntimeSkillRefForEnv {+ if agentData == nil || len(agentData.DisabledRuntimeSkills) == 0 {+ return nil+ }+ result := make([]execenv.RuntimeSkillRefForEnv, 0, len(agentData.DisabledRuntimeSkills))+ for _, skill := range agentData.DisabledRuntimeSkills {+ if skill.RuntimeID != runtimeID || skill.Provider != provider {+ continue+ }+ result = append(result, execenv.RuntimeSkillRefForEnv{+ Root: skill.Root,+ Key: skill.Key,+ Name: skill.Name,+ Plugin: skill.Plugin,+ })+ }+ return result+}+// composeOpenclawIncludeRoots returns the value the daemon should set for// OPENCLAW_INCLUDE_ROOTS on the child openclaw process so its `$include`// loader will follow the wrapper's reference out of envRoot into thediff --git a/server/internal/daemon/daemon_test.go b/server/internal/daemon/daemon_test.goindex efc85d4531..4677dd1939 100644--- a/server/internal/daemon/daemon_test.go+++ b/server/internal/daemon/daemon_test.go@@ -4165,3 +4165,17 @@ func TestHandleTask_AcksCancelOnPostRunStatusCheck(t *testing.T) {t.Fatalf("cancel-ack calls = %d, want 1", got)}}++func TestConvertDisabledRuntimeSkillsForEnvScopesToClaimedRuntime(t *testing.T) {+ t.Parallel()++ agentData := &AgentData{DisabledRuntimeSkills: []DisabledRuntimeSkillData{+ {RuntimeID: "runtime-1", Provider: "claude", Root: "provider", Key: "review", Name: "Review"},+ {RuntimeID: "runtime-2", Provider: "claude", Root: "provider", Key: "other-runtime"},+ {RuntimeID: "runtime-1", Provider: "codex", Root: "provider", Key: "other-provider"},+ }}+ got := convertDisabledRuntimeSkillsForEnv(agentData, "runtime-1", "claude")+ if len(got) != 1 || got[0].Key != "review" || got[0].Name != "Review" {+ t.Fatalf("unexpected scoped runtime skill policy: %+v", got)+ }+}diff --git a/server/internal/daemon/execenv/execenv.go b/server/internal/daemon/execenv/execenv.goindex 4edb666106..ab3ef32bdc 100644--- a/server/internal/daemon/execenv/execenv.go+++ b/server/internal/daemon/execenv/execenv.go@@ -118,6 +118,7 @@ type TaskContextForEnv struct {AgentName stringAgentInstructions string // agent identity/persona instructions, injected into CLAUDE.mdAgentSkills []SkillContextForEnv+ DisabledRuntimeSkills []RuntimeSkillRefForEnvRepos []RepoContextForEnv // workspace repos available for checkoutProjectID string // issue's project, when presentProjectTitle string // human-readable project title@@ -199,6 +200,9 @@ type Environment struct {LocalDirectory bool// CodexHome is the path to the per-task CODEX_HOME directory (set only for codex provider).CodexHome string+ // ClaudeSettingsPath is a task-local --settings JSON file that applies+ // disabled runtime-skill policy without mutating the user's Claude config.+ ClaudeSettingsPath string// TaskHome is the per-task writable HOME directory (set only for the codex// provider on Linux, where the workspace-write Landlock sandbox makes the// real HOME read-only). When non-empty the daemon redirects@@ -351,12 +355,20 @@ func Prepare(params PrepareParams, logger *slog.Logger) (*Environment, error) {if err := prepareCodexHomeWithOpts(codexHome, CodexHomeOptions{CodexVersion: params.CodexVersion, IsLocalDirectory: params.LocalWorkDir != "", SessionStoreKey: codexSessionStoreKey(params.Profile, params.Task.AgentID, params.Task.IssueID), WritableRoots: writableRoots, CodexCustomArgs: params.CodexCustomArgs}, logger); err != nil {return nil, fmt.Errorf("execenv: prepare codex-home: %w", err)}- if err := hydrateCodexSkills(codexHome, params.Task.AgentSkills, logger); err != nil {+ if err := hydrateCodexSkills(codexHome, params.Task.AgentSkills, params.Task.DisabledRuntimeSkills, logger); err != nil {return nil, fmt.Errorf("execenv: hydrate codex skills: %w", err)}env.CodexHome = codexHome}+ if params.Provider == "claude" {+ settingsPath, err := prepareClaudeSkillSettings(envRoot, params.Task.DisabledRuntimeSkills, params.Task.AgentSkills)+ if err != nil {+ return nil, fmt.Errorf("execenv: prepare claude skill settings: %w", err)+ }+ env.ClaudeSettingsPath = settingsPath+ }+// For Hermes, redirect HERMES_HOME to a per-task compatibility overlay ONLY// when the agent has skills bound. A skill-less Hermes task keeps the user's// real home and its original behavior untouched. The overlay makes the bound@@ -568,12 +580,21 @@ func Reuse(params ReuseParams, logger *slog.Logger) *Environment {logger.Warn("execenv: refresh codex-home failed", "error", err)} else {env.CodexHome = codexHome- if err := hydrateCodexSkills(codexHome, params.Task.AgentSkills, logger); err != nil {+ if err := hydrateCodexSkills(codexHome, params.Task.AgentSkills, params.Task.DisabledRuntimeSkills, logger); err != nil {logger.Warn("execenv: refresh codex skills failed", "error", err)}}}+ if params.Provider == "claude" && env.RootDir != "" {+ settingsPath, err := prepareClaudeSkillSettings(env.RootDir, params.Task.DisabledRuntimeSkills, params.Task.AgentSkills)+ if err != nil {+ logger.Warn("execenv: refresh claude skill settings failed", "error", err)+ } else {+ env.ClaudeSettingsPath = settingsPath+ }+ }+// Refresh (or tear down) the per-task HERMES_HOME on reuse. With skills// bound, rebuild the overlay so an added/removed/edited skill and the// mirrored home/config track the user's current ~/.hermes/ before the next@@ -662,7 +683,7 @@ func Reuse(params ReuseParams, logger *slog.Logger) *Environment {// user's real ~/.codex/. Other runtimes leave HOME untouched and discover// user-level skills natively (see context.go for the workdir-local paths// they use for workspace skills).-func hydrateCodexSkills(codexHome string, workspaceSkills []SkillContextForEnv, logger *slog.Logger) error {+func hydrateCodexSkills(codexHome string, workspaceSkills []SkillContextForEnv, disabledRuntimeSkills []RuntimeSkillRefForEnv, logger *slog.Logger) error {skillsDir := filepath.Join(codexHome, "skills")if err := os.RemoveAll(skillsDir); err != nil {return fmt.Errorf("clear codex skills dir: %w", err)@@ -670,14 +691,12 @@ func hydrateCodexSkills(codexHome string, workspaceSkills []SkillContextForEnv,if err := seedUserCodexSkills(codexHome, workspaceSkills, logger); err != nil {logger.Warn("execenv: seed user codex skills failed", "error", err)}- if len(workspaceSkills) == 0 {- return nil+ if len(workspaceSkills) > 0 {+ if err := writeSkillFiles(skillsDir, workspaceSkills, nil); err != nil {+ return err+ }}- // Codex skills live under env.RootDir/codex-home, which the GC loop- // (cloud) or env teardown (local_directory) wipes wholesale — they- // don't sit inside the user's workdir and don't need sidecar manifest- // tracking.- return writeSkillFiles(skillsDir, workspaceSkills, nil)+ return ensureCodexDisabledSkillsConfig(filepath.Join(codexHome, "config.toml"), codexHome, disabledRuntimeSkills, workspaceSkills)}// GCMetaKind identifies which kind of parent record a task workdir belongs to.diff --git a/server/internal/daemon/execenv/runtime_skill_policy.go b/server/internal/daemon/execenv/runtime_skill_policy.gonew file mode 100644index 0000000000..7b539174ef--- /dev/null+++ b/server/internal/daemon/execenv/runtime_skill_policy.go@@ -0,0 +1,159 @@+package execenv++import (+ "encoding/json"+ "fmt"+ "os"+ "path/filepath"+ "strconv"+ "strings"+)++const claudeRuntimeSkillSettingsFile = "claude-runtime-skill-settings.json"++// RuntimeSkillRefForEnv identifies a runtime-local skill for provider-specific+// task environment filtering. Provider and runtime are already selected by the+// task, so only the discovery root and provider-native key are needed here.+type RuntimeSkillRefForEnv struct {+ Root string+ Key string+ Name string+ Plugin string+}++func cleanRuntimeSkillKey(key string) (string, bool) {+ cleaned := filepath.Clean(filepath.FromSlash(strings.TrimSpace(key)))+ if cleaned == "." || filepath.IsAbs(cleaned) || cleaned == ".." || strings.HasPrefix(cleaned, ".."+string(filepath.Separator)) {+ return "", false+ }+ return filepath.ToSlash(cleaned), true+}++func prepareClaudeSkillSettings(envRoot string, disabled []RuntimeSkillRefForEnv, workspaceSkills []SkillContextForEnv) (string, error) {+ path := filepath.Join(envRoot, claudeRuntimeSkillSettingsFile)+ if len(disabled) == 0 {+ if err := os.Remove(path); err != nil && !os.IsNotExist(err) {+ return "", err+ }+ return "", nil+ }++ overrides := make(map[string]string)+ deny := make([]string, 0, len(disabled)*2)+ seenDeny := make(map[string]struct{}, len(disabled)*2)+ addDeny := func(rule string) {+ if _, exists := seenDeny[rule]; exists {+ return+ }+ seenDeny[rule] = struct{}{}+ deny = append(deny, rule)+ }+ for _, skill := range disabled {+ key, ok := cleanRuntimeSkillKey(skill.Key)+ if !ok {+ continue+ }+ invocationName := strings.TrimSpace(skill.Name)+ if invocationName == "" {+ invocationName = filepath.Base(filepath.FromSlash(key))+ }+ if workspaceClaimsRuntimeSkill(invocationName, workspaceSkills) {+ continue+ }+ // Claude Code's skillOverrides fully hides personal/project skills.+ // Plugin skills ignore that setting, so the permission deny below is+ // also emitted for every key and is the enforcement path for plugins.+ if skill.Root != "plugin" {+ overrides[invocationName] = "off"+ } else {+ invocationName = key+ }+ addDeny("Skill(" + invocationName + ")")+ addDeny("Skill(" + invocationName + " *)")+ }+ if len(overrides) == 0 && len(deny) == 0 {+ if err := os.Remove(path); err != nil && !os.IsNotExist(err) {+ return "", err+ }+ return "", nil+ }+ payload := map[string]any{+ "skillOverrides": overrides,+ "permissions": map[string]any{+ "deny": deny,+ },+ }+ data, err := json.Marshal(payload)+ if err != nil {+ return "", err+ }+ if err := os.WriteFile(path, data, 0o600); err != nil {+ return "", err+ }+ return path, nil+}++func ensureCodexDisabledSkillsConfig(configPath, codexHome string, disabled []RuntimeSkillRefForEnv, workspaceSkills []SkillContextForEnv) error {+ if len(disabled) == 0 {+ return nil+ }+ home := ""+ paths := make([]string, 0, len(disabled))+ seen := make(map[string]struct{}, len(disabled))+ for _, skill := range disabled {+ key, ok := cleanRuntimeSkillKey(skill.Key)+ if !ok {+ continue+ }+ var skillPath string+ switch skill.Root {+ case "provider":+ firstKeyPart := strings.SplitN(key, "/", 2)[0]+ if workspaceClaimsRuntimeSkill(firstKeyPart, workspaceSkills) {+ continue+ }+ skillPath = filepath.Join(codexHome, "skills", filepath.FromSlash(key), "SKILL.md")+ case "universal":+ if home == "" {+ var err error+ home, err = os.UserHomeDir()+ if err != nil {+ return fmt.Errorf("resolve user home for disabled Codex skills: %w", err)+ }+ }+ skillPath = filepath.Join(home, ".agents", "skills", filepath.FromSlash(key), "SKILL.md")+ default:+ continue+ }+ if _, exists := seen[skillPath]; exists {+ continue+ }+ seen[skillPath] = struct{}{}+ paths = append(paths, skillPath)+ }+ if len(paths) == 0 {+ return nil+ }+ file, err := os.OpenFile(configPath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0o600)+ if err != nil {+ return err+ }+ defer file.Close()+ for _, path := range paths {+ block := "\n[[skills.config]]\npath = " + strconv.Quote(filepath.ToSlash(path)) + "\nenabled = false\n"+ if _, err := file.WriteString(block); err != nil {+ return err+ }+ }+ return nil+}++func workspaceClaimsRuntimeSkill(name string, workspaceSkills []SkillContextForEnv) bool {+ claim := sanitizeSkillName(name)+ for _, skill := range workspaceSkills {+ if sanitizeSkillName(skill.Name) == claim {+ return true+ }+ }+ return false+}diff --git a/server/internal/daemon/execenv/runtime_skill_policy_test.go b/server/internal/daemon/execenv/runtime_skill_policy_test.gonew file mode 100644index 0000000000..4a16fa3130--- /dev/null+++ b/server/internal/daemon/execenv/runtime_skill_policy_test.go@@ -0,0 +1,129 @@+package execenv++import (+ "encoding/json"+ "os"+ "path/filepath"+ "strings"+ "testing"+)++func TestPrepareClaudeSkillSettings(t *testing.T) {+ t.Parallel()++ root := t.TempDir()+ path, err := prepareClaudeSkillSettings(root, []RuntimeSkillRefForEnv{+ {Root: "provider", Key: "review-dir", Name: "review"},+ {Root: "plugin", Key: "paper:design-to-code", Plugin: "paper@market"},+ }, nil)+ if err != nil {+ t.Fatalf("prepareClaudeSkillSettings: %v", err)+ }+ if path == "" {+ t.Fatal("expected task-local settings path")+ }+ data, err := os.ReadFile(path)+ if err != nil {+ t.Fatalf("read settings: %v", err)+ }+ var got struct {+ SkillOverrides map[string]string `json:"skillOverrides"`+ Permissions struct {+ Deny []string `json:"deny"`+ } `json:"permissions"`+ }+ if err := json.Unmarshal(data, &got); err != nil {+ t.Fatalf("decode settings: %v", err)+ }+ if got.SkillOverrides["review"] != "off" {+ t.Fatalf("ordinary skill override = %q, want off", got.SkillOverrides["review"])+ }+ if _, exists := got.SkillOverrides["paper:design-to-code"]; exists {+ t.Fatal("plugin skills must not use Claude's unsupported skillOverrides path")+ }+ for _, want := range []string{+ "Skill(review)",+ "Skill(review *)",+ "Skill(paper:design-to-code)",+ "Skill(paper:design-to-code *)",+ } {+ found := false+ for _, rule := range got.Permissions.Deny {+ found = found || rule == want+ }+ if !found {+ t.Errorf("missing deny rule %q in %v", want, got.Permissions.Deny)+ }+ }++ cleared, err := prepareClaudeSkillSettings(root, nil, nil)+ if err != nil {+ t.Fatalf("clear settings: %v", err)+ }+ if cleared != "" {+ t.Fatalf("cleared settings path = %q, want empty", cleared)+ }+ if _, err := os.Stat(path); !os.IsNotExist(err) {+ t.Fatalf("stale settings file still exists: %v", err)+ }+}++func TestEnsureCodexDisabledSkillsConfig(t *testing.T) {+ t.Parallel()++ root := t.TempDir()+ configPath := filepath.Join(root, "config.toml")+ if err := os.WriteFile(configPath, []byte("model = \"gpt-5\"\n"), 0o600); err != nil {+ t.Fatal(err)+ }+ if err := ensureCodexDisabledSkillsConfig(configPath, root, []RuntimeSkillRefForEnv{+ {Root: "provider", Key: "review"},+ {Root: "universal", Key: "shared/release"},+ {Root: "provider", Key: "../escape"},+ }, nil); err != nil {+ t.Fatalf("ensureCodexDisabledSkillsConfig: %v", err)+ }+ data, err := os.ReadFile(configPath)+ if err != nil {+ t.Fatal(err)+ }+ content := string(data)+ if strings.Count(content, "[[skills.config]]") != 2 {+ t.Fatalf("disabled entry count mismatch:\n%s", content)+ }+ wantProvider := filepath.ToSlash(filepath.Join(root, "skills", "review", "SKILL.md"))+ if !strings.Contains(content, wantProvider) {+ t.Fatalf("missing provider skill path %q:\n%s", wantProvider, content)+ }+ if strings.Contains(content, "escape") {+ t.Fatalf("unsafe key leaked into config:\n%s", content)+ }+}++func TestRuntimeSkillPoliciesYieldToWorkspaceSkills(t *testing.T) {+ t.Parallel()++ root := t.TempDir()+ workspaceSkills := []SkillContextForEnv{{Name: "Review"}}+ settingsPath, err := prepareClaudeSkillSettings(root, []RuntimeSkillRefForEnv{+ {Root: "provider", Key: "review-dir", Name: "review"},+ }, workspaceSkills)+ if err != nil {+ t.Fatalf("prepareClaudeSkillSettings: %v", err)+ }+ if settingsPath != "" {+ t.Fatalf("workspace-owned Claude skill was disabled via %q", settingsPath)+ }++ configPath := filepath.Join(root, "config.toml")+ if err := ensureCodexDisabledSkillsConfig(configPath, root, []RuntimeSkillRefForEnv{+ {Root: "provider", Key: "review"},+ }, workspaceSkills); err != nil {+ t.Fatalf("ensureCodexDisabledSkillsConfig: %v", err)+ }+ if data, err := os.ReadFile(configPath); err == nil && strings.Contains(string(data), "[[skills.config]]") {+ t.Fatalf("workspace-owned Codex skill was disabled:\n%s", data)+ } else if err != nil && !os.IsNotExist(err) {+ t.Fatal(err)+ }+}diff --git a/server/internal/daemon/local_skills.go b/server/internal/daemon/local_skills.goindex da41602010..ffbf3185c6 100644--- a/server/internal/daemon/local_skills.go+++ b/server/internal/daemon/local_skills.go@@ -40,9 +40,10 @@ type runtimeLocalSkillSummary struct {// Older daemons that predate multi-root discovery omit the field; the// server treats an empty value as "unknown" rather than a provider/// universal assertion.- Root string `json:"root,omitempty"`- Plugin string `json:"plugin,omitempty"`- FileCount int `json:"file_count"`+ Root string `json:"root,omitempty"`+ Plugin string `json:"plugin,omitempty"`+ CanDisable bool `json:"can_disable,omitempty"`+ FileCount int `json:"file_count"`}type runtimeLocalSkillBundle struct {@@ -493,6 +494,7 @@ func enumerateLocalSkills(Provider: provider,Root: root.kind,Plugin: root.plugin,+ CanDisable: provider == "codex" || provider == "claude",// `files` is the supporting bundle (collectLocalSkillFiles// intentionally excludes SKILL.md so the bundle's `Content`// field can carry it without duplication on import). For thediff --git a/server/internal/daemon/local_skills_test.go b/server/internal/daemon/local_skills_test.goindex a9ba7fb411..b231e47023 100644--- a/server/internal/daemon/local_skills_test.go+++ b/server/internal/daemon/local_skills_test.go@@ -95,6 +95,9 @@ func TestListRuntimeLocalSkills_Claude(t *testing.T) {if skill.SourcePath != "~/.claude/skills/review-helper" {t.Fatalf("source_path = %q", skill.SourcePath)}+ if !skill.CanDisable {+ t.Fatal("claude runtime skill should be controllable")+ }}// TestListRuntimeLocalSkills_Codebuddy is the regression guard for a bug@@ -138,6 +141,9 @@ func TestListRuntimeLocalSkills_Codebuddy(t *testing.T) {if skill.SourcePath != "~/.codebuddy/skills/review-helper" {t.Fatalf("source_path = %q, want ~/.codebuddy/skills/review-helper", skill.SourcePath)}+ if skill.CanDisable {+ t.Fatal("codebuddy runtime skill controls are not supported yet")+ }}func TestRuntimeLocalSkills_CodebuddyExcludesClaudePluginSkills(t *testing.T) {diff --git a/server/internal/daemon/types.go b/server/internal/daemon/types.goindex 89ac57d595..9dacff19aa 100644--- a/server/internal/daemon/types.go+++ b/server/internal/daemon/types.go@@ -166,16 +166,17 @@ type CoalescedCommentData struct {// AgentData holds agent details returned by the claim endpoint.type AgentData struct {- ID string `json:"id"`- Name string `json:"name"`- Instructions string `json:"instructions"`- Skills []SkillData `json:"skills,omitempty"`- SkillRefs []SkillRefData `json:"skill_refs,omitempty"`- CustomEnv map[string]string `json:"custom_env,omitempty"`- CustomArgs []string `json:"custom_args,omitempty"`- McpConfig json.RawMessage `json:"mcp_config,omitempty"`- Model string `json:"model,omitempty"`- ThinkingLevel string `json:"thinking_level,omitempty"`+ ID string `json:"id"`+ Name string `json:"name"`+ Instructions string `json:"instructions"`+ Skills []SkillData `json:"skills,omitempty"`+ SkillRefs []SkillRefData `json:"skill_refs,omitempty"`+ CustomEnv map[string]string `json:"custom_env,omitempty"`+ CustomArgs []string `json:"custom_args,omitempty"`+ McpConfig json.RawMessage `json:"mcp_config,omitempty"`+ Model string `json:"model,omitempty"`+ ThinkingLevel string `json:"thinking_level,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. The// daemon decodes provider-specific fields (e.g. openclaw mode +@@ -183,6 +184,17 @@ type AgentData struct {RuntimeConfig json.RawMessage `json:"runtime_config,omitempty"`}+// DisabledRuntimeSkillData is the task-wire identity of one runtime-local+// skill that must be hidden from this agent's provider process.+type DisabledRuntimeSkillData struct {+ RuntimeID string `json:"runtime_id"`+ Provider string `json:"provider"`+ Root string `json:"root"`+ Key string `json:"key"`+ Name string `json:"name,omitempty"`+ Plugin string `json:"plugin,omitempty"`+}+// SkillData represents a structured skill for task execution.type SkillData struct {ID string `json:"id"`diff --git a/server/internal/handler/agent.go b/server/internal/handler/agent.goindex 88bfef2817..f3a3e44392 100644--- a/server/internal/handler/agent.go+++ b/server/internal/handler/agent.go@@ -84,14 +84,15 @@ type AgentResponse struct {// members infer another member's integration footprint. Redacted to// `nil` + `composio_toolkit_allowlist_redacted=true` for non-owners,// mirroring the existing mcp_config redaction contract.- ComposioToolkitAllowlist []string `json:"composio_toolkit_allowlist,omitempty"`- ComposioToolkitAllowlistRedacted bool `json:"composio_toolkit_allowlist_redacted,omitempty"`- OwnerID *string `json:"owner_id"`- Skills []AgentSkillSummary `json:"skills"`- CreatedAt string `json:"created_at"`- UpdatedAt string `json:"updated_at"`- ArchivedAt *string `json:"archived_at"`- ArchivedBy *string `json:"archived_by"`+ ComposioToolkitAllowlist []string `json:"composio_toolkit_allowlist,omitempty"`+ ComposioToolkitAllowlistRedacted bool `json:"composio_toolkit_allowlist_redacted,omitempty"`+ OwnerID *string `json:"owner_id"`+ Skills []AgentSkillSummary `json:"skills"`+ DisabledRuntimeSkills []DisabledRuntimeSkill `json:"disabled_runtime_skills"`+ CreatedAt string `json:"created_at"`+ UpdatedAt string `json:"updated_at"`+ ArchivedAt *string `json:"archived_at"`+ ArchivedBy *string `json:"archived_by"`}// runtimeConfigGatewayTokenMask is the placeholder the API substitutes for@@ -175,6 +176,7 @@ func agentToResponse(a db.Agent) AgentResponse {ComposioToolkitAllowlist: composioAllowlist,OwnerID: uuidToPtr(a.OwnerID),Skills: []AgentSkillSummary{},+ DisabledRuntimeSkills: decodeDisabledRuntimeSkills(a.DisabledRuntimeSkills),CreatedAt: timestampToString(a.CreatedAt),UpdatedAt: timestampToString(a.UpdatedAt),ArchivedAt: timestampToPtr(a.ArchivedAt),@@ -556,16 +558,17 @@ type CoalescedCommentData struct {// TaskAgentData holds agent info included in claim responses so the daemon// can set up the execution environment (branch naming, skill files, instructions).type TaskAgentData struct {- ID string `json:"id"`- Name string `json:"name"`- Instructions string `json:"instructions"`- Skills []service.AgentSkillData `json:"skills,omitempty"`- SkillRefs []service.AgentSkillRefData `json:"skill_refs,omitempty"`- CustomEnv map[string]string `json:"custom_env,omitempty"`- CustomArgs []string `json:"custom_args,omitempty"`- McpConfig json.RawMessage `json:"mcp_config,omitempty"`- Model string `json:"model,omitempty"`- ThinkingLevel string `json:"thinking_level,omitempty"`+ ID string `json:"id"`+ Name string `json:"name"`+ Instructions string `json:"instructions"`+ Skills []service.AgentSkillData `json:"skills,omitempty"`+ SkillRefs []service.AgentSkillRefData `json:"skill_refs,omitempty"`+ CustomEnv map[string]string `json:"custom_env,omitempty"`+ CustomArgs []string `json:"custom_args,omitempty"`+ McpConfig json.RawMessage `json:"mcp_config,omitempty"`+ Model string `json:"model,omitempty"`+ ThinkingLevel string `json:"thinking_level,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// `mode` + `gateway.*` to choose between embedded and gateway routingdiff --git a/server/internal/handler/agent_runtime_skills.go b/server/internal/handler/agent_runtime_skills.gonew file mode 100644index 0000000000..2274d3af0d--- /dev/null+++ b/server/internal/handler/agent_runtime_skills.go@@ -0,0 +1,210 @@+package handler++import (+ "encoding/json"+ "log/slog"+ "net/http"+ "path/filepath"+ "strings"++ "github.com/go-chi/chi/v5"+ "github.com/multica-ai/multica/server/internal/logger"+ db "github.com/multica-ai/multica/server/pkg/db/generated"+ "github.com/multica-ai/multica/server/pkg/protocol"+)++const maxRuntimeSkillKeyLength = 512++// DisabledRuntimeSkill identifies one runtime-local skill that an agent must+// not inherit. RuntimeID scopes the choice to a single machine/runtime so a+// same-named skill on another runtime is unaffected.+type DisabledRuntimeSkill struct {+ RuntimeID string `json:"runtime_id"`+ Provider string `json:"provider"`+ Root string `json:"root"`+ Key string `json:"key"`+ Name string `json:"name,omitempty"`+ Plugin string `json:"plugin,omitempty"`+}++func decodeDisabledRuntimeSkills(raw []byte) []DisabledRuntimeSkill {+ if len(raw) == 0 {+ return []DisabledRuntimeSkill{}+ }+ var skills []DisabledRuntimeSkill+ if err := json.Unmarshal(raw, &skills); err != nil || skills == nil {+ return []DisabledRuntimeSkill{}+ }+ return skills+}++func disabledRuntimeSkillsFor(raw []byte, runtimeID, provider string) []DisabledRuntimeSkill {+ all := decodeDisabledRuntimeSkills(raw)+ result := make([]DisabledRuntimeSkill, 0, len(all))+ for _, skill := range all {+ if skill.RuntimeID == runtimeID && skill.Provider == provider {+ result = append(result, skill)+ }+ }+ return result+}++func normalizeRuntimeSkillIdentity(root, key, plugin string) (string, string, string, bool) {+ root = strings.TrimSpace(root)+ key = strings.TrimSpace(key)+ plugin = strings.TrimSpace(plugin)+ if len(key) == 0 || len(key) > maxRuntimeSkillKeyLength {+ return "", "", "", false+ }+ cleaned := filepath.ToSlash(filepath.Clean(filepath.FromSlash(key)))+ if cleaned == "." || filepath.IsAbs(cleaned) || cleaned == ".." || strings.HasPrefix(cleaned, "../") {+ return "", "", "", false+ }+ switch root {+ case "provider", "universal":+ plugin = ""+ case "plugin":+ if plugin == "" {+ return "", "", "", false+ }+ default:+ return "", "", "", false+ }+ return root, cleaned, plugin, true+}++func sameDisabledRuntimeSkill(a, b DisabledRuntimeSkill) bool {+ return a.RuntimeID == b.RuntimeID && a.Provider == b.Provider &&+ a.Root == b.Root && a.Key == b.Key && a.Plugin == b.Plugin+}++// SetAgentRuntimeSkillEnabled persists a per-agent override for a skill that+// is discovered from the agent's currently assigned local runtime.+func (h *Handler) SetAgentRuntimeSkillEnabled(w http.ResponseWriter, r *http.Request) {+ agentID := chi.URLParam(r, "id")+ agent, ok := h.loadAgentForUser(w, r, agentID)+ if !ok {+ return+ }+ if !h.canManageAgent(w, r, agent) {+ return+ }++ var req struct {+ RuntimeID string `json:"runtime_id"`+ Root string `json:"root"`+ Key string `json:"key"`+ Name string `json:"name"`+ Plugin string `json:"plugin"`+ Enabled *bool `json:"enabled"`+ }+ if err := json.NewDecoder(r.Body).Decode(&req); err != nil || req.Enabled == nil {+ writeError(w, http.StatusBadRequest, "runtime_id, root, key, and enabled are required")+ return+ }+ runtimeID, ok := parseUUIDOrBadRequest(w, req.RuntimeID, "runtime_id")+ if !ok {+ return+ }+ if !agent.RuntimeID.Valid || agent.RuntimeID != runtimeID {+ writeError(w, http.StatusConflict, "agent is no longer assigned to this runtime")+ return+ }+ rt, err := h.Queries.GetAgentRuntime(r.Context(), runtimeID)+ if err != nil || rt.WorkspaceID != agent.WorkspaceID {+ writeError(w, http.StatusNotFound, "runtime not found")+ return+ }+ if rt.RuntimeMode != "local" || (rt.Provider != "codex" && rt.Provider != "claude") {+ writeError(w, http.StatusBadRequest, "runtime skill controls are only supported for codex and claude")+ return+ }+ root, key, plugin, valid := normalizeRuntimeSkillIdentity(req.Root, req.Key, req.Plugin)+ if !valid || (root == "plugin" && rt.Provider != "claude") {+ writeError(w, http.StatusBadRequest, "invalid runtime skill identity")+ return+ }+ name := strings.TrimSpace(req.Name)+ if len(name) > maxRuntimeSkillKeyLength {+ writeError(w, http.StatusBadRequest, "invalid runtime skill name")+ return+ }++ tx, err := h.TxStarter.Begin(r.Context())+ if err != nil {+ writeError(w, http.StatusInternalServerError, "failed to begin transaction")+ return+ }+ defer tx.Rollback(r.Context())+ qtx := h.Queries.WithTx(tx)+ locked, err := qtx.GetAgentForUpdate(r.Context(), agent.ID)+ if err != nil {+ writeError(w, http.StatusInternalServerError, "failed to load agent")+ return+ }+ if !locked.RuntimeID.Valid || locked.RuntimeID != runtimeID {+ writeError(w, http.StatusConflict, "agent is no longer assigned to this runtime")+ return+ }++ target := DisabledRuntimeSkill{+ RuntimeID: req.RuntimeID,+ Provider: rt.Provider,+ Root: root,+ Key: key,+ Name: name,+ Plugin: plugin,+ }+ current := decodeDisabledRuntimeSkills(locked.DisabledRuntimeSkills)+ next := make([]DisabledRuntimeSkill, 0, len(current)+1)+ for _, skill := range current {+ if sameDisabledRuntimeSkill(skill, target) {+ continue+ }+ next = append(next, skill)+ }+ if !*req.Enabled {+ next = append(next, target)+ }+ payload, err := json.Marshal(next)+ if err != nil {+ writeError(w, http.StatusInternalServerError, "failed to encode runtime skill settings")+ return+ }+ if _, err := qtx.UpdateAgentDisabledRuntimeSkills(r.Context(), db.UpdateAgentDisabledRuntimeSkillsParams{+ ID: locked.ID,+ DisabledRuntimeSkills: payload,+ }); err != nil {+ writeError(w, http.StatusInternalServerError, "failed to update runtime skill")+ return+ }+ if err := tx.Commit(r.Context()); err != nil {+ writeError(w, http.StatusInternalServerError, "failed to commit")+ return+ }++ // Broadcast the updated agent so every other open web/desktop/mobile client+ // invalidates its cached agent and picks up the new disabled_runtime_skills+ // state. The workspace-skill toggle does the same through+ // writeUpdatedAgentSkills (skill.go); the realtime layer keys off the+ // "agent:status" event to invalidate workspaceKeys.agents. Without this only+ // the initiating tab refreshes and other clients keep showing stale toggles.+ locked.DisabledRuntimeSkills = payload+ resp := agentToResponse(locked)+ if err := h.enrichAgentResponseWithTargets(r.Context(), &resp, locked.ID); err != nil {+ slog.Warn("runtime skill toggle: load invocation targets for broadcast failed",+ append(logger.RequestAttrs(r), "error", err, "agent_id", agentID)...)+ }+ // agentToResponse initialises Skills as []; reload the junction-table+ // bindings so the broadcast mirrors reality instead of signalling other+ // clients that this agent's skills were cleared (#3459).+ if err := h.attachAgentSkills(r.Context(), &resp, locked.ID); err != nil {+ slog.Warn("runtime skill toggle: load agent skills for broadcast failed",+ append(logger.RequestAttrs(r), "error", err, "agent_id", agentID)...)+ }+ actorType, actorID := h.resolveActor(r, requestUserID(r), uuidToString(locked.WorkspaceID))+ h.publish(protocol.EventAgentStatus, uuidToString(locked.WorkspaceID), actorType, actorID,+ map[string]any{"agent": broadcastAgentResponse(resp)})++ w.WriteHeader(http.StatusNoContent)+}diff --git a/server/internal/handler/agent_runtime_skills_broadcast_test.go b/server/internal/handler/agent_runtime_skills_broadcast_test.gonew file mode 100644index 0000000000..221de0a7e6--- /dev/null+++ b/server/internal/handler/agent_runtime_skills_broadcast_test.go@@ -0,0 +1,96 @@+package handler++import (+ "context"+ "net/http/httptest"+ "sync"+ "testing"++ "github.com/multica-ai/multica/server/internal/events"+ "github.com/multica-ai/multica/server/pkg/protocol"+)++// TestSetAgentRuntimeSkillEnabledBroadcastsAgentStatus guards the realtime+// invalidation path for runtime-skill toggles (Howard review on MUL-5101):+// persisting a disabled_runtime_skills override must publish an "agent:status"+// event so every other open web/desktop/mobile client invalidates+// workspaceKeys.agents and drops its stale toggle state — mirroring the+// workspace-skill toggle in writeUpdatedAgentSkills. Before the fix the handler+// committed and returned 204 without broadcasting, so only the initiating tab+// refreshed while other clients kept showing the old state.+func TestSetAgentRuntimeSkillEnabledBroadcastsAgentStatus(t *testing.T) {+ runtimeID := createRuntimeLocalSkillTestRuntime(t, testUserID)+ var agentID string+ if err := testPool.QueryRow(context.Background(), `+ INSERT INTO agent (+ workspace_id, name, description, runtime_mode, runtime_config,+ runtime_id, visibility, permission_mode, max_concurrent_tasks, owner_id+ )+ VALUES ($1, $2, '', 'local', '{}'::jsonb, $3, 'private', 'private', 1, $4)+ RETURNING id+ `, testWorkspaceID, "Runtime Skill Broadcast "+t.Name(), runtimeID, testUserID).Scan(&agentID); err != nil {+ t.Fatalf("create agent: %v", err)+ }+ t.Cleanup(func() {+ testPool.Exec(context.Background(), `DELETE FROM agent WHERE id = $1`, agentID)+ })++ // The bus is synchronous, so counts observed right after each request are+ // deterministic; the mutex only guards against a future async listener.+ var mu sync.Mutex+ var broadcasts []string+ testHandler.Bus.Subscribe(protocol.EventAgentStatus, func(e events.Event) {+ payload, ok := e.Payload.(map[string]any)+ if !ok {+ return+ }+ agent, ok := payload["agent"].(AgentResponse)+ if !ok {+ return+ }+ mu.Lock()+ broadcasts = append(broadcasts, agent.ID)+ mu.Unlock()+ })++ countFor := func(id string) int {+ mu.Lock()+ defer mu.Unlock()+ n := 0+ for _, a := range broadcasts {+ if a == id {+ n+++ }+ }+ return n+ }++ setEnabled := func(enabled bool) *httptest.ResponseRecorder {+ t.Helper()+ w := httptest.NewRecorder()+ req := newRequest("PUT", "/api/agents/"+agentID+"/runtime-skills/enabled", map[string]any{+ "runtime_id": runtimeID,+ "root": "provider",+ "key": "review",+ "name": "Review Helper",+ "enabled": enabled,+ })+ req = withURLParam(req, "id", agentID)+ testHandler.SetAgentRuntimeSkillEnabled(w, req)+ return w+ }++ if w := setEnabled(false); w.Code != 204 {+ t.Fatalf("disable inherited skill: expected 204, got %d: %s", w.Code, w.Body.String())+ }+ if n := countFor(agentID); n != 1 {+ t.Fatalf("disabling a runtime skill must broadcast exactly one agent:status for %s, got %d", agentID, n)+ }++ if w := setEnabled(true); w.Code != 204 {+ t.Fatalf("enable inherited skill: expected 204, got %d: %s", w.Code, w.Body.String())+ }+ if n := countFor(agentID); n != 2 {+ t.Fatalf("re-enabling a runtime skill must broadcast a second agent:status for %s, got %d", agentID, n)+ }+}diff --git a/server/internal/handler/daemon.go b/server/internal/handler/daemon.goindex f0bcaf4eed..6b1b6985a9 100644--- a/server/internal/handler/daemon.go+++ b/server/internal/handler/daemon.go@@ -1639,15 +1639,16 @@ func (h *Handler) buildClaimedTaskResponse(r *http.Request, task *db.AgentTaskQuruntimeConfig = json.RawMessage(agent.RuntimeConfig)}resp.Agent = &TaskAgentData{- ID: uuidToString(agent.ID),- Name: agent.Name,- Instructions: agent.Instructions,- CustomEnv: customEnv,- CustomArgs: customArgs,- McpConfig: mcpConfig,- Model: agent.Model.String,- ThinkingLevel: agent.ThinkingLevel.String,- RuntimeConfig: runtimeConfig,+ ID: uuidToString(agent.ID),+ Name: agent.Name,+ Instructions: agent.Instructions,+ CustomEnv: customEnv,+ CustomArgs: customArgs,+ McpConfig: mcpConfig,+ Model: agent.Model.String,+ ThinkingLevel: agent.ThinkingLevel.String,+ RuntimeConfig: runtimeConfig,+ DisabledRuntimeSkills: disabledRuntimeSkillsFor(agent.DisabledRuntimeSkills, runtimeID, runtime.Provider),}if useSkillRefs {_, skillRefs := h.TaskService.LoadAgentSkillBundles(r.Context(), task.AgentID)diff --git a/server/internal/handler/runtime_local_skills.go b/server/internal/handler/runtime_local_skills.goindex 4ab4faf125..7d7eb0a8f9 100644--- a/server/internal/handler/runtime_local_skills.go+++ b/server/internal/handler/runtime_local_skills.go@@ -183,9 +183,10 @@ type RuntimeLocalSkillSummary struct {// for a skill contributed by an enabled runtime plugin. Daemons// that predate multi-root discovery omit it; an empty value means// "unknown" and the UI should not assert either origin.- Root string `json:"root,omitempty"`- Plugin string `json:"plugin,omitempty"`- FileCount int `json:"file_count"`+ Root string `json:"root,omitempty"`+ Plugin string `json:"plugin,omitempty"`+ CanDisable bool `json:"can_disable,omitempty"`+ FileCount int `json:"file_count"`}// RuntimeLocalMcpServerSummary is deliberately non-secret. The daemon onlydiff --git a/server/internal/handler/runtime_local_skills_test.go b/server/internal/handler/runtime_local_skills_test.goindex b5b92df68c..71fd795f4f 100644--- a/server/internal/handler/runtime_local_skills_test.go+++ b/server/internal/handler/runtime_local_skills_test.go@@ -126,6 +126,7 @@ func TestInMemoryLocalSkillListStore_PreservesSummaries(t *testing.T) {"provider": "claude","root": "plugin","plugin": "paper-desktop@paper",+ "can_disable": true,"file_count": 2,},},@@ -161,6 +162,9 @@ func TestInMemoryLocalSkillListStore_PreservesSummaries(t *testing.T) {if got.Skills[0].FileCount != 2 {t.Fatalf("file_count = %d", got.Skills[0].FileCount)}+ if !got.Skills[0].CanDisable {+ t.Fatal("can_disable capability was not preserved")+ }}func TestInMemoryLocalSkillListStore_TimesOutRunningRequests(t *testing.T) {diff --git a/server/internal/handler/skill_list_test.go b/server/internal/handler/skill_list_test.goindex 8dc30515f3..5d3f5483b7 100644--- a/server/internal/handler/skill_list_test.go+++ b/server/internal/handler/skill_list_test.go@@ -161,6 +161,71 @@ func TestSetAgentSkillEnabledControlsExecutionWithoutRemovingAssignment(t *testi}}+func TestSetAgentRuntimeSkillEnabledPersistsScopedOverride(t *testing.T) {+ runtimeID := createRuntimeLocalSkillTestRuntime(t, testUserID)+ var agentID string+ if err := testPool.QueryRow(context.Background(), `+ INSERT INTO agent (+ workspace_id, name, description, runtime_mode, runtime_config,+ runtime_id, visibility, permission_mode, max_concurrent_tasks, owner_id+ )+ VALUES ($1, $2, '', 'local', '{}'::jsonb, $3, 'private', 'private', 1, $4)+ RETURNING id+ `, testWorkspaceID, "Runtime Skill Toggle "+t.Name(), runtimeID, testUserID).Scan(&agentID); err != nil {+ t.Fatalf("create agent: %v", err)+ }+ t.Cleanup(func() {+ testPool.Exec(context.Background(), `DELETE FROM agent WHERE id = $1`, agentID)+ })++ setEnabled := func(enabled bool) *httptest.ResponseRecorder {+ t.Helper()+ w := httptest.NewRecorder()+ req := newRequest("PUT", "/api/agents/"+agentID+"/runtime-skills/enabled", map[string]any{+ "runtime_id": runtimeID,+ "root": "provider",+ "key": "review",+ "name": "Review Helper",+ "enabled": enabled,+ })+ req = withURLParam(req, "id", agentID)+ testHandler.SetAgentRuntimeSkillEnabled(w, req)+ return w+ }++ if w := setEnabled(false); w.Code != 204 {+ t.Fatalf("disable inherited skill: expected 204, got %d: %s", w.Code, w.Body.String())+ }+ row, err := testHandler.Queries.GetAgent(context.Background(), parseUUID(agentID))+ if err != nil {+ t.Fatalf("load agent: %v", err)+ }+ disabled := decodeDisabledRuntimeSkills(row.DisabledRuntimeSkills)+ if len(disabled) != 1 || disabled[0].RuntimeID != runtimeID ||+ disabled[0].Provider != "claude" || disabled[0].Root != "provider" || disabled[0].Key != "review" ||+ disabled[0].Name != "Review Helper" {+ t.Fatalf("unexpected disabled runtime skills: %+v", disabled)+ }+ if w := setEnabled(false); w.Code != 204 {+ t.Fatalf("repeat disable inherited skill: expected 204, got %d: %s", w.Code, w.Body.String())+ }+ row, err = testHandler.Queries.GetAgent(context.Background(), parseUUID(agentID))+ if err != nil || len(decodeDisabledRuntimeSkills(row.DisabledRuntimeSkills)) != 1 {+ t.Fatalf("repeat disable was not idempotent: row=%+v err=%v", row, err)+ }++ if w := setEnabled(true); w.Code != 204 {+ t.Fatalf("enable inherited skill: expected 204, got %d: %s", w.Code, w.Body.String())+ }+ row, err = testHandler.Queries.GetAgent(context.Background(), parseUUID(agentID))+ if err != nil {+ t.Fatalf("reload agent: %v", err)+ }+ if disabled = decodeDisabledRuntimeSkills(row.DisabledRuntimeSkills); len(disabled) != 0 {+ t.Fatalf("re-enabled skill still disabled: %+v", disabled)+ }+}+// TestGetSkill_MalformedUUIDReturns400 guards the handler UUID parsing// convention (CLAUDE.md → "Backend Handler UUID Parsing Convention"): raw// `id` URL params on the request boundary must be validated withdiff --git a/server/migrations/206_agent_disabled_runtime_skills.down.sql b/server/migrations/206_agent_disabled_runtime_skills.down.sqlnew file mode 100644index 0000000000..06c5323177--- /dev/null+++ b/server/migrations/206_agent_disabled_runtime_skills.down.sql@@ -0,0 +1,2 @@+ALTER TABLE agent+DROP COLUMN disabled_runtime_skills;diff --git a/server/migrations/206_agent_disabled_runtime_skills.up.sql b/server/migrations/206_agent_disabled_runtime_skills.up.sqlnew file mode 100644index 0000000000..34785d881b--- /dev/null+++ b/server/migrations/206_agent_disabled_runtime_skills.up.sql@@ -0,0 +1,2 @@+ALTER TABLE agent+ADD COLUMN disabled_runtime_skills JSONB NOT NULL DEFAULT '[]'::jsonb;diff --git a/server/pkg/agent/agent.go b/server/pkg/agent/agent.goindex dbe5582610..2932d4649c 100644--- a/server/pkg/agent/agent.go+++ b/server/pkg/agent/agent.go@@ -76,6 +76,10 @@ type ExecOptions struct {// ignore this field, mirroring ThinkingLevel's renderer-side fall-through// pattern. See issue #3260.OpenclawMode string+ // ClaudeSettingsPath is a daemon-owned, task-local settings file passed+ // through Claude Code's --settings flag. It currently carries restrictive+ // runtime-skill overrides only; other providers ignore it.+ ClaudeSettingsPath string}// runContext derives the execution context for an agent subprocess from thediff --git a/server/pkg/agent/claude.go b/server/pkg/agent/claude.goindex 6ba45263a5..80a341a681 100644--- a/server/pkg/agent/claude.go+++ b/server/pkg/agent/claude.go@@ -646,8 +646,22 @@ func buildClaudeArgs(opts ExecOptions, logger *slog.Logger) []string {if opts.ResumeSessionID != "" {args = append(args, "--resume", opts.ResumeSessionID)}- args = append(args, filterCustomArgs(opts.ExtraArgs, claudeBlockedArgs, logger)...)- args = append(args, filterCustomArgs(opts.CustomArgs, claudeBlockedArgs, logger)...)+ blockedArgs := claudeBlockedArgs+ if opts.ClaudeSettingsPath != "" {+ // The daemon-owned --settings file is the enforcement layer for disabled+ // inherited skills. Drop competing per-agent/default flags only while that+ // policy is active, then append the managed file last.+ blockedArgs = make(map[string]blockedArgMode, len(claudeBlockedArgs)+1)+ for key, mode := range claudeBlockedArgs {+ blockedArgs[key] = mode+ }+ blockedArgs["--settings"] = blockedWithValue+ }+ args = append(args, filterCustomArgs(opts.ExtraArgs, blockedArgs, logger)...)+ args = append(args, filterCustomArgs(opts.CustomArgs, blockedArgs, logger)...)+ if opts.ClaudeSettingsPath != "" {+ args = append(args, "--settings", opts.ClaudeSettingsPath)+ }return args}diff --git a/server/pkg/agent/claude_test.go b/server/pkg/agent/claude_test.goindex 0ed99d33a3..5732741693 100644--- a/server/pkg/agent/claude_test.go+++ b/server/pkg/agent/claude_test.go@@ -1283,3 +1283,21 @@ func TestBuildClaudeArgsExtraArgsBeforeCustomArgsAndFiltersBoth(t *testing.T) {t.Fatalf("expected extra args before custom args, got %v", args)}}++func TestBuildClaudeArgsManagedSkillSettingsWins(t *testing.T) {+ args := buildClaudeArgs(ExecOptions{+ ClaudeSettingsPath: "/tmp/multica-claude-settings.json",+ ExtraArgs: []string{"--settings", "/tmp/default.json"},+ CustomArgs: []string{"--settings=/tmp/agent.json", "--max-turns", "7"},+ }, slog.Default())+ joined := strings.Join(args, " ")+ if strings.Contains(joined, "default.json") || strings.Contains(joined, "agent.json") {+ t.Fatalf("competing settings args were not filtered: %v", args)+ }+ if !strings.Contains(joined, "--settings /tmp/multica-claude-settings.json") {+ t.Fatalf("managed settings missing: %v", args)+ }+ if !strings.Contains(joined, "--max-turns 7") {+ t.Fatalf("unrelated custom arg was dropped: %v", args)+ }+}diff --git a/server/pkg/db/generated/agent.sql.go b/server/pkg/db/generated/agent.sql.goindex 00da62d99e..44f85cb22b 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+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`type ArchiveAgentParams struct {@@ -52,6 +52,7 @@ func (q *Queries) ArchiveAgent(ctx context.Context, arg ArchiveAgentParams) (Age&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,)return i, err}@@ -60,7 +61,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+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`type ArchiveAgentsByIDsParams struct {@@ -112,6 +113,7 @@ func (q *Queries) ArchiveAgentsByIDs(ctx context.Context, arg ArchiveAgentsByIDs&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,); err != nil {return nil, err}@@ -127,7 +129,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+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`type ArchiveAgentsByRuntimeParams struct {@@ -175,6 +177,7 @@ func (q *Queries) ArchiveAgentsByRuntime(ctx context.Context, arg ArchiveAgentsB&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,); err != nil {return nil, err}@@ -1033,7 +1036,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+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`// Explicit NULL-clear for composio_toolkit_allowlist. The COALESCE-based@@ -1072,6 +1075,7 @@ func (q *Queries) ClearAgentComposioToolkitAllowlist(ctx context.Context, id pgt&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,)return i, err}@@ -1079,7 +1083,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+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`func (q *Queries) ClearAgentMcpConfig(ctx context.Context, id pgtype.UUID) (Agent, error) {@@ -1112,6 +1116,7 @@ func (q *Queries) ClearAgentMcpConfig(ctx context.Context, id pgtype.UUID) (Agen&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,)return i, err}@@ -1119,7 +1124,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+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`// Explicit NULL-clear for thinking_level. COALESCE-based UpdateAgent cannot@@ -1155,6 +1160,7 @@ func (q *Queries) ClearAgentThinkingLevel(ctx context.Context, id pgtype.UUID) (&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,)return i, err}@@ -1258,7 +1264,7 @@ INSERT INTO agent ($17::text[],COALESCE($18, '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+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`type CreateAgentParams struct {@@ -1331,6 +1337,7 @@ func (q *Queries) CreateAgent(ctx context.Context, arg CreateAgentParams) (Agent&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,)return i, err}@@ -1345,7 +1352,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+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`type CreateAgentBuilderParams struct {@@ -1402,6 +1409,7 @@ func (q *Queries) CreateAgentBuilder(ctx context.Context, arg CreateAgentBuilder&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,)return i, err}@@ -2366,7 +2374,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 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 FROM agentWHERE id = $1`@@ -2400,12 +2408,13 @@ func (q *Queries) GetAgent(ctx context.Context, id pgtype.UUID) (Agent, error) {&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,)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 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 FROM agentWHERE id = $1FOR UPDATE`@@ -2440,12 +2449,56 @@ func (q *Queries) GetAgentForClaimUpdate(ctx context.Context, id pgtype.UUID) (A&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,+ )+ 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+WHERE id = $1+FOR UPDATE+`++// Serializes read-modify-write updates to disabled_runtime_skills so two+// concurrent per-skill toggles cannot overwrite each other.+func (q *Queries) GetAgentForUpdate(ctx context.Context, id pgtype.UUID) (Agent, error) {+ row := q.db.QueryRow(ctx, getAgentForUpdate, 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,)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 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 FROM agentWHERE id = $1 AND workspace_id = $2 AND kind = 'user'`@@ -2484,6 +2537,7 @@ func (q *Queries) GetAgentInWorkspace(ctx context.Context, arg GetAgentInWorkspa&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,)return i, err}@@ -2994,7 +3048,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 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 FROM agentWHERE runtime_id = $1 AND archived_at IS NULL AND kind = 'user'ORDER BY name ASC`@@ -3041,6 +3095,7 @@ func (q *Queries) ListActiveAgentsByRuntime(ctx context.Context, runtimeID pgtyp&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,); err != nil {return nil, err}@@ -3053,7 +3108,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 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 FROM agentWHERE runtime_id = $1 AND archived_at IS NULL AND kind = 'user'ORDER BY name ASCFOR UPDATE@@ -3103,6 +3158,7 @@ func (q *Queries) ListActiveAgentsByRuntimeForUpdate(ctx context.Context, runtim&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,); err != nil {return nil, err}@@ -3268,7 +3324,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 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 FROM agentWHERE workspace_id = $1 AND archived_at IS NULL AND kind = 'user'ORDER BY created_at ASC`@@ -3309,6 +3365,7 @@ func (q *Queries) ListAgents(ctx context.Context, workspaceID pgtype.UUID) ([]Ag&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,); err != nil {return nil, err}@@ -3321,7 +3378,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 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 FROM agentWHERE workspace_id = $1 AND kind = 'user'ORDER BY created_at ASC`@@ -3362,6 +3419,7 @@ func (q *Queries) ListAllAgents(ctx context.Context, workspaceID pgtype.UUID) ([&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,); err != nil {return nil, err}@@ -4578,7 +4636,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+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`func (q *Queries) RefreshAgentStatusFromTasks(ctx context.Context, id pgtype.UUID) (Agent, error) {@@ -4611,6 +4669,7 @@ func (q *Queries) RefreshAgentStatusFromTasks(ctx context.Context, id pgtype.UUI&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,)return i, err}@@ -4698,7 +4757,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+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`func (q *Queries) RestoreAgent(ctx context.Context, id pgtype.UUID) (Agent, error) {@@ -4731,6 +4790,7 @@ func (q *Queries) RestoreAgent(ctx context.Context, id pgtype.UUID) (Agent, erro&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,)return i, err}@@ -4874,7 +4934,7 @@ UPDATE agent SETcomposio_toolkit_allowlist = COALESCE($18::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+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`type UpdateAgentParams struct {@@ -4953,6 +5013,7 @@ func (q *Queries) UpdateAgent(ctx context.Context, arg UpdateAgentParams) (Agent&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,)return i, err}@@ -4961,7 +5022,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+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`type UpdateAgentCustomEnvParams struct {@@ -5004,6 +5065,54 @@ func (q *Queries) UpdateAgentCustomEnv(ctx context.Context, arg UpdateAgentCusto&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,+ )+ return i, err+}++const updateAgentDisabledRuntimeSkills = `-- name: UpdateAgentDisabledRuntimeSkills :one+UPDATE agent+SET 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+`++type UpdateAgentDisabledRuntimeSkillsParams struct {+ ID pgtype.UUID `json:"id"`+ DisabledRuntimeSkills []byte `json:"disabled_runtime_skills"`+}++func (q *Queries) UpdateAgentDisabledRuntimeSkills(ctx context.Context, arg UpdateAgentDisabledRuntimeSkillsParams) (Agent, error) {+ row := q.db.QueryRow(ctx, updateAgentDisabledRuntimeSkills, arg.ID, arg.DisabledRuntimeSkills)+ 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,)return i, err}@@ -5011,7 +5120,7 @@ func (q *Queries) UpdateAgentCustomEnv(ctx context.Context, arg UpdateAgentCustoconst 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+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`type UpdateAgentStatusParams struct {@@ -5049,6 +5158,7 @@ func (q *Queries) UpdateAgentStatus(ctx context.Context, arg UpdateAgentStatusPa&i.PermissionMode,&i.Kind,&i.SystemKey,+ &i.DisabledRuntimeSkills,)return i, err}diff --git a/server/pkg/db/generated/models.go b/server/pkg/db/generated/models.goindex b7f277e540..d2d393c0b8 100644--- a/server/pkg/db/generated/models.go+++ b/server/pkg/db/generated/models.go@@ -47,9 +47,10 @@ type Agent struct {// Composio toolkit slugs this agent is allowed to mount as MCP. NULL or empty array = no MCP overlay. Mounted for any run that passes the agent invocation-permission gate (MUL-3963); the overlay uses the agent OWNER's active Composio connection, so sharing the agent (public_to) shares these apps with whoever may invoke it. No longer gated on originator == owner. Stored as TEXT[] so the dispatch path can intersect against the owner's active connections with a single SQL ANY() filter.ComposioToolkitAllowlist []string `json:"composio_toolkit_allowlist"`// Agent invocation permission mode (MUL-3963). private = owner only; public_to = allow-list in agent_invocation_target. Replaces visibility as the authorization source for triggering runs; visibility is now a derived legacy field. Default private = deny-by-default.- PermissionMode string `json:"permission_mode"`- Kind string `json:"kind"`- SystemKey pgtype.Text `json:"system_key"`+ PermissionMode string `json:"permission_mode"`+ Kind string `json:"kind"`+ SystemKey pgtype.Text `json:"system_key"`+ DisabledRuntimeSkills []byte `json:"disabled_runtime_skills"`}// 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 2a45a938a4..1da59ddf2b 100644--- a/server/pkg/db/queries/agent.sql+++ b/server/pkg/db/queries/agent.sql@@ -12,6 +12,13 @@ ORDER BY created_at ASC;SELECT * FROM agentWHERE id = $1;+-- name: GetAgentForUpdate :one+-- Serializes read-modify-write updates to disabled_runtime_skills so two+-- concurrent per-skill toggles cannot overwrite each other.+SELECT * FROM agent+WHERE id = $1+FOR UPDATE;+-- name: GetAgentInWorkspace :oneSELECT * FROM agentWHERE id = $1 AND workspace_id = $2 AND kind = 'user';@@ -118,6 +125,12 @@ SET custom_env = $2, updated_at = now()WHERE id = $1RETURNING *;+-- name: UpdateAgentDisabledRuntimeSkills :one+UPDATE agent+SET disabled_runtime_skills = $2, updated_at = now()+WHERE id = $1+RETURNING *;+-- name: ArchiveAgent :oneUPDATE agent SET archived_at = now(), archived_by = $2, updated_at = now()WHERE id = $1