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

fix: finish managed job review refinements (#5037)

[._.]/ Adam Eivy9ebcbafa3c18
diff --git a/client/src/components/apps/tabs/AutomationTab.jsx b/client/src/components/apps/tabs/AutomationTab.jsx
index 67a228c49a..ab2a850165 100644
--- a/client/src/components/apps/tabs/AutomationTab.jsx
+++ b/client/src/components/apps/tabs/AutomationTab.jsx
@@ -29,6 +29,8 @@ export default function AutomationTab({ appId, appName }) {
const [overrides, setOverrides] = useState({});
const [schedule, setSchedule] = useState(null);
const [providers, setProviders] = useState([]);
+ const [providerCatalog, setProviderCatalog] = useState([]);
+ const [activeProviderId, setActiveProviderId] = useState('');
const [paused, setPaused] = useState(false);
const [resuming, setResuming] = useState(false);
const [loading, setLoading] = useState(true);
@@ -51,6 +53,8 @@ export default function AutomationTab({ appId, appName }) {
setPaused(statusData?.paused === true);
// Every ENABLED provider of a runnable type (cli/tui/api) — handler-backed
// tasks dispatch on provider.type, so any of them is a valid override.
+ setProviderCatalog(providersData?.providers || []);
+ setActiveProviderId(providersData?.activeProvider || '');
setProviders((providersData?.providers || []).filter(
p => RUNNABLE_PROVIDER_TYPES.includes(p.type) && p.enabled !== false
));
@@ -387,7 +391,12 @@ export default function AutomationTab({ appId, appName }) {
)}
<div className="border-t border-port-border pt-4">
- <CustomTasksSection appId={appId} appName={appName} />
+ <CustomTasksSection
+ appId={appId}
+ appName={appName}
+ providerCatalog={providerCatalog}
+ activeProviderId={activeProviderId}
+ />
</div>
</div>
);
diff --git a/client/src/components/apps/tabs/CustomTasksSection.jsx b/client/src/components/apps/tabs/CustomTasksSection.jsx
index f6ecbdc59d..92936ba00f 100644
--- a/client/src/components/apps/tabs/CustomTasksSection.jsx
+++ b/client/src/components/apps/tabs/CustomTasksSection.jsx
@@ -269,7 +269,7 @@ function TaskForm({ form, setForm, onSave, onCancel, saveLabel, timezone, provid
);
}
-export default function CustomTasksSection({ appId, appName }) {
+export default function CustomTasksSection({ appId, appName, providerCatalog, activeProviderId: inheritedActiveProviderId = '' }) {
const timezone = useUserTimezone();
const [tasks, setTasks] = useState([]);
const [loading, setLoading] = useState(true);
@@ -277,8 +277,8 @@ export default function CustomTasksSection({ appId, appName }) {
const [createForm, setCreateForm] = useState(emptyForm);
const [editingId, setEditingId] = useState(null);
const [editForm, setEditForm] = useState(emptyForm);
- const [rawProviders, setRawProviders] = useState([]);
- const [activeProviderId, setActiveProviderId] = useState('');
+ const [rawProviders, setRawProviders] = useState(providerCatalog || []);
+ const [activeProviderId, setActiveProviderId] = useState(inheritedActiveProviderId);
const [triggering, setTriggering] = useState(null);
const { isConfirming, requestDelete, cancelDelete, confirmDelete } = useConfirmDelete();
@@ -297,11 +297,16 @@ export default function CustomTasksSection({ appId, appName }) {
useEffect(() => { fetchTasks(); }, [fetchTasks]);
useEffect(() => {
+ if (providerCatalog) {
+ setRawProviders(providerCatalog);
+ setActiveProviderId(inheritedActiveProviderId || '');
+ return;
+ }
api.getProviders({ silent: true }).then(data => {
setRawProviders(data?.providers || []);
setActiveProviderId(data?.activeProvider || '');
}).catch(() => {});
- }, []);
+ }, [providerCatalog, inheritedActiveProviderId]);
const validate = (form) => {
if (!form.name.trim()) { toast.error('Name is required'); return false; }
diff --git a/client/src/components/cos/AgentJobProviderFields.jsx b/client/src/components/cos/AgentJobProviderFields.jsx
index bf9c54a4dc..dd31100c3c 100644
--- a/client/src/components/cos/AgentJobProviderFields.jsx
+++ b/client/src/components/cos/AgentJobProviderFields.jsx
@@ -7,6 +7,8 @@ import ProviderModelSelector from '../ProviderModelSelector.jsx';
* Empty selections are intentional inherit/default sentinels. Changing the
* provider clears the model and effort together, while a saved legacy model pin
* remains visible through effortAwareModelOptions until the user changes it.
+ * Selecting a model or effort from the inherited state pins the active provider
+ * too, so a later active-provider change cannot make that override incompatible.
* Existing API-only pins remain in the input list only long enough to be cleared;
* new selections are restricted to providers with a CoS coding harness.
*/
@@ -26,6 +28,8 @@ export default function AgentJobProviderFields({
);
const availableModels = effortAwareModelOptions(selectedProvider, data.model);
const effectiveProviderId = usingActive ? (activeProviderId || undefined) : undefined;
+ const patchWithActiveProvider = (patch) =>
+ data.providerId || !activeProviderId ? patch : { providerId: activeProviderId, ...patch };
return (
<div>
@@ -37,9 +41,9 @@ export default function AgentJobProviderFields({
selectedModel={data.model || ''}
availableModels={availableModels}
onProviderChange={providerId => onChange({ providerId, model: '', effort: '' })}
- onModelChange={model => onChange({ model })}
+ onModelChange={model => onChange(patchWithActiveProvider({ model }))}
effort={data.effort || ''}
- onEffortChange={effort => onChange({ effort })}
+ onEffortChange={effort => onChange(patchWithActiveProvider({ effort }))}
compact
emptyProviderOption="Default (active provider)"
emptyModelOption="Default model"
diff --git a/client/src/components/cos/AgentJobProviderFields.test.jsx b/client/src/components/cos/AgentJobProviderFields.test.jsx
index 33750a02e2..24bf1d0ad1 100644
--- a/client/src/components/cos/AgentJobProviderFields.test.jsx
+++ b/client/src/components/cos/AgentJobProviderFields.test.jsx
@@ -49,6 +49,23 @@ describe('AgentJobProviderFields', () => {
expect(onChange).toHaveBeenCalledWith({ providerId: 'codex', model: '', effort: '' });
});
+ it('pins the active provider when a model is selected from the inherited state', async () => {
+ const onChange = vi.fn();
+ render(
+ <AgentJobProviderFields
+ data={{ providerId: '', model: '', effort: '' }}
+ providers={PROVIDERS}
+ activeProviderId="claude-code"
+ onChange={onChange}
+ />
+ );
+ await act(async () => {});
+
+ fireEvent.change(screen.getByLabelText('Model'), { target: { value: 'claude-sonnet' } });
+
+ expect(onChange).toHaveBeenCalledWith({ providerId: 'claude-code', model: 'claude-sonnet' });
+ });
+
it('keeps a legacy Antigravity model pin visible while it is being edited', async () => {
render(
<AgentJobProviderFields
diff --git a/client/src/utils/README.md b/client/src/utils/README.md
index fcb941e154..0fcaf916df 100644
--- a/client/src/utils/README.md
+++ b/client/src/utils/README.md
@@ -42,7 +42,6 @@ grep -i "what you want to do" client/src/utils/README.md
| `platform` | `isMac` detection and `modKey` (⌘/Ctrl) for keyboard-shortcut display. |
| `navWorkingSet` | Recent/pinned nav persistence (`recordVisit`, `togglePin`, `isPinned`) plus `resolveRecentNavEntries` for mapping stored deep links back to their longest matching nav-manifest entry. Also `migrateLegacyNavPath(path, commands)` — maps a stored path onto the CURRENT path of the page that used to answer to it, driven by each command's own `previousPaths` (declared in `server/lib/navManifest.js` beside the page that moved, shipped whole in the palette manifest). A pin is a stored route path, so without it a moved page's pin stops matching the manifest and the sidebar row silently vanishes on update. |
| `providers` | AI-provider type predicates and helpers (`isCliProvider`, `isApiProvider`, `isCodexProvider`, `isAntigravityProvider`, `isLaunchableTuiProvider` — a TUI provider carrying the server-resolved `tuiCommandLine`, i.e. one a human can start at a shell prompt; shared by the Providers card's "Launch in Shell" button and the Shell page's launch menu so the two can't disagree — `PROVIDER_GATEWAYS` / `gatewayForProvider` / `isGatewayBackedProvider` (an OpenCode wrapper front-ending a hosted OpenAI-compatible gateway — `orcarouter`, `openrouter` — which inherits its API key at spawn time from the sibling API provider whose id equals the gateway id; reads the generic `gatewayBacked` marker and, forever, the legacy per-gateway boolean. MIRROR of `server/lib/providerGateways.js`, which the browser cannot import; keep the three copies in lockstep), `filterSelectableModels`, `resolveCliEffort` (mirror — what a stored effort actually runs as, so the picker can name a clamped level), `configuredDefaultIn` — the sentinel a provider's catalog carries, so a picker can render an option matching a sentinel-valued tier instead of a blank select — `getProviderTimeout`, `resolveEffectiveProvider` — the provider a record actually runs on (its pin, else the active provider) plus whether it fell back, so a "Default" option can name what it resolves to — `resolveSeriesRunLlm` (mirror of server `seriesLlmOverride.js`: which provider/model a Pipeline **series** run resolves to — per-run override → `series.llm` → active provider) and `providerModelLabel` (the one "Provider / model" phrasing), configured-default sentinels, and the claude/codex/agy thinking-effort levels — `effortLevelsForProvider`, mirror of server `providerModels.js`). Also `isRunnerAllowedCommand(command, allowedCommands)` — would the CoS Agent Runner (`/spawn`, `/spawn-tui`) accept this command? Mirrors only the *normalization* in `server/cos-runner/allowedCommands.js` (the list itself arrives as `runnerAllowedCommands` on `GET /api/providers`, because the allowlist is an exec boundary and stays hand-curated server-side); returns `null` for "list not fetched / field blank" so a failed fetch never renders a warning. Pinned by `server/cos-runner/allowedCommands.parity.test.js`. `isPrivateNetworkEndpoint(endpoint)` — loopback, RFC1918/tailnet address, or a `.local`/`.ts.net`/single-label host, i.e. somewhere an unauthenticated OpenAI-compatible server is a normal setup rather than a missing API key. `isLocalInstanceProvider(provider)` — the narrower question, mirroring server `localProviderRuntime.js#isLocalInstanceEndpoint`: does this provider talk to a daemon on THIS machine (loopback, or no endpoint at all)? Gate anything that explains a provider by inspecting the host PortOS runs on — install state, "start it from Settings → Local LLM" — since `localBackendForProvider` matches by NAME and would otherwise claim a peer's LM Studio. And `credentialSource(provider)` plus `providerCardState(provider, { runtime, status, keySetFor, envVarSet })` + `PROVIDER_CARD_STATE` — is a provider ready to run, benched, blocked on a missing prerequisite (CLI not installed / API key absent / empty credential environment variable), or simply switched off? Reads the SERVER's `missingPrerequisites` (published per provider on `GET /api/providers` from `server/lib/providerPrerequisites.js`, and the same computation `getFallbackProvider` routes on) and adds the local-app runtime shape plus tri-state checks for stored, inherited, and process environment credentials. Unknown lookup values mean "not probed", never "missing". Drives the AI Providers page card colors and grouping — distinct from `ProviderReadiness`/`GET /api/providers/readiness`, which probes the local daemon behind a provider. `resolvesOutsidePortosPath(provider)` — does this provider resolve its binary somewhere the runtime probe never looked (an explicit path in `command`, or its own `PATH` in `envVars`)? Mirror of the same two guards in the server's `providerRuntimeKey`, and what keeps the card's badge from accusing a working provider the router happily routes. And `providerRuntimeKey(provider)` — the key a provider's runtime is published under by `GET /api/providers/runtimes`, so a card can show its CLI install status (bare binary name for a cli/tui provider, provider id for an API provider fronted by a local app); the runtime table itself stays server-side. |
-| `providers` (agent jobs) | `RUNNABLE_PROVIDER_TYPES` and `filterRunnableProviders` keep the shared CoS agent-job pickers aligned with the server's CLI/TUI file-writing harness boundary while retaining saved pins long enough to clear them. |
| `systemCapabilities` | Server-annotated hardware compatibility helpers: preserve model/provider choices when compatibility is unknown, and hide only entries whose `hardwareCompatibility.state` is definitively `unavailable`. |
| `layeredIntelligenceReasons` | Canonical gloss for the Layered Intelligence loop's run-outcome reason tokens, shared by the on-demand toast and the durable "Last run" line (`formatLiReason`, `liReasonTone`, `LI_NEUTRAL_REASONS`). |
diff --git a/client/src/utils/providers.js b/client/src/utils/providers.js
index 95795c4882..86a1bd5abb 100644
--- a/client/src/utils/providers.js
+++ b/client/src/utils/providers.js
@@ -176,8 +176,8 @@ export const PROVIDER_TYPES = Object.freeze({
});
// Agent jobs need the CLI/TUI file-writing harnesses. Keep this allowlist in
-// lockstep with isAgentHarness in server/services/agentProviderResolution.js.
-export const RUNNABLE_PROVIDER_TYPES = Object.freeze([
+// lockstep with the api-provider rejection in server/services/agentProviderResolution.js.
+export const AGENT_HARNESS_PROVIDER_TYPES = Object.freeze([
PROVIDER_TYPES.CLI,
PROVIDER_TYPES.TUI
]);
@@ -191,7 +191,7 @@ export const filterRunnableProviders = (providers, selectedProviderIds = []) =>
(Array.isArray(selectedProviderIds) ? selectedProviderIds : [selectedProviderIds]).filter(Boolean)
);
return (Array.isArray(providers) ? providers : []).filter(provider =>
- RUNNABLE_PROVIDER_TYPES.includes(provider?.type) || preservedIds.has(provider?.id)
+ AGENT_HARNESS_PROVIDER_TYPES.includes(provider?.type) || preservedIds.has(provider?.id)
);
};
diff --git a/server/services/cosJobScheduler.test.js b/server/services/cosJobScheduler.test.js
index ed4d7145b7..b821bcd215 100644
--- a/server/services/cosJobScheduler.test.js
+++ b/server/services/cosJobScheduler.test.js
@@ -104,7 +104,10 @@ import {
executeScheduledJob,
getScheduledActionReservations,
clearSpawningJob,
+ registerSingleJobSchedule,
} from './cosJobScheduler.js';
+import { schedule as scheduleEvent, cancel as cancelEvent } from './eventScheduler.js';
+import { getJob } from './autonomousJobs.js';
import { getDomainBudgetStatus } from './domainUsage.js';
beforeEach(() => {
@@ -219,3 +222,16 @@ describe('executeScheduledJob — same-tick daily-action budget race (#984)', ()
expect(getScheduledActionReservations()).toBe(0);
});
});
+
+describe('registerSingleJobSchedule', () => {
+ it('cancels a disabled job instead of registering a recurring timer', async () => {
+ scheduleEvent.mockClear();
+ cancelEvent.mockClear();
+ getJob.mockResolvedValueOnce({ id: 'job-disabled', enabled: false });
+
+ await registerSingleJobSchedule('job-disabled');
+
+ expect(cancelEvent).toHaveBeenCalledWith('job:job-disabled');
+ expect(scheduleEvent).not.toHaveBeenCalled();
+ });
+});