Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

forward the whole override patch so a provider-pin clear reaches the API

[._.]/ Adam Eivy3b71726a2de0
diff --git a/client/src/components/apps/tabs/AutomationTab.jsx b/client/src/components/apps/tabs/AutomationTab.jsx
index b3a0bb173d..ab5a69c9b5 100644
--- a/client/src/components/apps/tabs/AutomationTab.jsx
+++ b/client/src/components/apps/tabs/AutomationTab.jsx
@@ -9,7 +9,7 @@ import ProviderModelSelector from '../../ProviderModelSelector';
import * as api from '../../../services/api';
import { AGENT_OPTIONS, toggleAppMetadataOverride, agentOptionButtonClass } from '../../cos/constants';
import { isCronExpression, describeCron } from '../../../utils/cronHelpers';
-import { PROVIDER_TYPES, filterSelectableModels } from '../../../utils/providers';
+import { PROVIDER_TYPES, filterSelectableModels, providerDisplayName, providerModelLabel } from '../../../utils/providers';
import CustomTasksSection from './CustomTasksSection';
const RUNNABLE_PROVIDER_TYPES = Object.values(PROVIDER_TYPES);
@@ -259,10 +259,6 @@ export default function AutomationTab({ appId, appName }) {
const modelOptions = overrideModel && !availableModels.includes(overrideModel)
? [overrideModel, ...availableModels]
: availableModels;
- const effectiveProviderId = override.providerId || globalConfig.providerId || null;
- const effectiveProviderName = effectiveProviderId
- ? (providers.find(p => p.id === effectiveProviderId)?.name || effectiveProviderId)
- : 'default (active provider)';
const isLayeredIntelligence = taskType === 'layered-intelligence';
// A per-app provider/model pin only reaches the spawn for task types
// whose buildTaskInput hook resolves it (server stamps the flag). For
@@ -271,6 +267,13 @@ export default function AutomationTab({ appId, appName }) {
// clear-it affordance when a stale one is already stored.
const providerOverrideCapable = globalConfig.providerOverrideCapable === true;
const hasProviderOverride = !!(override.providerId || override.model);
+ // The app pin only counts toward "effective" where it is honored —
+ // naming an ignored pin as the effective provider is exactly the lie
+ // this row exists to correct.
+ const effectiveProviderId = (providerOverrideCapable && override.providerId) || globalConfig.providerId || null;
+ const effectiveProviderName = effectiveProviderId
+ ? providerDisplayName(providers, effectiveProviderId)
+ : 'default (active provider)';
return (
<div key={taskType} className="bg-port-card border border-port-border rounded-lg p-3 space-y-2">
@@ -281,7 +284,7 @@ export default function AutomationTab({ appId, appName }) {
<span className="text-white font-mono text-xs">{taskType}</span>
<div className="text-xs text-gray-500">{effectiveLabel}{intervalSuffix}</div>
</div>
- {(providerOverrideCapable || hasProviderOverride || isLayeredIntelligence) && (
+ {(providerOverrideCapable || hasProviderOverride) && (
<button
onClick={() => setExpandedTaskType(prev => prev === taskType ? null : taskType)}
aria-expanded={isExpanded}
@@ -402,7 +405,7 @@ export default function AutomationTab({ appId, appName }) {
{hasProviderOverride && (
<>
{' '}This app stores an unused override
- (<span className="text-gray-300">{[override.providerId, override.model].filter(Boolean).join(' · ')}</span>).{' '}
+ (<span className="text-gray-300">{providerModelLabel(providers, override.providerId, override.model)}</span>).{' '}
<button onClick={() => handleProviderChange(taskType, '')} className="text-port-accent hover:underline">Clear it</button>
</>
)}
diff --git a/client/src/components/cos/tabs/schedule/AppOverrideRow.jsx b/client/src/components/cos/tabs/schedule/AppOverrideRow.jsx
index 2c073670f9..8f60447c95 100644
--- a/client/src/components/cos/tabs/schedule/AppOverrideRow.jsx
+++ b/client/src/components/cos/tabs/schedule/AppOverrideRow.jsx
@@ -5,17 +5,10 @@ import { AGENT_OPTIONS, BRANCHES_PER_AGENT_DEFAULT, BRANCHES_PER_AGENT_OPTIONS,
import { isCronExpression, describeCron } from '../../../../utils/cronHelpers';
import ToggleSwitch from '../../../ToggleSwitch';
import useFieldDraft from '../../../../hooks/useFieldDraft';
-import { INTERVAL_LABELS, setMetadataOverride } from './scheduleConstants';
+import { providerModelLabel } from '../../../../utils/providers';
+import { badge, INTERVAL_LABELS, setMetadataOverride } from './scheduleConstants';
-// Resolve a provider id to its display name, falling back to the raw id when the
-// provider list isn't loaded here (the Timeline tab renders these rows without
-// one) or the id names a provider that has since been removed.
-function providerLabel(providerId, providers) {
- if (!providerId) return null;
- return providers?.find(p => p.id === providerId)?.name || providerId;
-}
-
-const AppOverrideRow = memo(function AppOverrideRow({ app, taskType, globalIntervalType, globalTaskMetadata, managedAgentOptions, fileIssuesCapable, defaultFileIssues, providerOverrideCapable, globalProviderId, globalModel, providers, override, onUpdate }) {
+const AppOverrideRow = memo(function AppOverrideRow({ app, taskType, globalIntervalType, globalTaskMetadata, managedAgentOptions, fileIssuesCapable, defaultFileIssues, providerOverrideCapable, inheritedProviderText, providers, override, onUpdate }) {
const [updating, setUpdating] = useState(false);
const [cronEditing, setCronEditing] = useState(false);
const isEnabled = override?.enabled === true;
@@ -31,10 +24,9 @@ const AppOverrideRow = memo(function AppOverrideRow({ app, taskType, globalInter
// it here — where the task provider is chosen — rather than only inside Edit
// App → Automation, and let it be cleared back to inherit in one click.
const hasProviderOverride = !!(override?.providerId || override?.model);
- const overrideProviderName = providerLabel(override?.providerId, providers);
- const inheritedProviderName = providerLabel(globalProviderId, providers) || 'active provider';
- const overrideProviderText = [overrideProviderName, override?.model].filter(Boolean).join(' · ');
- const inheritedProviderText = [inheritedProviderName, globalModel].filter(Boolean).join(' · ');
+ // `providers` is absent on the Timeline tab, which renders these rows without
+ // fetching the list — providerDisplayName falls back to the raw id there.
+ const overrideProviderText = providerModelLabel(providers || [], override?.providerId, override?.model);
const handleClearProviderOverride = async () => {
setUpdating(true);
@@ -210,31 +202,27 @@ const AppOverrideRow = memo(function AppOverrideRow({ app, taskType, globalInter
})}
</div>
- {(providerOverrideCapable || hasProviderOverride) && (
- hasProviderOverride ? (
- <span
- className={`flex items-center gap-1 text-xs px-2 py-1.5 rounded border ${providerOverrideCapable
- ? 'border-port-warning/50 bg-port-warning/10 text-port-warning'
- : 'border-port-border bg-port-bg text-gray-500'}`}
- title={providerOverrideCapable
- ? `${app.name} runs ${taskType} on ${overrideProviderText} — this app override wins over the task provider (${inheritedProviderText})`
- : `${taskType} takes its provider from the task pin (${inheritedProviderText}); this stored app override is ignored`}
+ {hasProviderOverride ? (
+ <span
+ className={`${badge(providerOverrideCapable ? 'warning' : 'gray')} flex items-center gap-1`}
+ title={providerOverrideCapable
+ ? `${overrideProviderText} (app override) — wins over the task provider (${inheritedProviderText})`
+ : `${overrideProviderText} (app override) is ignored: ${taskType} always uses the task provider (${inheritedProviderText})`}
+ >
+ <span className="truncate max-w-[200px]">{overrideProviderText}</span>
+ <button
+ onClick={handleClearProviderOverride}
+ disabled={updating}
+ aria-label={`Clear provider override for ${app.name}`}
+ className="underline decoration-dotted hover:no-underline disabled:opacity-50"
>
- <span className="truncate max-w-[200px]">{overrideProviderText}</span>
- <button
- onClick={handleClearProviderOverride}
- disabled={updating}
- aria-label={`Clear provider override for ${app.name}`}
- className="underline decoration-dotted hover:no-underline disabled:opacity-50"
- >
- clear
- </button>
- </span>
- ) : (
- <span className="text-xs px-2 py-1.5 text-gray-500 truncate max-w-[200px]" title={`No app provider override — inherits the task provider (${inheritedProviderText})`}>
- inherits {inheritedProviderText}
- </span>
- )
+ clear
+ </button>
+ </span>
+ ) : providerOverrideCapable && (
+ <span className="text-xs px-2 py-1.5 text-gray-500 truncate max-w-[200px]" title={`Inherit (${inheritedProviderText})`}>
+ Inherit ({inheritedProviderText})
+ </span>
)}
{opensPR && (
diff --git a/client/src/components/cos/tabs/schedule/AppOverrideRow.test.jsx b/client/src/components/cos/tabs/schedule/AppOverrideRow.test.jsx
index 09de44a46f..d4648157d9 100644
--- a/client/src/components/cos/tabs/schedule/AppOverrideRow.test.jsx
+++ b/client/src/components/cos/tabs/schedule/AppOverrideRow.test.jsx
@@ -13,8 +13,7 @@ function renderRow({
fileIssuesCapable,
defaultFileIssues,
providerOverrideCapable,
- globalProviderId,
- globalModel,
+ inheritedProviderText,
providers,
} = {}) {
render(
@@ -27,8 +26,7 @@ function renderRow({
fileIssuesCapable={fileIssuesCapable}
defaultFileIssues={defaultFileIssues}
providerOverrideCapable={providerOverrideCapable}
- globalProviderId={globalProviderId}
- globalModel={globalModel}
+ inheritedProviderText={inheritedProviderText}
providers={providers}
override={override}
onUpdate={onUpdate}
@@ -216,25 +214,25 @@ describe('AppOverrideRow — per-app provider override', () => {
{ id: 'opencode-llama-tui', name: 'OpenCode (llama)' },
{ id: 'claude-ollama-tui', name: 'Claude (ollama)' },
];
+ const INHERITED = 'OpenCode (llama) / qwen-a';
it('names the app override and the task pin it supersedes', () => {
renderRow({
taskType: 'layered-intelligence',
providerOverrideCapable: true,
- globalProviderId: 'opencode-llama-tui',
- globalModel: 'qwen-a',
+ inheritedProviderText: INHERITED,
providers: PROVIDERS,
override: { enabled: true, providerId: 'claude-ollama-tui', model: 'qwen-b' },
});
- expect(screen.getByText('Claude (ollama) · qwen-b')).toBeInTheDocument();
- expect(screen.getByTitle(/wins over the task provider \(OpenCode \(llama\) · qwen-a\)/)).toBeInTheDocument();
+ expect(screen.getByText('Claude (ollama) / qwen-b')).toBeInTheDocument();
+ expect(screen.getByTitle(`Claude (ollama) / qwen-b (app override) — wins over the task provider (${INHERITED})`)).toBeInTheDocument();
});
it('clearing sends explicit nulls so the app falls back to the task pin', async () => {
const onUpdate = renderRow({
taskType: 'layered-intelligence',
providerOverrideCapable: true,
- globalProviderId: 'opencode-llama-tui',
+ inheritedProviderText: INHERITED,
providers: PROVIDERS,
override: { enabled: true, providerId: 'claude-ollama-tui' },
});
@@ -248,17 +246,17 @@ describe('AppOverrideRow — per-app provider override', () => {
renderRow({
taskType: 'layered-intelligence',
providerOverrideCapable: true,
- globalProviderId: 'opencode-llama-tui',
+ inheritedProviderText: INHERITED,
providers: PROVIDERS,
override: { enabled: true },
});
- expect(screen.getByText('inherits OpenCode (llama)')).toBeInTheDocument();
+ expect(screen.getByText(`Inherit (${INHERITED})`)).toBeInTheDocument();
expect(screen.queryByRole('button', { name: 'Clear provider override for Acme' })).toBeNull();
});
it('says nothing about providers on a task type that ignores the override', () => {
- renderRow({ taskType: 'feature-ideas', globalProviderId: 'opencode-llama-tui', providers: PROVIDERS, override: { enabled: true } });
- expect(screen.queryByText(/inherits/)).toBeNull();
+ renderRow({ taskType: 'feature-ideas', inheritedProviderText: INHERITED, providers: PROVIDERS, override: { enabled: true } });
+ expect(screen.queryByText(/Inherit \(OpenCode/)).toBeNull();
});
// A stale pin stored on a non-honoring type (the app Automation tab used to
@@ -266,11 +264,11 @@ describe('AppOverrideRow — per-app provider override', () => {
it('surfaces a stored-but-ignored override so it can be cleared', () => {
renderRow({
taskType: 'feature-ideas',
- globalProviderId: 'opencode-llama-tui',
+ inheritedProviderText: INHERITED,
providers: PROVIDERS,
override: { enabled: true, providerId: 'claude-ollama-tui' },
});
- expect(screen.getByTitle(/this stored app override is ignored/)).toBeInTheDocument();
+ expect(screen.getByTitle(/is ignored: feature-ideas always uses the task provider/)).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Clear provider override for Acme' })).toBeInTheDocument();
});
});
diff --git a/client/src/components/cos/tabs/schedule/PerAppOverrideList.jsx b/client/src/components/cos/tabs/schedule/PerAppOverrideList.jsx
index 466f582dd5..5133224cd2 100644
--- a/client/src/components/cos/tabs/schedule/PerAppOverrideList.jsx
+++ b/client/src/components/cos/tabs/schedule/PerAppOverrideList.jsx
@@ -1,10 +1,16 @@
import { useState } from 'react';
+import { providerModelLabel } from '../../../../utils/providers';
import AppOverrideRow from './AppOverrideRow';
export default function PerAppOverrideList({ taskType, config, apps, providers, onUpdateOverride, onBulkToggleOverride }) {
const [bulkUpdating, setBulkUpdating] = useState(false);
const activeApps = apps?.filter(app => !app.archived) || [];
const appOverrides = config.appOverrides || {};
+ // List-invariant, so it's resolved once here rather than per row: what an app
+ // that pins nothing of its own actually runs on.
+ const inheritedProviderText = config.providerId
+ ? providerModelLabel(providers || [], config.providerId, config.model)
+ : 'the active provider';
if (activeApps.length === 0) return null;
@@ -50,8 +56,7 @@ export default function PerAppOverrideList({ taskType, config, apps, providers,
fileIssuesCapable={config.fileIssuesCapable}
defaultFileIssues={config.defaultFileIssues}
providerOverrideCapable={config.providerOverrideCapable}
- globalProviderId={config.providerId}
- globalModel={config.model}
+ inheritedProviderText={inheritedProviderText}
providers={providers}
override={appOverrides[app.id]}
onUpdate={onUpdateOverride}
diff --git a/client/src/hooks/useAppOverrideActions.js b/client/src/hooks/useAppOverrideActions.js
index 3a0808cc95..39097e52bf 100644
--- a/client/src/hooks/useAppOverrideActions.js
+++ b/client/src/hooks/useAppOverrideActions.js
@@ -13,8 +13,12 @@ import * as api from '../services/api';
* to `PerAppOverrideList`'s `onUpdateOverride` / `onBulkToggleOverride` props.
*/
export function useAppOverrideActions(apps, refetch) {
- const handleUpdateOverride = useCallback(async (appId, taskType, { enabled, interval, taskMetadata }) => {
- const result = await api.updateAppTaskTypeOverride(appId, taskType, { enabled, interval, taskMetadata }, { silent: true }).catch(err => {
+ // The patch is forwarded whole rather than re-listed field by field: the hook
+ // is a toast + refetch wrapper, not a field filter, and re-listing silently
+ // dropped every field it hadn't been taught about (intervalMs, providerId,
+ // model) — the route then 400s on the resulting empty body.
+ const handleUpdateOverride = useCallback(async (appId, taskType, patch) => {
+ const result = await api.updateAppTaskTypeOverride(appId, taskType, patch, { silent: true }).catch(err => {
toast.error(err.message);
return null;
});
diff --git a/client/src/hooks/useAppOverrideActions.test.jsx b/client/src/hooks/useAppOverrideActions.test.jsx
index fa3c9322f1..71bdeb0728 100644
--- a/client/src/hooks/useAppOverrideActions.test.jsx
+++ b/client/src/hooks/useAppOverrideActions.test.jsx
@@ -36,11 +36,25 @@ describe('useAppOverrideActions', () => {
await result.current.handleUpdateOverride('app-1', 'do-replan', { enabled: true, interval: 'daily' });
});
- expect(updateAppTaskTypeOverride).toHaveBeenCalledWith('app-1', 'do-replan', { enabled: true, interval: 'daily', taskMetadata: undefined }, { silent: true });
+ expect(updateAppTaskTypeOverride).toHaveBeenCalledWith('app-1', 'do-replan', { enabled: true, interval: 'daily' }, { silent: true });
expect(toastSuccess).toHaveBeenCalledWith('Updated do-replan override for Acme');
expect(refetch).toHaveBeenCalledOnce();
});
+ // The patch used to be re-listed field by field here, which silently dropped
+ // every field the hook hadn't been taught about — the route then 400s on the
+ // resulting empty body, so clearing a per-app provider pin could never work.
+ it('forwards fields it was never taught about, like a provider pin clear', async () => {
+ updateAppTaskTypeOverride.mockResolvedValue({ success: true });
+ const { result } = setup();
+
+ await act(async () => {
+ await result.current.handleUpdateOverride('app-1', 'layered-intelligence', { providerId: null, model: null });
+ });
+
+ expect(updateAppTaskTypeOverride).toHaveBeenCalledWith('app-1', 'layered-intelligence', { providerId: null, model: null }, { silent: true });
+ });
+
it('falls back to the app id when the app is unknown', async () => {
updateAppTaskTypeOverride.mockResolvedValue({ success: true });
const { result } = setup();
diff --git a/server/services/taskTypeHooks.js b/server/services/taskTypeHooks.js
index 8635ca4691..255bc8c95c 100644
--- a/server/services/taskTypeHooks.js
+++ b/server/services/taskTypeHooks.js
@@ -50,16 +50,27 @@ import { isFalsyMeta, isTruthyMeta } from './agentState.js';
import { TRACKER_FILING_TASK_TYPES, CONCRETE_WORK_TRACKERS } from '../lib/workTracker.js';
import { isAuditTaskType } from '../lib/auditCatalog.js';
-// taskType → () => import('./path/to/hookModule.js'). A module may export either
-// or both hooks; a missing export means "no hook of that kind for this type".
+// taskType → { load, honorsPerAppProviderOverride? }. `load` is the module import
+// thunk; a module may export either or both hooks, and a missing export means "no
+// hook of that kind for this type". Capabilities that callers must know WITHOUT
+// paying for the import are declared here on the entry, so this stays the single
+// registration point (a parallel per-capability list would be free to drift).
const HOOK_MODULES = {
- 'layered-intelligence': () => import('./autonomousJobs/layeredIntelligenceHooks.js'),
+ 'layered-intelligence': {
+ load: () => import('./autonomousJobs/layeredIntelligenceHooks.js'),
+ // Its buildTaskInput hook resolves the app's per-app provider/model override,
+ // and cosTaskGenerator applies the hook's return LAST (applyProviderModelPins)
+ // — so for this type the per-app pin OUTRANKS the global Schedule pin. A type
+ // without this flag reads only `taskMetadata` off the override and takes its
+ // provider from the pin, making a stored per-app provider inert there.
+ honorsPerAppProviderOverride: true
+ },
};
const PAYLOAD_OPTIONAL_OUTPUT_HOOKS = new Set();
async function loadHookModule(taskType) {
if (!isProgrammaticIoTaskType(taskType)) return null;
- return HOOK_MODULES[taskType]();
+ return HOOK_MODULES[taskType].load();
}
/**
@@ -256,27 +267,15 @@ function isTrackerFilingDispatch(task) {
return CONCRETE_WORK_TRACKERS.includes(task?.metadata?.workTracker);
}
-// Task types whose `buildTaskInput` hook resolves the app's per-app
-// provider/model override into the spawn. cosTaskGenerator applies the hook's
-// returned `{ providerId, model }` LAST (applyProviderModelPins), so for these
-// types the per-app override OUTRANKS the global Schedule pin. Every other task
-// type reads only `taskMetadata` off the override and takes its provider from
-// the pin — a per-app provider/model stored on one of those is inert, so the UI
-// must not offer it there. Kept in sync with HOOK_MODULES by the suite.
-const PROVIDER_OVERRIDE_TASK_TYPES = new Set(['layered-intelligence']);
-
/**
* Whether a per-app provider/model override actually reaches the spawn for this
- * task type (and therefore supersedes the global Schedule pin). Synchronous so
- * the schedule-status builder can stamp the capability on every task row.
+ * task type (and therefore supersedes the global Schedule pin) — read off the
+ * type's own registry entry. Synchronous so the schedule-status builder can stamp
+ * the capability on every task row.
*/
export function honorsPerAppProviderOverride(taskType) {
- return typeof taskType === 'string' && PROVIDER_OVERRIDE_TASK_TYPES.has(taskType);
-}
-
-/** The provider-override-honoring task types, for the drift guard in the suite. */
-export function listProviderOverrideTaskTypes() {
- return [...PROVIDER_OVERRIDE_TASK_TYPES];
+ return isProgrammaticIoTaskType(taskType)
+ && HOOK_MODULES[taskType].honorsPerAppProviderOverride === true;
}
/**
diff --git a/server/services/taskTypeHooks.test.js b/server/services/taskTypeHooks.test.js
index 6c2f10148d..0a741ee976 100644
--- a/server/services/taskTypeHooks.test.js
+++ b/server/services/taskTypeHooks.test.js
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
-import { canRunTaskOutputHookWithoutPayload, getTaskInputHook, getTaskOutputHook, honorsPerAppProviderOverride, isProgrammaticIoTaskType, listProviderOverrideTaskTypes } from './taskTypeHooks.js';
+import { canRunTaskOutputHookWithoutPayload, getTaskInputHook, getTaskOutputHook, honorsPerAppProviderOverride, isProgrammaticIoTaskType } from './taskTypeHooks.js';
describe('taskTypeHooks registry', () => {
it('resolves both hooks for layered-intelligence to callables', async () => {
@@ -44,19 +44,11 @@ describe('isProgrammaticIoTaskType (#2700)', () => {
describe('honorsPerAppProviderOverride', () => {
it('is true only for the type whose hook resolves the app pin', () => {
expect(honorsPerAppProviderOverride('layered-intelligence')).toBe(true);
+ // A type with no hook at all can't consume a per-app provider/model, so the
+ // UI must not offer one for it.
expect(honorsPerAppProviderOverride('security')).toBe(false);
- expect(honorsPerAppProviderOverride('')).toBe(false);
- expect(honorsPerAppProviderOverride(undefined)).toBe(false);
+ // Same inherited-key hazard isProgrammaticIoTaskType guards — the capability
+ // read must not resolve through the prototype either.
expect(honorsPerAppProviderOverride('constructor')).toBe(false);
});
-
- // A type can only consume a per-app provider/model through its buildTaskInput
- // hook, so claiming one without a hook would make the UI offer a picker that
- // silently does nothing — exactly the bug this list exists to prevent.
- it('never claims a type that has no buildTaskInput hook', async () => {
- for (const taskType of listProviderOverrideTaskTypes()) {
- expect(isProgrammaticIoTaskType(taskType)).toBe(true);
- expect(typeof await getTaskInputHook(taskType)).toBe('function');
- }
- });
});