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
show app-scheduled tasks on the Schedule Timeline instead of dropping them
[._.]/ Adam Eivy92c5c7327cbf
diff --git a/README.md b/README.mdindex c1d83a651e..4a5761e869 100644--- a/README.md+++ b/README.md@@ -94,7 +94,7 @@ An autonomous AI agent orchestrator that manages your development workflow. Subm- **Productivity Analytics** — Hourly/daily work patterns, task milestones, and AI-generated weekly digests- **Decision Transparency** — Every skip, switch, and routing decision is logged with reasons, surfaced on the dashboard- **Briefing + Health** — A daily briefing of what CoS did and what needs you, plus a health view of queue depth, failure storms, and circuit-breaker state-- **Schedule Timeline** — Launch-order visualization of every scheduled task with an inline schedule editor, so overlapping cron runs are visible before they collide+- **Schedule Timeline** — Launch-order visualization of every scheduled task with an inline schedule editor, so overlapping cron runs are visible before they collide. Per-app cron overrides get their own markers, so a task left on-demand globally still shows when it runs for the apps that schedule it- **GSD Scanner** — Reads `.planning/` directories in managed apps and tracks phase state and concerns per project### Create Suitediff --git a/client/src/components/cos/tabs/WorkflowTab.appSchedules.test.jsx b/client/src/components/cos/tabs/WorkflowTab.appSchedules.test.jsxnew file mode 100644index 0000000000..7645ead6e6--- /dev/null+++ b/client/src/components/cos/tabs/WorkflowTab.appSchedules.test.jsx@@ -0,0 +1,98 @@+/**+ * A task left on-demand at the global config while an app override pins a cron+ * used to vanish from this page: the projection gave it no occurrences and the+ * row landed in the "Unpinned runner queue", which says outright that these+ * tasks do not promise a clock time. They do — for that app.+ */++import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';+import { render, screen, cleanup, act, within } from '@testing-library/react';+import { MemoryRouter } from 'react-router';++const api = {+ getCosWorkflow: vi.fn(),+ updateAppTaskTypeOverride: vi.fn(),+ bulkUpdateAppTaskTypeOverride: vi.fn(),+};+vi.mock('../../../services/api', () => api);++const WorkflowTab = (await import('./WorkflowTab')).default;++const NOW = new Date('2026-08-22T00:00:00Z');+const HOUR = 3600 * 1000;++const graph = ({ appSchedules, occurrences }) => ({+ timezone: 'UTC',+ timeline: {+ startAt: NOW.toISOString(),+ endAt: new Date(NOW.getTime() + 24 * HOUR).toISOString(),+ occurrences,+ windows: [],+ },+ nodes: [{+ id: 'task:release-check',+ kind: 'task',+ label: 'release-check',+ enabled: true,+ schedule: { type: 'on-demand' },+ totalAppCount: 2,+ enabledAppCount: 1,+ appOverrides: {},+ appSchedules,+ }],+ edges: [],+});++const APP_SCHEDULED = graph({+ appSchedules: [{ appId: 'acme', appName: 'Acme', cronExpression: '0 7 * * *', nextRunAt: new Date(NOW.getTime() + 7 * HOUR).toISOString() }],+ occurrences: [{+ id: 'task:release-check:launch:1',+ nodeId: 'task:release-check',+ at: new Date(NOW.getTime() + 7 * HOUR).toISOString(),+ kind: 'launch',+ apps: ['acme'],+ }],+});++const render_ = async (data) => {+ api.getCosWorkflow.mockResolvedValue(data);+ await act(async () => {+ render(<MemoryRouter><WorkflowTab apps={[]} providers={[]} /></MemoryRouter>);+ });+ // The label appears on the track AND on its 'Scheduled order' chip.+ await screen.findAllByText('release-check');+};++beforeEach(() => vi.clearAllMocks());+afterEach(cleanup);++describe('WorkflowTab per-app schedules', () => {+ it('gives an app-scheduled task a timeline track instead of the unpinned queue', async () => {+ await render_(APP_SCHEDULED);++ expect(screen.queryByText('Unpinned runner queue')).not.toBeInTheDocument();+ // The cadence line names the app schedule rather than repeating the+ // global row's "on demand".+ expect(screen.getByText('1 app · at 07:00')).toBeInTheDocument();+ expect(screen.getByTitle(/On demand globally[\s\S]*Acme — at 07:00 \(0 7 \* \* \*\)/)).toBeInTheDocument();+ });++ it('marks a launch that only some apps take, and names them', async () => {+ await render_(APP_SCHEDULED);++ const marker = screen.getByTitle(/^Launch .* · for Acme$/);+ // Round rather than square: a free channel that leaves the collision ring+ // and the due-now fill free to show at the same time.+ expect(marker.className).toContain('rounded-full');+ expect(marker.className).not.toContain('rounded-sm');++ const nextUp = screen.getByText('Scheduled order').closest('section');+ expect(within(nextUp).getByText('for Acme')).toBeInTheDocument();+ });++ it('still files a task with no schedule of any kind under the unpinned queue', async () => {+ await render_(graph({ appSchedules: [], occurrences: [] }));++ expect(screen.getByText('Unpinned runner queue')).toBeInTheDocument();+ });+});diff --git a/client/src/components/cos/tabs/WorkflowTab.jsx b/client/src/components/cos/tabs/WorkflowTab.jsxindex 1a74c9db68..0d30136905 100644--- a/client/src/components/cos/tabs/WorkflowTab.jsx+++ b/client/src/components/cos/tabs/WorkflowTab.jsx@@ -3,9 +3,10 @@ import { useSearchParams } from 'react-router';import { AlertTriangle, ArrowRight, Bot, CalendarDays, ChevronRight, Clock3, GitBranch, Infinity as InfinityIcon, RefreshCw, RotateCcw, TimerReset, Workflow } from 'lucide-react';import * as api from '../../../services/api';import { useAppOverrideActions } from '../../../hooks/useAppOverrideActions';-import { describeCron, describeRecurrence } from '../../../utils/cronHelpers';+import { describeCron, describeRecurrence, summarizeAppSchedules } from '../../../utils/cronHelpers';import ScheduleEditor from './workflow/ScheduleEditor';import PerAppOverrideList from './schedule/PerAppOverrideList';+import { isManualOnlyCadence } from './schedule/scheduleConstants';import { formatWeekdayShort, formatWeekdayTime, formatTimeOfDay } from '../../../utils/formatters';const TRACK_COLORS = {@@ -21,7 +22,8 @@ function trackPalette(node) {return TRACK_COLORS[node.kind] || TRACK_COLORS.task;}-function describeSchedule(node) {+// The cadence the node's OWN row states, ignoring anything its apps pin.+function describeGlobalSchedule(node) {const schedule = node.schedule || {};// A perpetual task's cadence line names its recheck: a scheduled one rechecks// on its own cron expression, an on-demand one on `recheckCron`.@@ -35,6 +37,26 @@ function describeSchedule(node) {return schedule.type?.replaceAll('-', ' ') || 'flexible';}+/**+ * The one cadence line a task track shows, plus its tooltip.+ *+ * A task whose only clock cadences live on its apps has none of its own to+ * describe — "on demand" would be the literal truth of the global row and the+ * opposite of what the track actually shows. The line is one 10px row, so the+ * full story (which app runs on which expression) goes in the tooltip.+ */+function scheduleCadence(node) {+ const schedule = node.schedule || {};+ const perApp = node.kind === 'task' ? summarizeAppSchedules(node.appSchedules) : null;+ const ownCadence = !!(schedule.perpetual || schedule.cronSchedule || schedule.cronExpression);+ const global = describeGlobalSchedule(node);+ if (!perApp) return { text: global, title: undefined };+ return {+ text: ownCadence ? global : perApp.label,+ title: `${ownCadence ? `Globally: ${global}.` : 'On demand globally — no clock cadence of its own.'}\nScheduled per app:\n${perApp.detail}`+ };+}+function formatPoint(iso, hours, timezone) {return hours === 168? formatWeekdayTime(iso, { timeZone: timezone })@@ -67,6 +89,17 @@ function dueNowMeta(occurrence, node, timezone) {return { badge: 'overdue', detail: 'Overdue — the interval elapsed since the last run' };}+// An occurrence the server tagged with `apps` comes from those apps' own cron+// overrides, not from the task's global cadence. `appNameLookup` is built once+// per node — every occurrence of that node resolves against the same map.+const appNameLookup = node =>+ new Map((node?.appSchedules || []).map(entry => [entry.appId, entry.appName || entry.appId]));++function occurrenceAppNames(occurrence, names) {+ if (!occurrence?.apps?.length) return null;+ return occurrence.apps.map(appId => names.get(appId) || appId).join(', ');+}+function timelinePercent(iso, timeline) {const start = new Date(timeline.startAt).getTime();const end = new Date(timeline.endAt).getTime();@@ -123,6 +156,8 @@ function AppOverridePanel({ node, apps, providers, providersLoaded, onUpdateOverfunction TimelineRow({ node, occurrences, windows, timeline, hours, timezone, selected, apps, providers, providersLoaded, expanded, onSelect, onToggleExpand, onUpdateOverride, onBulkToggleOverride }) {const palette = trackPalette(node);+ const cadence = scheduleCadence(node);+ const appNames = appNameLookup(node);const Icon = node.kind === 'job' ? Bot : GitBranch;const divisions = hours === 168 ? 7 : 8;const dependencyWarning = node.pendingDeps?.length > 0;@@ -156,7 +191,7 @@ function TimelineRow({ node, occurrences, windows, timeline, hours, timezone, se<span className={`flex h-7 w-7 shrink-0 items-center justify-center rounded ${palette.wash} ${palette.text}`}><Icon className="h-3.5 w-3.5" /></span><span className="min-w-0 flex-1"><span className="block truncate text-xs font-medium text-gray-200" title={node.label}>{node.label}</span>- <span className="mt-0.5 block truncate text-[10px] text-gray-500">{describeSchedule(node)}</span>+ <span className="mt-0.5 block truncate text-[10px] text-gray-500" title={cadence.title}>{cadence.text}</span></span></button>{canExpand && (@@ -196,18 +231,23 @@ function TimelineRow({ node, occurrences, windows, timeline, hours, timezone, se})}{occurrences.map(occurrence => {const meta = dueNowMeta(occurrence, node, timezone);+ // A launch only some apps take is a circle, not a square — a free+ // visual channel that leaves the collision ring and the due-now+ // fill intact, so a marker can show all three states at once.+ const scopedApps = occurrenceAppNames(occurrence, appNames);// Due-now is an amber FILL, collision a warning RING — kept on separate// channels so a launch that is BOTH (the common catch-up scenario, where// several tasks are due at Now and therefore also collide) shows both// states at once. A shared ring channel would let collision mask due-now.const fill = occurrence.kind === 'recheck' ? 'rotate-45 bg-amber-300' : meta ? 'bg-amber-400' : palette.marker;const ring = occurrence.collision ? 'ring-2 ring-port-warning ring-offset-1 ring-offset-port-bg' : '';+ const shape = scopedApps ? 'rounded-full' : 'rounded-sm';return (<spankey={occurrence.id}- className={`absolute top-1/2 z-20 h-4 w-4 -translate-x-1/2 -translate-y-1/2 rounded-sm border-2 border-port-bg shadow ${fill} ${ring}`}+ className={`absolute top-1/2 z-20 h-4 w-4 -translate-x-1/2 -translate-y-1/2 border-2 border-port-bg shadow ${shape} ${fill} ${ring}`}style={{ left: `${timelinePercent(occurrence.at, timeline)}%` }}- title={`${occurrence.kind === 'recheck' ? 'Reset/recheck' : 'Launch'} ${formatPoint(occurrence.at, hours, timezone)}${meta ? ` · ${meta.detail}` : ''}${occurrence.collision ? ' · another task launches within 15 minutes' : ''}`}+ title={`${occurrence.kind === 'recheck' ? 'Reset/recheck' : 'Launch'} ${formatPoint(occurrence.at, hours, timezone)}${scopedApps ? ` · for ${scopedApps}` : ''}${meta ? ` · ${meta.detail}` : ''}${occurrence.collision ? ' · another task launches within 15 minutes' : ''}`}/>);})}@@ -235,14 +275,17 @@ function NextUp({ occurrences, nodeMap, hours, timezone, onSelect }) {const node = nodeMap.get(occurrence.nodeId);if (!node) return null;const meta = dueNowMeta(occurrence, node, timezone);+ const scopedApps = occurrenceAppNames(occurrence, appNameLookup(node));+ const chipTitle = [scopedApps && `Launches for ${scopedApps}`, meta?.detail].filter(Boolean).join(' · ') || undefined;return (<div key={occurrence.id} className="flex shrink-0 items-center gap-2">- <button type="button" onClick={() => onSelect(node.id)} title={meta?.detail || undefined} className={`min-w-36 rounded border px-3 py-2 text-left hover:border-port-accent/50 ${occurrence.collision ? 'border-port-warning/50 bg-port-warning/5' : meta ? 'border-amber-400/50 bg-amber-500/5' : 'border-port-border bg-port-bg/50'}`}>+ <button type="button" onClick={() => onSelect(node.id)} title={chipTitle} className={`min-w-36 rounded border px-3 py-2 text-left hover:border-port-accent/50 ${occurrence.collision ? 'border-port-warning/50 bg-port-warning/5' : meta ? 'border-amber-400/50 bg-amber-500/5' : 'border-port-border bg-port-bg/50'}`}><span className="flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wide text-gray-500"><span>{formatPoint(occurrence.at, hours, timezone)} · {relativeTime(occurrence.at)}</span>{meta && <span className="rounded-sm bg-amber-500/15 px-1 py-px text-[9px] text-amber-300">{meta.badge}</span>}</span><span className="mt-0.5 block max-w-44 truncate text-xs text-gray-200">{occurrence.kind === 'recheck' ? '↻ ' : ''}{node.label}</span>+ {scopedApps && <span className="mt-0.5 block max-w-44 truncate text-[10px] text-gray-500">for {scopedApps}</span>}</button>{index < next.length - 1 && <ArrowRight className="h-3.5 w-3.5 text-gray-700" />}</div>@@ -332,7 +375,13 @@ export default function WorkflowTab({ apps, providers, providersLoaded }) {if (!windowsByNode.has(window.nodeId)) windowsByNode.set(window.nodeId, []);windowsByNode.get(window.nodeId).push(window);}- const isFlexible = node => node.kind === 'task' && node.schedule?.type === 'on-demand' && !node.schedule?.perpetual;+ // A globally on-demand task that an app puts on a cron DOES promise a+ // clock time — for that app — so it belongs on a track, not in the+ // "no clock time" bucket. That mismatch is what hid app-scheduled tasks+ // from this page entirely. Shares the Schedule card's predicate so the two+ // pages cannot disagree about what "manual only" means.+ const isFlexible = node => node.kind === 'task'+ && isManualOnlyCadence({ ...node.schedule, appSchedules: node.appSchedules });const scheduled = graph.nodes.filter(node => node.enabled && !isFlexible(node)).sort((a, b) => {@@ -403,6 +452,7 @@ export default function WorkflowTab({ apps, providers, providersLoaded }) {<span className="inline-flex items-center gap-1"><span className="h-2.5 w-2.5 rounded-sm bg-cyan-400" /> interval job</span><span className="inline-flex items-center gap-1"><span className="h-2.5 w-2.5 rotate-45 rounded-sm bg-amber-300" /> reset/recheck</span><span className="inline-flex items-center gap-1"><span className="h-2.5 w-2.5 rounded-sm bg-amber-400" /> due now (catch-up)</span>+ <span className="inline-flex items-center gap-1"><span className="h-2.5 w-2.5 rounded-full bg-emerald-400" /> round = per-app schedule</span><span className="inline-flex items-center gap-1"><span className="h-2.5 w-4 rounded-sm border border-dashed border-amber-400/50 bg-amber-500/15" /> perpetual drain (~1h)</span></div><span className="inline-flex items-center gap-1"><CalendarDays className="h-3 w-3" />{graph.timezone}</span>@@ -480,6 +530,7 @@ export default function WorkflowTab({ apps, providers, providersLoaded }) {<div className="flex flex-wrap gap-x-4 gap-y-1 text-[10px] text-gray-600"><span><AlertTriangle className="mr-1 inline h-3 w-3 text-port-warning" />A ring means another launch is within 15 minutes; actual overlap depends on runtime.</span><span><Clock3 className="mr-1 inline h-3 w-3 text-amber-300" />An amber marker at Now means the task is already due (catch-up, first run, or overdue) — it launches on the next check rather than waiting for its next cadence slot.</span>+ <span><CalendarDays className="mr-1 inline h-3 w-3" />A round marker launches only for the apps that pin their own cron for this task — the task's global row may still read “on demand”. Hover the cadence under the task name to see which app runs when.</span><span><TimerReset className="mr-1 inline h-3 w-3" />A perpetual task gets one bar per recurrence showing a nominal hour of runtime — the drain keeps going while backlog remains, so a run can outlast its bar. A filled bar at Now means it is draining already.</span></div></div>diff --git a/client/src/components/cos/tabs/schedule/IntervalBadge.jsx b/client/src/components/cos/tabs/schedule/IntervalBadge.jsxindex 427780d73d..ae9374ef0c 100644--- a/client/src/components/cos/tabs/schedule/IntervalBadge.jsx+++ b/client/src/components/cos/tabs/schedule/IntervalBadge.jsx@@ -1,11 +1,15 @@-import { describeCron } from '../../../../utils/cronHelpers';+import { describeCron, summarizeAppSchedules } from '../../../../utils/cronHelpers';import { badge, INTERVAL_LABELS, INTERVAL_BADGE_VARIANT, PERPETUAL_BADGE_VARIANT, PERPETUAL_LABEL, PERPETUAL_DESCRIPTION, ON_DEMAND_PERPETUAL_LABEL, ON_DEMAND_PERPETUAL_DESCRIPTION } from './scheduleConstants';/*** The cadence chip, plus a separate Perpetual chip when the task carries the* drain flag — the two are orthogonal, so a Scheduled + Perpetual task shows both.*/-export default function IntervalBadge({ type, cronExpression, perpetual, autoStart }) {+export default function IntervalBadge({ type, cronExpression, perpetual, autoStart, appSchedules }) {+ // An app can pin a cron on a task whose own row says "On Demand". The cadence+ // chip describes the GLOBAL row and would read as a flat contradiction of+ // what the task actually does, so the per-app cadences get a chip of their own.+ const perApp = summarizeAppSchedules(appSchedules);const automaticDrain = type === 'on-demand' && perpetual && autoStart !== false;const label = automaticDrain ? ON_DEMAND_PERPETUAL_LABEL : INTERVAL_LABELS[type] || type;const cronDesc = type === 'cron' && cronExpression ? describeCron(cronExpression) : null;@@ -21,6 +25,14 @@ export default function IntervalBadge({ type, cronExpression, perpetual, autoSta>{label}</span>+ {perApp && (+ <span+ className={`${badge('cyan')} whitespace-nowrap shrink-0`}+ title={`These apps run this task on their own cron, whatever the cadence above says:\n${perApp.detail}`}+ >+ {perApp.count} app schedule{perApp.count === 1 ? '' : 's'}+ </span>+ )}{perpetual && (<spanclassName={`${badge(PERPETUAL_BADGE_VARIANT)} whitespace-nowrap shrink-0`}diff --git a/client/src/components/cos/tabs/schedule/TaskHeader.jsx b/client/src/components/cos/tabs/schedule/TaskHeader.jsxindex 972a49800c..7c0bb3614b 100644--- a/client/src/components/cos/tabs/schedule/TaskHeader.jsx+++ b/client/src/components/cos/tabs/schedule/TaskHeader.jsx@@ -69,7 +69,7 @@ export default function TaskHeader({ taskType, config, orderStep }) {{stages.length}</span>)}- <IntervalBadge type={config.type} cronExpression={config.cronExpression} perpetual={config.perpetual} autoStart={config.autoStart} />+ <IntervalBadge type={config.type} cronExpression={config.cronExpression} perpetual={config.perpetual} autoStart={config.autoStart} appSchedules={config.appSchedules} /></div></div>{config.description && (diff --git a/client/src/components/cos/tabs/schedule/scheduleConstants.js b/client/src/components/cos/tabs/schedule/scheduleConstants.jsindex 7a73cc6552..8c774b5f79 100644--- a/client/src/components/cos/tabs/schedule/scheduleConstants.js+++ b/client/src/components/cos/tabs/schedule/scheduleConstants.js@@ -4,7 +4,7 @@ import {PUBLIC_REVIEW_NO_TOOL_POSTURE,} from '../../../../utils/providers';import { timeUntil } from '../../../../utils/formatters';-import { describeCron } from '../../../../utils/cronHelpers';+import { describeCron, summarizeAppSchedules } from '../../../../utils/cronHelpers';// The cadence model is two variants; `perpetual` is an orthogonal flag that// renders as its own badge alongside whichever one is selected.@@ -139,22 +139,44 @@ export const STATUS_GROUPS = {disabled: { label: 'Disabled', dot: 'bg-gray-600', order: 3 },};+/**+ * Whether nothing but a human pressing Run ever starts this task.+ *+ * Three things can start it without one: a cron of its own, a perpetual drain+ * that auto-starts, or an APP pinning its own cron on a task that is otherwise+ * on-demand. The Schedule card's status group and the Timeline's "unpinned"+ * bucket are the same question asked twice, so they ask it here — they used to+ * carry separate copies that already disagreed about `autoStart`.+ *+ * Takes the cadence fields rather than a whole task config, because the two+ * callers hold them at different depths (a Schedule config spreads them at the+ * top level; a Timeline node keeps them under `schedule`).+ */+export function isManualOnlyCadence({ type, perpetual, autoStart, appSchedules } = {}) {+ if (appSchedules?.length > 0) return false;+ return type === 'on-demand' && (!perpetual || autoStart === false);+}+// Classify a task config into one status group (mutually exclusive).-// Disabled wins over everything; then dependency-wait; then on-demand type — a-// perpetual on-demand task is "active" because its drain runs unattended.+// Disabled wins over everything; then dependency-wait; then cadence — a+// perpetual on-demand task is "active" because its drain runs unattended, and+// so is one whose apps pin their own cron: something launches it on a clock+// without anybody pressing Run, which is what this group means.export function getTaskStatusGroup(config) {if (!config?.enabled) return 'disabled';if (config.status?.reason === 'waiting-on-dependencies') return 'waiting';- if (config.type === 'on-demand' && (!config.perpetual || config.autoStart === false)) return 'on-demand';- return 'active';+ return isManualOnlyCadence(config) ? 'on-demand' : 'active';}export const statusDot = (group) => STATUS_GROUPS[group]?.dot || STATUS_GROUPS.disabled.dot;// Sort key for the card grid: group order first, then soonest next run, then name.+// A task with no global cadence still has a next run when one of its apps pins+// a cron, so fall back to that rather than sorting it last among Active.export function taskSortKey(taskType, config) {const group = getTaskStatusGroup(config);- const next = config?.status?.nextRunAt ? new Date(config.status.nextRunAt).getTime() : Infinity;+ const nextIso = config?.status?.nextRunAt || summarizeAppSchedules(config?.appSchedules)?.nextRunAt;+ const next = nextIso ? new Date(nextIso).getTime() : Infinity;return { order: STATUS_GROUPS[group]?.order ?? 9, next: Number.isFinite(next) ? next : Infinity, taskType };}@@ -273,8 +295,22 @@ export function describeNextRun(config) {}return { text: 'draining — runs back-to-back until done', tone: 'text-port-success' };}+ const perApp = summarizeAppSchedules(config.appSchedules);+ // An app that pins its own cron runs on a different clock from this row, so+ // the tooltip always names both rather than letting the row imply one.+ const appSuffix = perApp ? `\nScheduled per app:\n${perApp.detail}` : '';const next = config.status?.nextRunAt;const cronDesc = config.type === 'cron' && config.cronExpression ? describeCron(config.cronExpression) : null;+ // A task with no cadence of its own but a cron on one of its apps has a real+ // next run — it just belongs to the app, not to this row. Saying "Manual+ // trigger only" (what the on-demand group used to say) is simply wrong.+ if (perApp && !cronDesc) {+ return {+ text: perApp.nextRunAt ? `${timeUntil(perApp.nextRunAt, 'soon')} · ${perApp.label}` : perApp.label,+ tone: 'text-gray-300',+ title: `On demand globally;${appSuffix}`,+ };+ }const cronTitle = config.type === 'cron' && config.cronExpression? (cronDesc ? `${cronDesc} (${config.cronExpression})` : config.cronExpression): undefined;@@ -283,7 +319,7 @@ export function describeNextRun(config) {? (cronDesc ? `${timeUntil(next, 'soon')} · ${cronDesc}` : timeUntil(next, 'soon')): `${cronDesc || INTERVAL_LABELS[config.type] || config.type} — pending`,tone: 'text-gray-300',- title: cronTitle,+ title: `${cronTitle || ''}${appSuffix}`.trim() || undefined,};}diff --git a/client/src/components/cos/tabs/schedule/scheduleConstants.test.js b/client/src/components/cos/tabs/schedule/scheduleConstants.test.jsindex a87dd0212e..da58530777 100644--- a/client/src/components/cos/tabs/schedule/scheduleConstants.test.js+++ b/client/src/components/cos/tabs/schedule/scheduleConstants.test.js@@ -1,5 +1,5 @@import { describe, it, expect } from 'vitest';-import { getTaskStatusGroup, taskSortKey, TASK_FILTERS, STATUS_GROUPS, describeNextRun, coverageTone, setMetadataOverride, toggleMetadataField, fileIssuesEffective, managedAgentOptionsFor, toggleFileIssuesMetadata, prReviewerStageRole, stagePublicReviewPosture, togglePrReviewerActions, suggestedOrderSteps, compareBySuggestedOrder } from './scheduleConstants';+import { isManualOnlyCadence, getTaskStatusGroup, taskSortKey, TASK_FILTERS, STATUS_GROUPS, describeNextRun, coverageTone, setMetadataOverride, toggleMetadataField, fileIssuesEffective, managedAgentOptionsFor, toggleFileIssuesMetadata, prReviewerStageRole, stagePublicReviewPosture, togglePrReviewerActions, suggestedOrderSteps, compareBySuggestedOrder } from './scheduleConstants';describe('pr-reviewer pipeline helpers', () => {it('recognizes semantic roles and legacy prompt-key stages', () => {@@ -318,3 +318,78 @@ describe('suggestedOrderSteps', () => {expect(sorted.map(([taskType]) => taskType)).toEqual(['early', 'late', 'unranked']);});});++// A task can read "On Demand" on its global row while one of its apps runs it+// on a cron. Every surface that summarizes cadence has to say so — "Manual+// trigger only" is simply wrong for that task, and it filed under the wrong+// status group too.+describe('per-app schedules on a globally on-demand task', () => {+ const APP_CRON = [{ appId: 'acme', appName: 'Acme', cronExpression: '0 7 * * *', nextRunAt: '2999-01-01T07:00:00Z' }];++ it('counts as Active, not On-Demand — a clock launches it with nobody pressing Run', () => {+ expect(getTaskStatusGroup({ enabled: true, type: 'on-demand', appSchedules: APP_CRON })).toBe('active');+ expect(getTaskStatusGroup({ enabled: true, type: 'on-demand', appSchedules: [] })).toBe('on-demand');+ });++ it('still reads as Disabled or Waiting when those apply', () => {+ expect(getTaskStatusGroup({ enabled: false, type: 'on-demand', appSchedules: APP_CRON })).toBe('disabled');+ expect(getTaskStatusGroup({+ enabled: true, type: 'on-demand', appSchedules: APP_CRON, status: { reason: 'waiting-on-dependencies' },+ })).toBe('waiting');+ });++ it('describes the app cadence instead of "Manual trigger only"', () => {+ const out = describeNextRun({ enabled: true, type: 'on-demand', appSchedules: APP_CRON });+ expect(out.text).toContain('1 app · at 07:00');+ expect(out.text).not.toBe('Manual trigger only');+ expect(out.title).toContain('Acme — at 07:00 (0 7 * * *)');+ });++ it('names both clocks when the task has a cron of its own and an app overrides it', () => {+ const out = describeNextRun({+ enabled: true, type: 'cron', cronExpression: '0 9 * * *',+ status: { nextRunAt: '2999-01-01T09:00:00Z' },+ appSchedules: APP_CRON,+ });+ expect(out.text).toContain('at 09:00');+ expect(out.title).toContain('at 09:00 (0 9 * * *)');+ expect(out.title).toContain('Acme — at 07:00 (0 7 * * *)');+ });++ it('sorts by the app slot when the task itself has no next run', () => {+ const sorted = [+ ['later', { enabled: true, type: 'cron', status: { nextRunAt: '2999-01-02T00:00:00Z' } }],+ ['app-scheduled', { enabled: true, type: 'on-demand', appSchedules: APP_CRON }],+ ]+ .map(([taskType, config]) => taskSortKey(taskType, config))+ .sort((a, b) => a.next - b.next);+ expect(sorted[0].taskType).toBe('app-scheduled');+ });+});++// The Schedule card and the Timeline both ask "does anything but a human start+// this?" — they used to carry separate copies of the answer that disagreed+// about autoStart, so one page could show a track for a task the other filed+// as manual.+describe('isManualOnlyCadence', () => {+ it('is true only when nothing automatic can start the task', () => {+ expect(isManualOnlyCadence({ type: 'on-demand' })).toBe(true);+ expect(isManualOnlyCadence({ type: 'cron', cronExpression: '0 7 * * *' })).toBe(false);+ });++ it('treats a manual drain as manual and an auto-starting one as not', () => {+ expect(isManualOnlyCadence({ type: 'on-demand', perpetual: true, autoStart: false })).toBe(true);+ expect(isManualOnlyCadence({ type: 'on-demand', perpetual: true })).toBe(false);+ });++ it('is false as soon as one app pins its own cron, whatever the global row says', () => {+ const appSchedules = [{ appId: 'acme', cronExpression: '0 7 * * *' }];+ expect(isManualOnlyCadence({ type: 'on-demand', appSchedules })).toBe(false);+ expect(isManualOnlyCadence({ type: 'on-demand', perpetual: true, autoStart: false, appSchedules })).toBe(false);+ });++ it('answers for a missing or empty cadence without throwing', () => {+ expect(isManualOnlyCadence()).toBe(false);+ expect(isManualOnlyCadence({})).toBe(false);+ });+});diff --git a/client/src/utils/README.md b/client/src/utils/README.mdindex 2db0298032..3835e3e5d3 100644--- a/client/src/utils/README.md+++ b/client/src/utils/README.md@@ -23,7 +23,7 @@ grep -i "what you want to do" client/src/utils/README.md| Module | Purpose ||---|---|| `formatters` | Date/time/duration/byte formatters (`clamp`, `formatBytes`, `formatDownloadGb` (decimal-GB model download size, "~29 GB"), `formatCompactCount`, `formatCompactCountOrDash` (same, but an ABSENT count renders "—" rather than "0"), `formatCount` (thousands-separated EXACT count, "2,762" — for a total the user is meant to read as a number, where "2.8K" would throw away the precision that is the point of showing it), `timeAgo`, `formatAgeDays` (age in whole DAYS — "412 days ago" — where `timeAgo` would collapse to "1y ago"; model-download lists), `localDateKey` (browser-local `YYYY-MM-DD`), `shiftISODate` (DST-safe calendar-day shifts), `formatTimecode`, `formatDurationMs`, `formatDateShort`, `formatContextTokens` (suffix-less context length, "4K"), `throughputLabel` (a measured model's speed as one label — tok/s where the runtime reported token counts, `~` prefixed when frame-counted, else chars/s; never both), `parseTimeoutMs`, `formatCooldown`, `recommendedRamGb`, `nameFromImageFilename`, `formatUsd` — one USD renderer (`signed` puts the minus outside the `$`; `trimWhole` drops `.00` on a typed round price; thousands are grouped, "$4,610.09") — `formatWeight` / `formatPercent` — round unit-converted floats (`170.35000000000002` → `170.4 lbs`) so raw binary precision never reaches a tile — `middleTruncate` — clip a long string from the MIDDLE so its distinguishing tail survives, where CSS `line-clamp`/`text-overflow` always eats the end — …) plus timeout-input bounds and `getAppName`. Do not re-define formatters inside components. **Never write `new Date(x).toLocaleDateString()` inline** — pick the helper for the shape you want: `formatDateNumeric` ("3/5/2026", compact cells), `formatDateShort` ("Mar 5, 2026"), `formatDate` ("March 5, 2026"), `formatDateFull` ("Saturday, March 5, 2026"), `formatWeekdayDate` ("Monday, Mar 5", `{ weekday, year }`), `formatMonthDay` ("Mar 5"), `formatMonthYear` ("March 2026"), `formatWeekdayShort` ("Mon"), `formatWeekdayTime` ("Mon, 7:00 AM"), `formatTimeOfDay` ("1:30 PM"), `formatTimeOfDaySeconds` ("1:30:45 PM", log/queue rows), `formatClockTime` ("02:30:45 PM"; `{ seconds, hour12, timeZone }`), `formatDateTime`. `formatHourOfDay` renders a bare hour-of-day number (0-23) as a 12-hour label in one of four styles (`long` "3 PM", `compact` "3PM", `tiny` "3p", `lower` "3pm") — the canonical home for what five components each hand-rolled, so the same 3pm no longer renders four ways across screens. Date display helpers anchor a bare `YYYY-MM-DD` at LOCAL midnight (a naive `new Date('2026-03-05')` is UTC midnight and renders as the previous day west of Greenwich) and take a fallback instead of rendering the literal "Invalid Date". |-| `cronHelpers` | Cron preset list, friendly cron parsing/building, anchored recurrence parsing/building/description, `isCronExpression` detection, `describeCron` human-readable rendering, `cronFromIntervalMs` numeric-interval → expression conversion (mirrors the server helper), and `JOB_INTERVAL_OPTIONS` / `ON_DEMAND_INTERVAL` — the interval-mode cadences for autonomous jobs, derived from the server's `INTERVAL_OPTIONS` (`on-demand` = stays enabled and manually runnable, but arms no timer). Import it rather than re-declaring the list in a scheduling component. |+| `cronHelpers` | Cron preset list, friendly cron parsing/building, anchored recurrence parsing/building/description, `isCronExpression` detection, `describeCron` human-readable rendering, `cronFromIntervalMs` numeric-interval → expression conversion (mirrors the server helper), `summarizeAppSchedules` rendering of the per-app cron cadences a task's global row cannot express, and `JOB_INTERVAL_OPTIONS` / `ON_DEMAND_INTERVAL` — the interval-mode cadences for autonomous jobs, derived from the server's `INTERVAL_OPTIONS` (`on-demand` = stays enabled and manually runnable, but arms no timer). Import it rather than re-declaring the list in a scheduling component. || `markdownText` | `markdownToPlainText(md)` — flatten markdown source to one plain-text string for a clamped preview: strips heading/list/blockquote/fence markers, unwraps emphasis, inline code and links, images → `[alt]`, collapses blank-line runs. Use whenever a card previews arbitrary agent-authored markdown — `line-clamp-N` does not clamp a subtree of block elements, and foreign `##` headings would otherwise join the page's heading outline. Underscore emphasis is word-boundary gated and `__…__` needs interior whitespace, so stack frames and user-agent strings (`10_15_7`, `__init__`) are never silently rewritten. `dropsMarkupWhenFlattened(md)` — did the flatten lose actual markup, as opposed to only normalizing whitespace? Gates a "Show more" disclosure so a short-but-lossy body stays reachable without putting a toggle on every body that merely lost a trailing newline. || `timeWindow` | Time-of-day window math (`isInTimeWindow`, `timeStringToMinutes`) and morning-layout auto-switch helpers (`pickActiveLayoutId`, `recordManualLayoutPick`). || `timezone` | Timezone day-key helpers (`dayKeyInTimezone`, `todayKeyInTimezone`) — browser mirror of the server's `todayInTimezone`, so date-scoped POST surfaces derive "today" in the user's configured timezone and agree with the server (#2681). |diff --git a/client/src/utils/cronHelpers.js b/client/src/utils/cronHelpers.jsindex ba0bc80cbd..676393bb03 100644--- a/client/src/utils/cronHelpers.js+++ b/client/src/utils/cronHelpers.js@@ -285,6 +285,41 @@ export function describeCron(expr) {return segments.join(' ');}+/**+ * Summarize a task's `appSchedules` — the cron cadences that live on an APP+ * rather than on the task's global row (see `resolveHiddenAppSchedules` in+ * server/services/taskSchedule.js). A task can read "On Demand" globally while+ * one app runs it every morning, so every surface that describes a cadence has+ * to say so rather than calling the task manual-only.+ *+ * Returns `null` when there are none, else:+ * count how many apps carry a schedule of their own+ * label the short line for a cadence slot ("2 apps · at 07:00") — naming+ * the shared cadence, or just counting them when they differ+ * detail one "<app> — <cadence> (<expr>)" line per app, for a title/tooltip+ * nextRunAt soonest upcoming slot across those apps, or null+ */+export function summarizeAppSchedules(appSchedules) {+ const entries = (appSchedules || []).filter(entry => entry?.cronExpression);+ if (entries.length === 0) return null;+ const expressions = [...new Set(entries.map(entry => entry.cronExpression))];+ const cadence = expressions.length === 1+ ? (describeCron(expressions[0]) || expressions[0])+ : `${expressions.length} schedules`;+ const apps = `${entries.length} app${entries.length === 1 ? '' : 's'}`;+ // Sorted as ISO strings: lexical order IS chronological order for the+ // Z-suffixed instants the server sends, so no Date churn per entry.+ const nextRunAt = entries.map(entry => entry.nextRunAt).filter(Boolean).sort()[0] || null;+ return {+ count: entries.length,+ label: `${apps} · ${cadence}`,+ detail: entries+ .map(entry => `${entry.appName || entry.appId} — ${describeCron(entry.cronExpression) || entry.cronExpression} (${entry.cronExpression})`)+ .join('\n'),+ nextRunAt+ };+}+// Both autonomous-job pickers use the same vocabulary as server validation and// duration resolution. Keep the client projection's existing value/label shape.export const JOB_INTERVAL_OPTIONS = INTERVAL_OPTIONS.map(({ value, label }) => ({ value, label }));diff --git a/client/src/utils/cronHelpers.test.js b/client/src/utils/cronHelpers.test.jsindex 8d8bf2f1f2..76b3036d5f 100644--- a/client/src/utils/cronHelpers.test.js+++ b/client/src/utils/cronHelpers.test.js@@ -1,7 +1,7 @@import { describe, it, expect } from 'vitest';import {parseSimpleCron, buildWeeklyCron, describeCron, WEEKDAYS,- parseCronToRecurrence, buildCronFromRecurrence, describeRecurrence,+ parseCronToRecurrence, buildCronFromRecurrence, describeRecurrence, summarizeAppSchedules,} from './cronHelpers.js';describe('parseSimpleCron', () => {@@ -118,3 +118,41 @@ describe('calendar recurrence helpers', () => {});});// @vitest-environment node++describe('summarizeAppSchedules', () => {+ it('returns null when a task has no per-app cadences of its own', () => {+ expect(summarizeAppSchedules(undefined)).toBeNull();+ expect(summarizeAppSchedules([])).toBeNull();+ expect(summarizeAppSchedules([{ appId: 'acme' }])).toBeNull();+ });++ it('names the shared cadence when every app runs the same expression', () => {+ expect(summarizeAppSchedules([+ { appId: 'acme', appName: 'Acme', cronExpression: '0 7 * * *', nextRunAt: '2026-01-02T07:00:00Z' },+ { appId: 'beta', appName: 'Beta', cronExpression: '0 7 * * *', nextRunAt: '2026-01-01T07:00:00Z' },+ ])).toMatchObject({+ count: 2,+ label: '2 apps · at 07:00',+ // Soonest across the apps, not the first one listed.+ nextRunAt: '2026-01-01T07:00:00Z',+ });+ });++ it('counts the schedules rather than inventing one cadence when they differ', () => {+ const summary = summarizeAppSchedules([+ { appId: 'acme', appName: 'Acme', cronExpression: '0 7 * * *' },+ { appId: 'beta', appName: 'Beta', cronExpression: '30 18 * * 1' },+ ]);+ expect(summary.label).toBe('2 apps · 2 schedules');+ expect(summary.detail.split('\n')).toEqual([+ 'Acme — at 07:00 (0 7 * * *)',+ 'Beta — Mon at 18:30 (30 18 * * 1)',+ ]);+ expect(summary.nextRunAt).toBeNull();+ });++ it('falls back to the app id when the server sent no name', () => {+ expect(summarizeAppSchedules([{ appId: 'acme', cronExpression: '0 7 * * *' }]).detail)+ .toBe('acme — at 07:00 (0 7 * * *)');+ });+});diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.jsindex e89c2b59a8..d7b3eee7ff 100644--- a/server/services/taskSchedule.js+++ b/server/services/taskSchedule.js@@ -34,9 +34,9 @@ import {DEFAULT_PERPETUAL_RECHECK_MS,INTERVAL_TYPES,ON_DEMAND_ORIGINS,- decodeIntervalType,isCronExpression,- isUserOriginRequest+ isUserOriginRequest,+ resolveAppOverrideCadence} from './taskScheduleConstants.js';import {DEFAULT_TASK_INTERVALS,@@ -174,7 +174,6 @@ async function getPerformanceAdjustedInterval(taskType, baseIntervalMs) {// ============================================================// Unified getters/setters (replace split self/app functions)// ============================================================-export async function getTaskInterval(taskType) {const schedule = await loadSchedule();return schedule.tasks[taskType] || {@@ -772,8 +771,11 @@ async function checkRunAfterDeps(schedule, taskType, appId = null, featureEnableif (!depConfig || !depConfig.enabled) continue;if (!(await featureEnabled(depConfig))) continue;if (appId && !(await isTaskTypeEnabledForApp(appId, dep))) continue;- const depPerAppInterval = appId ? await getAppTaskTypeInterval(appId, dep) : null;- if ((depPerAppInterval || depConfig.type) === INTERVAL_TYPES.ON_DEMAND) continue;+ // Same resolver the readiness check uses, so a dependency an app pins to+ // its own cadence is judged on THAT cadence — an app-level cron on a+ // globally on-demand dep is a real gate, not a skippable manual task.+ const depInterval = appId ? await getAppTaskTypeInterval(appId, dep) : null;+ if (resolveAppOverrideCadence({ interval: depInterval }, depConfig).type === INTERVAL_TYPES.ON_DEMAND) continue;const depKey = `task:${dep}`;const depExec = schedule.executions[depKey] || { lastRun: null, perApp: {} };@@ -788,11 +790,16 @@ async function checkRunAfterDeps(schedule, taskType, appId = null, featureEnablereturn { satisfied: pending.length === 0, pending };}-async function evaluateTaskReadiness(taskType, appId, { featureEnabled, continuingPerpetualDrain }) {+async function evaluateTaskReadiness(taskType, appId, { featureEnabled, continuingPerpetualDrain, schedule: injected = null }) {if (appId && requiresInstallWideTarget(taskType)) {return { shouldRun: false, reason: 'requires-install-wide-target' };}- const schedule = await loadSchedule();+ // `loadSchedule` is an uncached disk read plus a merge over every shipped+ // task default, and a caller building ONE status payload asks this question+ // dozens of times against the snapshot it already holds. Reading it again per+ // question would be both slower and less coherent — a mid-loop write would+ // make the payload describe two different schedules.+ const schedule = injected || await loadSchedule();const interval = schedule.tasks[taskType];if (!interval || !interval.enabled) {@@ -820,22 +827,21 @@ async function evaluateTaskReadiness(taskType, appId, { featureEnabled, continui}}- // Determine effective interval type: per-app override takes precedence- const perAppInterval = appId ? await getAppTaskTypeInterval(appId, taskType) : null;- // A per-app numeric intervalMs override (used by handler-backed tasks like- // layered-intelligence, whose Intelligence-tab UI offers sub-daily cadences a- // named cadence never expressed). A legacy `interval: 'custom'` override- // decodes THIS value into the per-app cron expression below.- const perAppIntervalMs = appId ? await getAppTaskTypeIntervalMs(appId, taskType) : null;- // A per-app override may be a raw cron expression or a retired named cadence- // written by an older install; decode both onto the two-variant model.- const perAppDecoded = perAppInterval- ? decodeIntervalType(perAppInterval, { intervalMs: perAppIntervalMs })+ // Determine the effective cadence: the app's own override outranks the task's+ // global one. `resolveAppOverrideCadence` owns the decode (a raw cron+ // expression, a retired named cadence written by an older install, or the+ // numeric `intervalMs` handler-backed tasks like layered-intelligence use for+ // sub-daily slots), so every surface that has to PREDICT an app's cadence —+ // getScheduleStatus, the Schedule Timeline — resolves it exactly the way this+ // dispatch gate does.+ const [appInterval, appIntervalMs] = appId+ ? await Promise.all([getAppTaskTypeInterval(appId, taskType), getAppTaskTypeIntervalMs(appId, taskType)])+ : [null, null];+ const appCadence = appId+ ? resolveAppOverrideCadence({ interval: appInterval, intervalMs: appIntervalMs }, interval): null;- const effectiveType = perAppDecoded ? perAppDecoded.type : interval.type;- const effectiveCron = perAppDecoded- ? perAppDecoded.cronExpression- : (interval.cronExpression || null);+ const effectiveType = appCadence ? appCadence.type : interval.type;+ const effectiveCron = appCadence ? appCadence.cronExpression : (interval.cronExpression || null);// `perpetual` is a task-level global property — per-app rows override the// cadence only (see the issue's Out of Scope), so the global flag always wins.const isPerpetual = interval.perpetual === true;@@ -984,8 +990,8 @@ async function evaluateTaskReadiness(taskType, appId, { featureEnabled, continui/*** Check whether a task should initiate a scheduled run for an app or globally.*/-export async function shouldRunTask(taskType, appId = null, { featureEnabled = createFeatureGate() } = {}) {- return evaluateTaskReadiness(taskType, appId, { featureEnabled, continuingPerpetualDrain: false });+export async function shouldRunTask(taskType, appId = null, { featureEnabled = createFeatureGate(), schedule = null } = {}) {+ return evaluateTaskReadiness(taskType, appId, { featureEnabled, continuingPerpetualDrain: false, schedule });}/**@@ -1218,6 +1224,73 @@ export async function clearOnDemandRequest(requestId) {// Schedule Status// ============================================================++/**+ * The apps that run `taskType` on a cron of their OWN — enabled for the task,+ * and stating a cadence rather than inheriting the task's.+ *+ * Both callers that have to reason about an app-level clock start here:+ * `getUpcomingTasks` (which app boundary should wake the daemon) and+ * `resolveHiddenAppSchedules` (which schedules the UI cannot see on the global+ * row). They differ only in what they do with the result, so the override →+ * cadence walk lives here once.+ *+ * `allOverrides[i]` is the override map for `activeApps[i]`, in the caller's+ * own order; entries come back as `{ app, cronExpression }` in that order.+ */+function appsWithOwnCron(taskType, interval, activeApps, allOverrides) {+ const matched = [];+ for (let i = 0; i < activeApps.length; i++) {+ const override = allOverrides[i]?.[taskType];+ if (override?.enabled !== true) continue;+ const cadence = resolveAppOverrideCadence(override, interval);+ // An inheriting app rides the task's own cadence; only an app stating its+ // own cron adds a clock the global row does not already carry.+ if (cadence.inherited || cadence.type !== INTERVAL_TYPES.CRON) continue;+ if (!isCronExpression(cadence.cronExpression)) continue;+ matched.push({ app: activeApps[i], cronExpression: cadence.cronExpression.trim() });+ }+ return matched;+}++/**+ * The per-app cron cadences a task's GLOBAL row cannot express.+ *+ * Returns one entry per enabled app whose own override resolves to a valid cron+ * expression that differs from whatever the task runs on globally — the state+ * where a task left on-demand globally carries an app-level cron and therefore+ * read as "manual only" on every surface. Apps that inherit the global cadence, or that+ * restate the same expression, are omitted: they already sit on the global+ * track, and listing them would make "3 apps scheduled" mean two different+ * things depending on the task.+ *+ * `shouldRunTask` supplies each entry's next slot rather than a local cron+ * parse, so the time shown is the one dispatch would actually honor (per-app+ * last run, failure backoff, dependency gates and all).+ */+async function resolveHiddenAppSchedules(taskType, interval, activeApps, allOverrides, featureEnabled, schedule) {+ const globalCron = interval.type === INTERVAL_TYPES.CRON && isCronExpression(interval.cronExpression)+ ? interval.cronExpression.trim()+ : null;+ // An app restating the task's own expression sits on the global track+ // already; counting it would make "N apps scheduled" mean something+ // different per task.+ const candidates = appsWithOwnCron(taskType, interval, activeApps, allOverrides)+ .filter(candidate => candidate.cronExpression !== globalCron);+ if (candidates.length === 0) return [];++ const checks = await mapWithConcurrency(candidates, 8, ({ app }) =>+ shouldRunTask(taskType, app.id, { featureEnabled, schedule }).catch(() => null));+ return candidates.map(({ app, cronExpression }, i) => ({+ appId: app.id,+ appName: app.name || app.id,+ cronExpression,+ nextRunAt: checks[i]?.nextRunAt || null,+ shouldRun: checks[i]?.shouldRun === true,+ reason: checks[i]?.reason || null,+ missedSlot: checks[i]?.missedSlot || null+ }));+}export async function getScheduleStatus() {// Surface the master Improve toggle so the UI can disable Run Now affordancesconst [schedule, state] = await Promise.all([loadSchedule(), loadState()]);@@ -1251,7 +1324,7 @@ export async function getScheduleStatus() {const learningInfo = await getPerformanceAdjustedInterval(taskType, baseInterval);// Check global shouldRun status- const check = await shouldRunTask(taskType, null, { featureEnabled });+ const check = await shouldRunTask(taskType, null, { featureEnabled, schedule });const isEnabledForApp = (override) => override?.enabled === true;const appOverrides = {};@@ -1277,6 +1350,16 @@ export async function getScheduleStatus() {}}+ // Cadences that are INVISIBLE from the global row: an enabled app pinning a+ // cron expression the task itself does not carry. The reported case is a+ // task left 'on-demand' globally while one app schedules it — the app is+ // genuinely clock-driven, so a Schedule card reading "Manual trigger only"+ // and a Timeline filing it under "no clock time" are both wrong.+ // An app that inherits, or that restates the global expression, adds+ // nothing to show and is left out so the count answers "how many apps run+ // this on a schedule you can't see here".+ const appSchedules = await resolveHiddenAppSchedules(taskType, interval, activeApps, allOverrides, featureEnabled, schedule);+const taskStatus = {...interval,...getAuditScheduleMetadata(taskType),@@ -1301,6 +1384,7 @@ export async function getScheduleStatus() {appOverrides,enabledAppCount,totalAppCount,+ appSchedules,status: check,learningAdjusted: learningInfo.adjusted,learningMultiplier: learningInfo.multiplier,@@ -1473,12 +1557,10 @@ export async function getUpcomingTasks(limit = 10) {// run. A due app makes the task ready; otherwise the soonest app boundary// is the wake-up deadline. This also handles a globally on-demand task that// has no global candidate but is cron-scheduled for one managed app.- const scheduledApps = activeApps.filter((app, index) => {- const override = activeAppOverrides[index]?.[taskType];- if (override?.enabled !== true) return false;- const decoded = decodeIntervalType(override.interval, { intervalMs: override.intervalMs });- return decoded.type === INTERVAL_TYPES.CRON && isCronExpression(decoded.cronExpression);- });+ // An inheriting app rides the global `check` above; only an app stating its+ // OWN cron adds a boundary the global cadence cannot see.+ const scheduledApps = appsWithOwnCron(taskType, interval, activeApps, activeAppOverrides)+ .map(candidate => candidate.app);const appChecks = scheduledApps.length > 0? await mapWithConcurrency(scheduledApps, 8, (app) =>shouldRunTask(taskType, app.id, { featureEnabled }).catch(() => null))diff --git a/server/services/taskSchedule.test.js b/server/services/taskSchedule.test.jsindex c97ba37bd2..52fcb5a168 100644--- a/server/services/taskSchedule.test.js+++ b/server/services/taskSchedule.test.js@@ -2713,6 +2713,87 @@ describe('taskSchedule', () => {})})+ describe('getScheduleStatus — appSchedules', () => {+ // vi.clearAllMocks() keeps a mockResolvedValue, so these cases restore the+ // apps.js factory defaults rather than leaking an app roster into the+ // suites that follow.+ afterEach(() => {+ vi.useRealTimers()+ isTaskTypeEnabledForApp.mockResolvedValue(true)+ getAppTaskTypeInterval.mockResolvedValue(null)+ getActiveApps.mockResolvedValue([])+ getAppTaskTypeOverrides.mockResolvedValue({})+ })++ const withRealCron = async () => {+ vi.useFakeTimers()+ vi.setSystemTime(new Date('2026-01-01T16:00:00Z')) // 08:00 in the mocked America/Los_Angeles zone+ const actual = await vi.importActual('./eventScheduler.js')+ const actualTimezone = await vi.importActual('../lib/timezone.js')+ parseCronToNextRun.mockImplementation(actual.parseCronToNextRun)+ getLocalParts.mockImplementation(actualTimezone.getLocalParts)+ }++ // The reported bug: a task left on-demand globally while one app puts it+ // on a cron read as "manual trigger only" everywhere, and the Schedule+ // Timeline dropped it into the unpinned bucket.+ it('lists an app cron on a task that is on-demand globally, with that app\'s next slot', async () => {+ await withRealCron()+ getActiveApps.mockResolvedValue([{ id: 'app-1', name: 'Acme' }])+ isTaskTypeEnabledForApp.mockResolvedValue(true)+ getAppTaskTypeInterval.mockResolvedValue('15 9 * * *')+ getAppTaskTypeOverrides.mockResolvedValue({ 'release-check': { enabled: true, interval: '15 9 * * *' } })+ mockSchedule({ tasks: { 'release-check': { type: 'on-demand', enabled: true, runAfter: [] } } })++ const status = await getScheduleStatus()+ expect(status.tasks['release-check'].appSchedules).toEqual([{+ appId: 'app-1',+ appName: 'Acme',+ cronExpression: '15 9 * * *',+ nextRunAt: '2026-01-01T17:15:00.000Z',+ shouldRun: false,+ reason: 'cron-cooldown',+ missedSlot: null+ }])+ })++ it('omits an app that merely inherits the global cadence', async () => {+ await withRealCron()+ getActiveApps.mockResolvedValue([{ id: 'app-1', name: 'Acme' }])+ isTaskTypeEnabledForApp.mockResolvedValue(true)+ getAppTaskTypeInterval.mockResolvedValue(null)+ getAppTaskTypeOverrides.mockResolvedValue({ 'release-check': { enabled: true } })+ mockSchedule({ tasks: { 'release-check': { type: 'cron', cronExpression: '15 9 * * *', enabled: true, runAfter: [] } } })++ expect((await getScheduleStatus()).tasks['release-check'].appSchedules).toEqual([])+ })++ // An app restating the task's own expression adds no schedule the global+ // row cannot already show, so counting it would make "N apps scheduled"+ // mean something different per task.+ it('omits an app that restates the global expression', async () => {+ await withRealCron()+ getActiveApps.mockResolvedValue([{ id: 'app-1', name: 'Acme' }])+ isTaskTypeEnabledForApp.mockResolvedValue(true)+ getAppTaskTypeInterval.mockResolvedValue('15 9 * * *')+ getAppTaskTypeOverrides.mockResolvedValue({ 'release-check': { enabled: true, interval: '15 9 * * *' } })+ mockSchedule({ tasks: { 'release-check': { type: 'cron', cronExpression: '15 9 * * *', enabled: true, runAfter: [] } } })++ expect((await getScheduleStatus()).tasks['release-check'].appSchedules).toEqual([])+ })++ it('omits an app that is disabled for the task', async () => {+ await withRealCron()+ getActiveApps.mockResolvedValue([{ id: 'app-1', name: 'Acme' }])+ isTaskTypeEnabledForApp.mockResolvedValue(false)+ getAppTaskTypeInterval.mockResolvedValue('15 9 * * *')+ getAppTaskTypeOverrides.mockResolvedValue({ 'release-check': { enabled: false, interval: '15 9 * * *' } })+ mockSchedule({ tasks: { 'release-check': { type: 'on-demand', enabled: true, runAfter: [] } } })++ expect((await getScheduleStatus()).tasks['release-check'].appSchedules).toEqual([])+ })+ })+describe('parkPerpetual / perpetual park state', () => {it('parkPerpetual stamps parkedUntil + reason on the per-app record', async () => {mockSchedule({ tasks: { 'claim-issue': { type: 'on-demand', perpetual: true, enabled: true, recheckIntervalMs: 3600000 } } })diff --git a/server/services/taskScheduleConstants.js b/server/services/taskScheduleConstants.jsindex e7e2c4f53a..947a1c8ffd 100644--- a/server/services/taskScheduleConstants.js+++ b/server/services/taskScheduleConstants.js@@ -160,3 +160,26 @@ export function normalizeIntervalConfig(config) {}return changed;}++/**+ * Resolve the cadence ONE app actually runs a task on.+ *+ * An app's `taskTypeOverrides[taskType].interval` outranks the task's global+ * cadence — including the case that reads as a contradiction: a task left+ * `on-demand` globally while one app pins a cron expression. That app IS+ * clock-scheduled, and anything reading only the global row (the Schedule+ * card, the Schedule Timeline) would otherwise call it "manual trigger only".+ *+ * `inherited: true` means the app stated no cadence of its own and simply runs+ * the global one, so callers surfacing "schedules you cannot see from the+ * global row" skip it. Enablement is NOT checked here — a disabled app is the+ * caller's own rung (`shouldRunTask` answers 'disabled-for-app').+ */+export function resolveAppOverrideCadence(override, interval = {}) {+ const decoded = override?.interval+ ? decodeIntervalType(override.interval, { intervalMs: override.intervalMs ?? null })+ : null;+ return decoded+ ? { type: decoded.type, cronExpression: decoded.cronExpression, inherited: false }+ : { type: interval.type, cronExpression: interval.cronExpression || null, inherited: true };+}diff --git a/server/services/workflow.js b/server/services/workflow.jsindex 70c68ef1b5..be228bc842 100644--- a/server/services/workflow.js+++ b/server/services/workflow.js@@ -24,6 +24,7 @@import { getScheduleStatus } from './taskSchedule.js';import { DEFAULT_PERPETUAL_RECHECK_MS } from './taskScheduleConstants.js';import { AUDIT_TASK_TYPES } from '../lib/auditCatalog.js';+import { dedupeByKey } from '../lib/arrayUtils.js';import * as autonomousJobs from './autonomousJobs.js';import { checkJobGate, hasGate, getRegisteredGates } from './jobGates.js';import { parseCronToNextRun, parseRecurrenceToNextRun } from './eventScheduler.js';@@ -200,6 +201,11 @@ export async function getWorkflowGraph({ horizonHours = 24, from = new Date() }appOverrides: info.appOverrides || {},enabledAppCount: info.enabledAppCount || 0,totalAppCount: info.totalAppCount || 0,+ // Cron cadences that live on an APP rather than on this task's global+ // row — most visibly a task left on-demand globally that one app puts on+ // a clock. Those launches are real, so the timeline projects them below+ // and the UI must not file the track under "no clock time".+ appSchedules: Array.isArray(info.appSchedules) ? info.appSchedules : [],taskMetadata: info.taskMetadata || null,managedAgentOptions: info.managedAgentOptions || null,// The task's provider/model pin — the per-app rows render their@@ -302,60 +308,13 @@ export function projectWorkflowTimeline(nodes, { start, end, timezone = 'UTC' })const windows = [];for (const node of nodes.filter(item => item.enabled)) {- const schedule = node.schedule || {};- if (node.kind === 'task' && schedule.type === 'on-demand' && schedule.autoStart === false) continue;- if (node.kind === 'task' && schedule.perpetual) {- projectPerpetual(node, startMs, endMs, timezone, occurrences, windows);- continue;- }-- if (schedule.cronSchedule) {- const dueNow = isRecurrenceDueNow(node, schedule.cronSchedule, startMs, timezone);- if (dueNow) {- occurrences.push(makeOccurrence(node, startMs, 'launch', dueNowExtra(node)));- }- appendRecurrenceOccurrences({- node,- rule: schedule.cronSchedule,- startMs,- endMs,- timezone,- target: occurrences,- kind: 'launch',- skipStart: dueNow- });- continue;- }-- if (schedule.cronExpression) {- const dueNow = isCronDueNow(node, schedule.cronExpression, startMs, timezone);- if (dueNow) {- occurrences.push(makeOccurrence(node, startMs, 'launch', dueNowExtra(node)));- }- // When a due-now marker was emitted, start the projection strictly after- // startMs so a cron slot landing exactly on the current minute doesn't- // produce a duplicate occurrence id at the same instant.- appendCronOccurrences({- node,- expression: schedule.cronExpression,- startMs,- endMs,- timezone,- target: occurrences,- kind: 'launch',- skipStart: dueNow- });- continue;- }-- if (node.kind === 'job') {- projectIntervalJob(node, startMs, endMs, timezone, occurrences);- continue;- }-- // Anything left is an on-demand task (or a cron task with an unusable- // expression): the scheduler promises it no wall-clock position, so it gets- // neither an occurrence nor a window.+ // Collected per node so the global cadence and any per-app schedules can be+ // reconciled before they reach the shared list — two sources landing on the+ // same instant are ONE launch, not a stack of identical markers.+ const nodeOccurrences = [];+ projectGlobalCadence(node, startMs, endMs, timezone, nodeOccurrences, windows);+ appendAppScheduleOccurrences(node, startMs, endMs, timezone, nodeOccurrences);+ occurrences.push(...mergeOccurrences(nodeOccurrences));}occurrences.sort((a, b) => new Date(a.at) - new Date(b.at) || a.nodeId.localeCompare(b.nodeId));@@ -370,6 +329,135 @@ export function projectWorkflowTimeline(nodes, { start, end, timezone = 'UTC' })};}+/**+ * Project the cadence the task/job itself declares — its global row. A task an+ * app schedules on its own is handled separately by appendAppScheduleOccurrences,+ * so this returning empty no longer means "nothing runs".+ */+function projectGlobalCadence(node, startMs, endMs, timezone, occurrences, windows) {+ const schedule = node.schedule || {};+ if (node.kind === 'task' && schedule.type === 'on-demand' && schedule.autoStart === false) return;+ if (node.kind === 'task' && schedule.perpetual) {+ projectPerpetual(node, startMs, endMs, timezone, occurrences, windows);+ return;+ }++ if (schedule.cronSchedule) {+ const dueNow = isRecurrenceDueNow(node, schedule.cronSchedule, startMs, timezone);+ if (dueNow) {+ occurrences.push(makeOccurrence(node, startMs, 'launch', nodeDueNow(node)));+ }+ appendRecurrenceOccurrences({+ node,+ rule: schedule.cronSchedule,+ startMs,+ endMs,+ timezone,+ target: occurrences,+ kind: 'launch',+ skipStart: dueNow+ });+ return;+ }++ if (schedule.cronExpression) {+ const dueNow = isCronDueNow(node, schedule.cronExpression, startMs, timezone);+ if (dueNow) {+ occurrences.push(makeOccurrence(node, startMs, 'launch', nodeDueNow(node)));+ }+ // When a due-now marker was emitted, start the projection strictly after+ // startMs so a cron slot landing exactly on the current minute doesn't+ // produce a duplicate occurrence id at the same instant.+ appendCronOccurrences({+ node,+ expression: schedule.cronExpression,+ startMs,+ endMs,+ timezone,+ target: occurrences,+ kind: 'launch',+ skipStart: dueNow+ });+ return;+ }++ if (node.kind === 'job') {+ projectIntervalJob(node, startMs, endMs, timezone, occurrences);+ return;+ }++ // Anything left is an on-demand task (or a cron task with an unusable+ // expression): its GLOBAL row promises no wall-clock position. Per-app+ // schedules, if any, are added by the caller.+}++/**+ * Project the cron cadences apps pin for themselves (`node.appSchedules`) —+ * the launches that exist nowhere on the task's global row. Without these, a+ * task left on-demand globally but scheduled by one app draws an empty track+ * and reads as "never runs on a clock", which is the opposite of the truth.+ *+ * Apps sharing one expression share one marker: the track answers "when does+ * this task launch", and five identical squares stacked at 07:00 answer it+ * worse than one square labelled with five apps.+ */+function appendAppScheduleOccurrences(node, startMs, endMs, timezone, target) {+ const schedules = node.kind === 'task' && Array.isArray(node.appSchedules) ? node.appSchedules : [];+ if (schedules.length === 0) return;++ const byExpression = new Map();+ for (const entry of schedules) {+ if (!entry?.cronExpression) continue;+ if (!byExpression.has(entry.cronExpression)) byExpression.set(entry.cronExpression, []);+ byExpression.get(entry.cronExpression).push(entry);+ }++ for (const [expression, entries] of byExpression) {+ // Due-now is per APP (each carries its own last run and backoff), so the+ // marker at Now names only the apps actually due and borrows that app's+ // reason rather than the task's global one.+ const due = entries.filter(entry => entry.shouldRun);+ if (due.length > 0) {+ target.push(makeOccurrence(node, startMs, 'launch', dueNowExtra(due[0], { apps: due.map(entry => entry.appId) })));+ }+ appendCronOccurrences({+ node,+ expression,+ startMs,+ endMs,+ timezone,+ target,+ kind: 'launch',+ skipStart: due.length > 0,+ extra: { apps: entries.map(entry => entry.appId) }+ });+ }+}++/**+ * Collapse occurrences that land on the same instant for one node. Two sources+ * can produce a launch there: the global cadence and an app override sharing+ * its slot, or two apps on the same cron. A marker from the global cadence+ * carries no app list, so merging one in drops the list rather than naming a+ * misleading subset of the apps the launch covers.+ */+function mergeOccurrences(items) {+ // `pick` folds the two rather than choosing one, which is a superset of what+ // dedupeByKey's survivor contract asks for — the id is the instant, so both+ // sides describe the same launch and dropping either would lose a state.+ return dedupeByKey(items, item => item.id, (held, item) => {+ const merged = { ...held };+ if (held.apps && item.apps) merged.apps = [...new Set([...held.apps, ...item.apps])];+ else delete merged.apps;+ if (item.dueNow && !held.dueNow) {+ merged.dueNow = true;+ merged.reason = item.reason ?? null;+ merged.missedSlot = item.missedSlot ?? null;+ }+ return merged;+ });+}+function appendRecurrenceOccurrences({ node, rule, startMs, endMs, timezone, target, kind, skipStart = false }) {let cursor = new Date(skipStart ? startMs : startMs - 60_000);const searchBound = new Date(endMs);@@ -383,7 +471,7 @@ function appendRecurrenceOccurrences({ node, rule, startMs, endMs, timezone, tar}}-function appendCronOccurrences({ node, expression, startMs, endMs, timezone, target, kind, skipStart = false }) {+function appendCronOccurrences({ node, expression, startMs, endMs, timezone, target, kind, skipStart = false, extra = {} }) {// parseCronToNextRun searches strictly after its cursor, so startMs - 60s// makes a slot exactly at startMs eligible (unless the caller already// emitted a due-now marker there — skipStart).@@ -403,7 +491,7 @@ function appendCronOccurrences({ node, expression, startMs, endMs, timezone, tar// shouldRunTask refuses weekday-only tasks on weekends regardless of the// schedule type, so weekend cron slots would never actually dispatch.if (next.getTime() >= startMs && isAllowedWeekday(node, next.getTime(), timezone)) {- target.push(makeOccurrence(node, next.getTime(), kind));+ target.push(makeOccurrence(node, next.getTime(), kind, extra));}cursor = next;}@@ -486,7 +574,7 @@ function projectIntervalJob(node, startMs, endMs, timezone, occurrences) {let nextMs = Number.isFinite(lastRunMs) ? lastRunMs + cadence : startMs;const timeMatch = String(node.schedule?.scheduledTime || '').match(/^([01]\d|2[0-3]):([0-5]\d)$/);if (isIntervalJobDueNow(node, startMs, timezone)) {- occurrences.push(makeOccurrence(node, startMs, 'launch', dueNowExtra(node)));+ occurrences.push(makeOccurrence(node, startMs, 'launch', nodeDueNow(node)));nextMs = startMs + cadence;}// Fast-forward a stale anchor (lastRun many cadences ago but not due right@@ -579,10 +667,15 @@ function makeOccurrence(node, atMs, kind, extra = {}) {// because a cadence slot happens to land now. Tag it so the UI can distinguish// it from an on-cadence launch (a NOW marker next to "Sun at 07:00" otherwise// reads as a bug). Future cadence slots never carry this flag.-function dueNowExtra(node) {- return { dueNow: true, reason: node?.runReason || null, missedSlot: node?.missedSlot || null };+function dueNowExtra({ reason = null, missedSlot = null } = {}, extra = {}) {+ return { dueNow: true, reason: reason || null, missedSlot: missedSlot || null, ...extra };}+// A node's global cadence reports its due-now reason on the node itself; a+// per-app one reports it on the app's own schedule entry. Same shape, two+// sources — named so the call sites read as "why is THIS due".+const nodeDueNow = node => dueNowExtra({ reason: node?.runReason, missedSlot: node?.missedSlot });+function findCollisionOccurrenceIds(occurrences) {const ids = new Set();const launches = occurrences.filter(item => item.kind === 'launch');diff --git a/server/services/workflow.test.js b/server/services/workflow.test.jsindex fa49267cd7..828565219c 100644--- a/server/services/workflow.test.js+++ b/server/services/workflow.test.js@@ -383,6 +383,73 @@ describe('projectWorkflowTimeline', () => {]);});+ // A task left on-demand globally while one managed app pins a cron is the+ // shape that fell off this page entirely: the global row promises no clock+ // time, so the projection skipped it and the UI filed it under "unpinned".+ it('projects the cron an app pins on a task that is on-demand globally', () => {+ const timeline = projectWorkflowTimeline([{+ id: 'task:audit', kind: 'task', enabled: true,+ schedule: { type: 'on-demand' },+ appSchedules: [{ appId: 'acme', appName: 'Acme', cronExpression: '30 9 * * *' }]+ }], range);++ expect(timeline.occurrences).toEqual([+ expect.objectContaining({ nodeId: 'task:audit', at: '2026-07-09T16:30:00.000Z', kind: 'launch', apps: ['acme'] })+ ]);+ });++ it('draws one marker for several apps sharing an expression, and keeps a differing one separate', () => {+ const timeline = projectWorkflowTimeline([{+ id: 'task:audit', kind: 'task', enabled: true,+ schedule: { type: 'on-demand' },+ appSchedules: [+ { appId: 'acme', cronExpression: '30 9 * * *' },+ { appId: 'beta', cronExpression: '30 9 * * *' },+ { appId: 'gamma', cronExpression: '0 13 * * *' }+ ]+ }], range);++ expect(timeline.occurrences.map(item => [item.at, item.apps])).toEqual([+ ['2026-07-09T16:30:00.000Z', ['acme', 'beta']],+ ['2026-07-09T20:00:00.000Z', ['gamma']]+ ]);+ });++ // The global cadence covers every app that has not opted out, so a launch it+ // already draws must not be narrowed to the one app that restated the slot.+ it('merges an app slot that coincides with the global cadence into one app-agnostic launch', () => {+ const timeline = projectWorkflowTimeline([{+ id: 'task:audit', kind: 'task', enabled: true,+ schedule: { type: 'cron', cronExpression: '30 9 * * *' },+ appSchedules: [{ appId: 'acme', cronExpression: '30 9,17 * * *' }]+ }], range);++ // 17:30 local is the app-only slot; 09:30 local is the shared one.+ expect(timeline.occurrences).toHaveLength(2);+ expect(timeline.occurrences[0]).toMatchObject({ at: '2026-07-09T00:30:00.000Z', apps: ['acme'] });+ expect(timeline.occurrences[1]).toMatchObject({ at: '2026-07-09T16:30:00.000Z' });+ expect(timeline.occurrences[1].apps).toBeUndefined();+ });++ it('marks an app whose own schedule is already due at Now, using that app\'s reason', () => {+ const timeline = projectWorkflowTimeline([{+ id: 'task:audit', kind: 'task', enabled: true,+ // The GLOBAL row is not due — only the app is, which is exactly the+ // state a node-level dueNow flag would have gotten wrong.+ shouldRun: false, runReason: null,+ schedule: { type: 'on-demand' },+ appSchedules: [{ appId: 'acme', cronExpression: '30 9 * * *', shouldRun: true, reason: 'cron-catch-up', missedSlot: '2026-07-08T16:30:00.000Z' }]+ }], range);++ expect(timeline.occurrences[0]).toMatchObject({+ at: '2026-07-09T00:00:00.000Z',+ dueNow: true,+ reason: 'cron-catch-up',+ missedSlot: '2026-07-08T16:30:00.000Z',+ apps: ['acme']+ });+ });+it('does not double up a recurrence that lands inside the in-progress drain bar', () => {const timeline = projectWorkflowTimeline([{id: 'task:drain', kind: 'task', enabled: true, shouldRun: true,