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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
Surface global pause in app automation tabs; manual Run bypasses it
Adam Eivy39ad11c25ac4
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex a7875a628c..9daa498700 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -3,3 +3,4 @@## Added- Editorial Checks page now has an AI provider + model selector that configures the editorial pass. Leave it on "Default provider" to use the active/stage provider, or pick a specific provider/model to override the LLM-backed checks for that run.+- App **Automation** tabs now show a banner when scheduled automation is globally paused, with a one-click **Resume**. Manually clicking **Run** on a task now bypasses the global pause — the pause only stops scheduled/autonomous spawning, not explicit user triggers.diff --git a/client/src/components/apps/tabs/AutomationTab.jsx b/client/src/components/apps/tabs/AutomationTab.jsxindex 5632f15dea..ae07179a53 100644--- a/client/src/components/apps/tabs/AutomationTab.jsx+++ b/client/src/components/apps/tabs/AutomationTab.jsx@@ -1,5 +1,5 @@import { useState, useEffect, useCallback } from 'react';-import { RefreshCw, Play } from 'lucide-react';+import { RefreshCw, Play, PauseCircle } from 'lucide-react';import toast from '../../ui/Toast';import BrailleSpinner from '../../BrailleSpinner';import CronInput from '../../CronInput';@@ -22,17 +22,21 @@ const INTERVAL_OPTIONS = [export default function AutomationTab({ appId, appName }) {const [overrides, setOverrides] = useState({});const [schedule, setSchedule] = useState(null);+ const [paused, setPaused] = useState(false);+ const [resuming, setResuming] = useState(false);const [loading, setLoading] = useState(true);const [triggering, setTriggering] = useState(null);const [cronEditing, setCronEditing] = useState({});const fetchData = useCallback(async () => {- const [taskTypesData, scheduleData] = await Promise.all([+ const [taskTypesData, scheduleData, statusData] = await Promise.all([api.getAppTaskTypes(appId).catch(() => ({ taskTypeOverrides: {} })),- api.getCosSchedule().catch(() => null)+ api.getCosSchedule().catch(() => null),+ api.getCosStatus().catch(() => null)]);setOverrides(taskTypesData.taskTypeOverrides || {});setSchedule(scheduleData);+ setPaused(statusData?.paused === true);setLoading(false);}, [appId]);@@ -40,6 +44,19 @@ export default function AutomationTab({ appId, appName }) {fetchData();}, [fetchData]);+ const handleResume = async () => {+ setResuming(true);+ const result = await api.resumeCos().catch(err => {+ toast.error(err.message);+ return null;+ });+ setResuming(false);+ if (result?.success) {+ setPaused(false);+ toast.success('Scheduled automation resumed');+ }+ };+const handleToggle = async (taskType, isEnabled) => {const newEnabled = !isEnabled;await api.updateAppTaskTypeOverride(appId, taskType, { enabled: newEnabled }).catch(err => {@@ -132,6 +149,25 @@ export default function AutomationTab({ appId, appName }) {return (<div className="max-w-5xl space-y-4">+ {paused && (+ <div className="bg-port-warning/10 border border-port-warning/40 rounded-lg p-3 flex items-start gap-3">+ <PauseCircle size={18} className="text-port-warning shrink-0 mt-0.5" />+ <div className="flex-1 min-w-0">+ <p className="text-sm font-medium text-port-warning">Scheduled automation is globally paused</p>+ <p className="text-xs text-gray-400 mt-0.5">+ Scheduled and autonomous tasks won't run until resumed. You can still trigger an enabled task manually with <span className="text-gray-300">Run</span>.+ </p>+ </div>+ <button+ onClick={handleResume}+ disabled={resuming}+ className="px-3 py-1.5 bg-port-warning/20 text-port-warning hover:bg-port-warning/30 rounded-lg text-xs font-medium flex items-center gap-1 disabled:opacity-50 shrink-0"+ >+ <Play size={14} />+ {resuming ? 'Resuming…' : 'Resume'}+ </button>+ </div>+ )}<div className="flex items-center justify-between"><div className="flex items-center gap-4"><div>diff --git a/server/services/cos.js b/server/services/cos.jsindex 7573f0a5ba..51af657c34 100644--- a/server/services/cos.js+++ b/server/services/cos.js@@ -649,8 +649,11 @@ async function tryImmediateSpawn(task) {async function dequeueNextTask() {if (!isDaemonRunning()) return;+ // A global pause stops scheduled/autonomous spawning, but NOT explicit user+ // triggers: on-demand requests (Priority 0) are processed even while paused so+ // a manual "Run" from an app's automation page still fires. The autonomous+ // tiers (Priority 1+) are skipped below when paused.const paused = await isPaused();- if (paused) return;const state = await loadState();const runningAgents = Object.values(state.agents).filter(a => a.status === 'running').length;@@ -751,6 +754,10 @@ async function dequeueNextTask() {}}+ // Global pause stops every autonomous/scheduled/user tier below; only the+ // on-demand queue above (explicit user "Run") bypasses it.+ if (paused) return;+// Priority 1: User tasksconst userTaskData = await getUserTasks();const pendingUserTasks = userTaskData.grouped?.pending || [];diff --git a/server/services/cos.test.js b/server/services/cos.test.jsindex 709d071673..8fcfe0a3b5 100644--- a/server/services/cos.test.js+++ b/server/services/cos.test.js@@ -98,7 +98,7 @@ function makeCapacityTracker(state, agentsByProject = {}) {* `evaluateTasks` mirrors this at cos.js:862 with `tasksToSpawn.length === 0`.* The replica enforces the same `spawned === 0` precondition.*/-function priorityDequeue(buckets, capacity) {+function priorityDequeue(buckets, capacity, { paused = false } = {}) {const order = ['onDemand', 'user', 'autoSystem', 'mission', 'idle'];// Mission / idle only run when no pending user tasks exist, mirroring the@@ -106,6 +106,10 @@ function priorityDequeue(buckets, capacity) {const hasPendingUserTasks = (buckets.user || []).length > 0;for (const bucketName of order) {+ // Global pause: on-demand (explicit user "Run") still drains, but every+ // autonomous/scheduled/user tier below is skipped — mirrors the+ // `if (paused) return;` gate in dequeueNextTask after Priority 0.+ if (paused && bucketName !== 'onDemand') break;if ((bucketName === 'mission' || bucketName === 'idle') && hasPendingUserTasks) continue;// Idle is stricter: only fires when no other bucket has spawned yet.if (bucketName === 'idle' && capacity.spawned.length > 0) continue;@@ -167,6 +171,28 @@ describe('evaluateTasks — priority ordering', () => {expect(spawned.map(t => t._bucket)).toEqual(['onDemand', 'user', 'autoSystem']);});+ it('when globally paused, only the on-demand bucket drains (manual Run bypasses pause)', () => {+ // A global pause stops scheduled/autonomous/user spawning, but an explicit+ // user "Run" pushes an on-demand request that must still fire. Mirrors the+ // production gate: Priority 0 (on-demand) is processed, then `if (paused) return;`.+ const state = makeState({ maxConcurrentAgents: 5 });+ const capacity = makeCapacityTracker(state);++ const buckets = {+ onDemand: [task('task-onDemand-1')],+ user: [task('task-user-1')],+ autoSystem: [task('sys-auto-1')],+ mission: [task('sys-mission-1')],+ idle: [task('sys-idle-1')],+ };++ const spawned = priorityDequeue(buckets, capacity, { paused: true });++ // Only the on-demand request spawns; everything else stays paused.+ expect(spawned.map(t => t.id)).toEqual(['task-onDemand-1']);+ expect(spawned.map(t => t._bucket)).toEqual(['onDemand']);+ });+it('mission + idle fire only when there are NO pending user tasks', () => {// Idle is fenced behind `spawned === 0` in production (cos.js:2480), so// when autoSystem and mission are both non-empty, idle does NOT fire.