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

Show per-app scheduled-task overrides inline in the CoS Timeline

[._.]/ Adam Eivy9cd3744fe628
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 85fadf1c79..b60ea4296a 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -24,6 +24,8 @@
## Features
+- **The CoS Schedule Timeline can now expand each task track to see and edit its per-app overrides inline.** Which apps run a given scheduled task type (and each app's interval / agent-option / issue-author / swarm overrides) was previously only visible on the Schedule tab's per-task drawer — the Timeline showed the task cadence but not who it runs for. Every task row now carries a chevron that expands to the same `PerAppOverrideList` used on the Schedule tab (enable/disable per app, "Enable/Disable All", per-app interval and metadata), plus an `enabled/total` app-count badge on the row so an at-a-glance "3/5 apps" is visible without expanding. Edits save through the existing per-app override endpoints and refresh the timeline in place. System-job tracks (which are not per-app) show no expand toggle. The timeline graph node now forwards the `appOverrides`/`enabledAppCount`/`totalAppCount` plus the global `taskMetadata`/`managedAgentOptions` defaults that `getScheduleStatus` already computes; no migration needed (read-only surfacing of existing data).
+
- **Layered Intelligence now evaluates a managed app against its OWN goals and performance — not PortOS's agent telemetry.** Running the loop on a managed app previously fed it the PortOS install's global autonomous-agent run stats (`data/cos/learning.json`) as the "CoS metrics" source — which is on by default for every app — so a managed-app run reasoned over PortOS's tooling performance instead of the app's own product performance. Two changes fix this: (1) a new **App metrics (METRICS.md)** telemetry source, on by default for every app, reads a repo-root `METRICS.md` from the app (same as `GOALS.md`/`PLAN.md`) — the place an app documents how it measures success (user-success KPIs, production telemetry, where its data lives, and read-only queries an agent can run); and (2) the **CoS metrics** source now defaults **on only for the PortOS install** (where the agent stats genuinely are its own-performance metric) and **off for managed apps** (where they're a tooling/interaction signal, still opt-in). The reasoning prompt is reframed around "how is THIS app performing against its own goals and purpose," and when a managed app exposes no own-performance metrics the loop is nudged to propose adding a `METRICS.md` as an `app-data-gap`. New standard documented in [`docs/METRICS.md`](../docs/METRICS.md); apps can also wire a custom `cmd`/`http` source to feed live numbers into each run. Back-compat: these are default changes only — any explicitly-stored source toggle is preserved, so no migration is needed.
- **Grok is now selectable as a Review Loop code reviewer.** The reviewer picker (AI Providers → Code Review Defaults, plus the per-task task form and the per-task-type Schedule config) gains a **Grok** option alongside Claude, Codex, and Antigravity. Selecting it adds `grok` to slashdo's `--review-with` list, and the review-loop follow-up agent invokes the Grok Build CLI (`grok`) headless against the PR diff — the same CLI-reviewer path the other coding-agent reviewers use (it already routed any non-Copilot/non-local-LLM reviewer generically). New enum value `grok` in `REVIEWER_VALUES` (mirrored in the client `REVIEWER_OPTIONS`); no migration needed (absent from a stored list = not selected, and the default reviewer stays `copilot`).
diff --git a/client/src/components/cos/tabs/ScheduleTab.jsx b/client/src/components/cos/tabs/ScheduleTab.jsx
index 98ef529016..dfe3e879bf 100644
--- a/client/src/components/cos/tabs/ScheduleTab.jsx
+++ b/client/src/components/cos/tabs/ScheduleTab.jsx
@@ -6,6 +6,7 @@ import * as api from '../../../services/api';
import { formatDateTime } from '../../../utils/formatters';
import Banner from '../../ui/Banner';
import { CodeReviewDefaultsProvider } from '../../../hooks/useCodeReviewDefaults';
+import { useAppOverrideActions } from '../../../hooks/useAppOverrideActions';
import AppTaskTypeSection from './schedule/AppTaskTypeSection';
import TaskConfigDrawer from './schedule/TaskConfigDrawer';
import { TASK_FILTERS, DEFAULT_FILTER_ID } from './schedule/scheduleConstants';
@@ -85,28 +86,7 @@ export default function ScheduleTab({ apps }) {
const handleTriggerAppImprovement = (taskType, appId) => handleTriggerTask(taskType, appId);
- const handleUpdateAppOverride = async (appId, taskType, { enabled, interval, taskMetadata }) => {
- const result = await api.updateAppTaskTypeOverride(appId, taskType, { enabled, interval, taskMetadata }, { silent: true }).catch(err => {
- toast.error(err.message);
- return null;
- });
- if (result?.success) {
- const appName = apps?.find(a => a.id === appId)?.name || appId;
- toast.success(`Updated ${taskType} override for ${appName}`);
- fetchSchedule();
- }
- };
-
- const handleBulkToggleOverride = async (taskType, enabled) => {
- const result = await api.bulkUpdateAppTaskTypeOverride(taskType, { enabled }, { silent: true }).catch(err => {
- toast.error(err.message);
- return null;
- });
- if (result?.success) {
- toast.success(`${enabled ? 'Enabled' : 'Disabled'} ${taskType} for all apps`);
- fetchSchedule();
- }
- };
+ const { handleUpdateOverride, handleBulkToggleOverride } = useAppOverrideActions(apps, fetchSchedule);
if (loading) {
return (
@@ -197,7 +177,7 @@ export default function ScheduleTab({ apps }) {
onReset={handleResetTask}
providers={providers}
apps={apps}
- onUpdateOverride={handleUpdateAppOverride}
+ onUpdateOverride={handleUpdateOverride}
onBulkToggleOverride={handleBulkToggleOverride}
allTaskTypes={allTaskTypes}
improvementDisabled={improvementDisabled}
diff --git a/client/src/components/cos/tabs/WorkflowTab.jsx b/client/src/components/cos/tabs/WorkflowTab.jsx
index 500fdc3dd9..36b926f217 100644
--- a/client/src/components/cos/tabs/WorkflowTab.jsx
+++ b/client/src/components/cos/tabs/WorkflowTab.jsx
@@ -1,9 +1,11 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useSearchParams } from 'react-router-dom';
-import { AlertTriangle, ArrowRight, Bot, CalendarDays, Clock3, GitBranch, Infinity as InfinityIcon, RefreshCw, RotateCcw, TimerReset, Workflow } from 'lucide-react';
+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 } from '../../../utils/cronHelpers';
import ScheduleEditor from './workflow/ScheduleEditor';
+import PerAppOverrideList from './schedule/PerAppOverrideList';
const TRACK_COLORS = {
cron: { marker: 'bg-purple-400', text: 'text-purple-300', wash: 'bg-purple-500/10' },
@@ -99,54 +101,100 @@ function TrackGrid({ divisions }) {
));
}
-function TimelineRow({ node, occurrences, windows, timeline, hours, timezone, selected, onSelect }) {
+function TimelineRow({ node, occurrences, windows, timeline, hours, timezone, selected, apps, expanded, onSelect, onToggleExpand, onUpdateOverride, onBulkToggleOverride }) {
const palette = trackPalette(node);
const Icon = node.kind === 'job' ? Bot : GitBranch;
const divisions = hours === 168 ? 7 : 8;
const dependencyWarning = node.pendingDeps?.length > 0;
+ // App overrides only apply to task types (system jobs are not per-app). The
+ // server's active-app counts drive the toggle + badge (single source of
+ // truth); PerAppOverrideList does its own `apps` filtering when expanded.
+ const { enabledAppCount = 0, totalAppCount = 0 } = node;
+ const canExpand = node.kind === 'task' && totalAppCount > 0;
+ const countTitle = `${enabledAppCount} of ${totalAppCount} apps enabled`;
+
return (
- <button type="button" onClick={() => onSelect(node.id)} className={`grid w-full grid-cols-[14rem_minmax(42rem,1fr)] border-b border-port-border/40 text-left transition-colors last:border-b-0 ${selected ? 'bg-port-accent/8' : 'hover:bg-white/[0.025]'}`}>
- <div className="flex min-w-0 items-center gap-2 border-r border-port-border/50 px-3 py-2.5">
- <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>
- {dependencyWarning && <AlertTriangle className="h-3.5 w-3.5 shrink-0 text-port-warning" />}
- </div>
- <div className="relative min-h-12 overflow-hidden">
- <TrackGrid divisions={divisions} />
- <span className="absolute inset-y-0 left-0 z-10 border-l border-port-accent/70" />
- {windows.map(window => (
- <span
- key={window.id}
- className="absolute inset-y-2 rounded border border-amber-400/40 bg-gradient-to-r from-amber-500/30 via-amber-400/15 to-amber-500/5"
- style={{ left: `${timelinePercent(window.startAt, timeline)}%`, right: `${100 - timelinePercent(window.endAt, timeline)}%` }}
- title="Actively draining work; duration depends on the backlog"
- >
- <span className="absolute left-2 top-1/2 -translate-y-1/2 whitespace-nowrap text-[10px] font-medium text-amber-200"><InfinityIcon className="mr-1 inline h-3 w-3" />draining</span>
- </span>
- ))}
- {occurrences.map(occurrence => {
- const meta = dueNowMeta(occurrence, node, timezone);
- // 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' : '';
- return (
+ <div className={`border-b border-port-border/40 transition-colors last:border-b-0 ${selected ? 'bg-port-accent/8' : ''}`}>
+ <div className={`grid w-full grid-cols-[14rem_minmax(42rem,1fr)] ${selected ? '' : 'hover:bg-white/[0.025]'}`}>
+ <div className="flex min-w-0 items-center gap-1.5 border-r border-port-border/50 px-3 py-2.5">
+ {canExpand ? (
+ <button
+ type="button"
+ onClick={() => onToggleExpand(node.id)}
+ aria-expanded={expanded}
+ aria-label={`${expanded ? 'Hide' : 'Show'} app overrides for ${node.label}`}
+ title={countTitle}
+ className="flex h-5 w-5 shrink-0 items-center justify-center rounded text-gray-500 hover:bg-white/10 hover:text-gray-300"
+ >
+ <ChevronRight className={`h-3.5 w-3.5 transition-transform ${expanded ? 'rotate-90' : ''}`} />
+ </button>
+ ) : (
+ <span className="h-5 w-5 shrink-0" aria-hidden="true" />
+ )}
+ <button type="button" onClick={() => onSelect(node.id)} className="flex min-w-0 flex-1 items-center gap-2 text-left">
+ <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>
+ </button>
+ {canExpand && enabledAppCount > 0 && (
+ <span className="shrink-0 rounded-sm bg-port-accent/15 px-1 py-px text-[9px] font-medium text-port-accent" title={countTitle}>
+ {enabledAppCount}/{totalAppCount}
+ </span>
+ )}
+ {dependencyWarning && <AlertTriangle className="h-3.5 w-3.5 shrink-0 text-port-warning" />}
+ </div>
+ <button type="button" onClick={() => onSelect(node.id)} className="relative block min-h-12 overflow-hidden text-left">
+ <TrackGrid divisions={divisions} />
+ <span className="absolute inset-y-0 left-0 z-10 border-l border-port-accent/70" />
+ {windows.map(window => (
<span
- key={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}`}
- 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' : ''}`}
- />
- );
- })}
+ key={window.id}
+ className="absolute inset-y-2 rounded border border-amber-400/40 bg-gradient-to-r from-amber-500/30 via-amber-400/15 to-amber-500/5"
+ style={{ left: `${timelinePercent(window.startAt, timeline)}%`, right: `${100 - timelinePercent(window.endAt, timeline)}%` }}
+ title="Actively draining work; duration depends on the backlog"
+ >
+ <span className="absolute left-2 top-1/2 -translate-y-1/2 whitespace-nowrap text-[10px] font-medium text-amber-200"><InfinityIcon className="mr-1 inline h-3 w-3" />draining</span>
+ </span>
+ ))}
+ {occurrences.map(occurrence => {
+ const meta = dueNowMeta(occurrence, node, timezone);
+ // 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' : '';
+ return (
+ <span
+ key={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}`}
+ 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' : ''}`}
+ />
+ );
+ })}
+ </button>
</div>
- </button>
+ {canExpand && expanded && (
+ <div className="border-t border-port-border/40 bg-port-bg/20 px-3 py-3">
+ <PerAppOverrideList
+ taskType={node.label}
+ config={{
+ appOverrides: node.appOverrides,
+ type: node.schedule?.type,
+ taskMetadata: node.taskMetadata,
+ managedAgentOptions: node.managedAgentOptions
+ }}
+ apps={apps}
+ onUpdateOverride={onUpdateOverride}
+ onBulkToggleOverride={onBulkToggleOverride}
+ />
+ </div>
+ )}
+ </div>
);
}
@@ -181,7 +229,7 @@ function NextUp({ occurrences, nodeMap, hours, timezone, onSelect }) {
);
}
-export default function WorkflowTab() {
+export default function WorkflowTab({ apps }) {
// Zoom window + selected track live in the URL so the open editor and view
// are shareable/bookmarkable and survive reload — the same "URL is the
// source of truth for what's open" convention as ScheduleTab's ?task=.
@@ -206,8 +254,21 @@ export default function WorkflowTab() {
const [graph, setGraph] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
+ // Which task rows have their per-app override panel expanded. Kept as local
+ // view state (a lightweight detail, not a selected record) rather than in the
+ // URL — the ?track= param already owns the selected editor panel.
+ const [expandedIds, setExpandedIds] = useState(() => new Set());
const fetchGeneration = useRef(0);
+ const toggleExpand = useCallback((id) => {
+ setExpandedIds(prev => {
+ const next = new Set(prev);
+ if (next.has(id)) next.delete(id);
+ else next.add(id);
+ return next;
+ });
+ }, []);
+
const fetchGraph = useCallback(async () => {
const generation = ++fetchGeneration.current;
setLoading(true);
@@ -227,6 +288,10 @@ export default function WorkflowTab() {
return () => { fetchGeneration.current += 1; };
}, [fetchGraph]);
+ // Per-app override mutations are shared with ScheduleTab; refetch the graph so
+ // the enabled-app counts and inherited defaults stay in sync after each change.
+ const { handleUpdateOverride, handleBulkToggleOverride } = useAppOverrideActions(apps, fetchGraph);
+
const model = useMemo(() => {
if (!graph?.timeline) return null;
const nodeMap = new Map(graph.nodes.map(node => [node.id, node]));
@@ -330,7 +395,12 @@ export default function WorkflowTab() {
hours={hours}
timezone={graph.timezone}
selected={selectedId === node.id}
+ apps={apps}
+ expanded={expandedIds.has(node.id)}
onSelect={setSelectedId}
+ onToggleExpand={toggleExpand}
+ onUpdateOverride={handleUpdateOverride}
+ onBulkToggleOverride={handleBulkToggleOverride}
/>
))}
{model.scheduled.length === 0 && <div className="py-10 text-center text-sm text-gray-500">No active timed schedules in this range.</div>}
diff --git a/client/src/hooks/README.md b/client/src/hooks/README.md
index 56e25b56c4..2995b83be7 100644
--- a/client/src/hooks/README.md
+++ b/client/src/hooks/README.md
@@ -128,6 +128,7 @@ grep -i "what you want to do" client/src/hooks/README.md
|---|---|---|
| `useAppDeploy` | Stream `deploy.sh` output via Socket.IO. | App deployment surfaces only. |
| `useAppOperation` | Socket-based app ops (update, standardize) with step tracking. | App operations UI. |
+| `useAppOverrideActions` | Per-app scheduled-task override mutations (`{ handleUpdateOverride, handleBulkToggleOverride }`) with shared toast copy + silent flag; pass the tab's `refetch`. | Any surface hosting `PerAppOverrideList` (Schedule tab, Timeline tab) — don't re-copy the write-plus-toast-plus-refetch handlers. |
| `useCanonPatch` | Optimistic canon-entry patch: rebuild the kind list with one entry mutated, apply locally, PATCH the universe, re-apply the server copy. Targets + staleness-guards on the loaded record's `universe.id` so a mid-flight universe swap can't cross-PATCH or resurrect stale state. `apply` is `setUniverse` or `onUniverseChange`. | Inline canon-field edits on a universe (UniverseCanonSection, NounsStage). Don't re-roll the optimistic-then-confirm dance. |
| `useCityAudio` | CyberCity ambient audio. | CyberCity only. |
| `useCityData` | CyberCity environment data + physics. | CyberCity only. |
diff --git a/client/src/hooks/index.js b/client/src/hooks/index.js
index eac65745a9..1f2042b23e 100644
--- a/client/src/hooks/index.js
+++ b/client/src/hooks/index.js
@@ -121,6 +121,7 @@ export * from './useSidebarUniverses.js';
// === Domain: City / Voice / Mortality / Universe / Apps / Sessions ===
export * from './useAppDeploy.js';
export * from './useAppOperation.js';
+export * from './useAppOverrideActions.js';
export * from './useCanonPatch.js';
export * from './useCityData.js';
export * from './useCityPlayback.js';
diff --git a/client/src/hooks/useAppOverrideActions.js b/client/src/hooks/useAppOverrideActions.js
new file mode 100644
index 0000000000..3a0808cc95
--- /dev/null
+++ b/client/src/hooks/useAppOverrideActions.js
@@ -0,0 +1,40 @@
+import { useCallback } from 'react';
+import toast from '../components/ui/Toast';
+import * as api from '../services/api';
+
+/**
+ * Per-app scheduled-task override mutations, shared by the Schedule tab and the
+ * Timeline tab so the toast copy, silent-request flag, app-name resolution, and
+ * success gating stay in one place. Pass the tab's own `refetch` (e.g.
+ * `fetchSchedule` or `fetchGraph`) — it runs after a successful write so the
+ * enabled-app counts and inherited defaults stay in sync.
+ *
+ * Returns `{ handleUpdateOverride, handleBulkToggleOverride }`, wired directly
+ * to `PerAppOverrideList`'s `onUpdateOverride` / `onBulkToggleOverride` props.
+ */
+export function useAppOverrideActions(apps, refetch) {
+ const handleUpdateOverride = useCallback(async (appId, taskType, { enabled, interval, taskMetadata }) => {
+ const result = await api.updateAppTaskTypeOverride(appId, taskType, { enabled, interval, taskMetadata }, { silent: true }).catch(err => {
+ toast.error(err.message);
+ return null;
+ });
+ if (result?.success) {
+ const appName = apps?.find(a => a.id === appId)?.name || appId;
+ toast.success(`Updated ${taskType} override for ${appName}`);
+ refetch();
+ }
+ }, [apps, refetch]);
+
+ const handleBulkToggleOverride = useCallback(async (taskType, enabled) => {
+ const result = await api.bulkUpdateAppTaskTypeOverride(taskType, { enabled }, { silent: true }).catch(err => {
+ toast.error(err.message);
+ return null;
+ });
+ if (result?.success) {
+ toast.success(`${enabled ? 'Enabled' : 'Disabled'} ${taskType} for all apps`);
+ refetch();
+ }
+ }, [refetch]);
+
+ return { handleUpdateOverride, handleBulkToggleOverride };
+}
diff --git a/client/src/hooks/useAppOverrideActions.test.jsx b/client/src/hooks/useAppOverrideActions.test.jsx
new file mode 100644
index 0000000000..fa3c9322f1
--- /dev/null
+++ b/client/src/hooks/useAppOverrideActions.test.jsx
@@ -0,0 +1,79 @@
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { renderHook, act } from '@testing-library/react';
+
+const updateAppTaskTypeOverride = vi.fn();
+const bulkUpdateAppTaskTypeOverride = vi.fn();
+vi.mock('../services/api', () => ({
+ updateAppTaskTypeOverride: (...args) => updateAppTaskTypeOverride(...args),
+ bulkUpdateAppTaskTypeOverride: (...args) => bulkUpdateAppTaskTypeOverride(...args),
+}));
+const toastSuccess = vi.fn();
+const toastError = vi.fn();
+vi.mock('../components/ui/Toast', () => ({ default: { success: (...a) => toastSuccess(...a), error: (...a) => toastError(...a) } }));
+
+import { useAppOverrideActions } from './useAppOverrideActions.js';
+
+const APPS = [{ id: 'app-1', name: 'Acme' }];
+
+function setup(refetch = vi.fn()) {
+ const { result } = renderHook(() => useAppOverrideActions(APPS, refetch));
+ return { result, refetch };
+}
+
+beforeEach(() => {
+ updateAppTaskTypeOverride.mockReset();
+ bulkUpdateAppTaskTypeOverride.mockReset();
+ toastSuccess.mockReset();
+ toastError.mockReset();
+});
+
+describe('useAppOverrideActions', () => {
+ it('updates an override silently, toasts the app name, and refetches', async () => {
+ updateAppTaskTypeOverride.mockResolvedValue({ success: true });
+ const { result, refetch } = setup();
+
+ await act(async () => {
+ await result.current.handleUpdateOverride('app-1', 'do-replan', { enabled: true, interval: 'daily' });
+ });
+
+ expect(updateAppTaskTypeOverride).toHaveBeenCalledWith('app-1', 'do-replan', { enabled: true, interval: 'daily', taskMetadata: undefined }, { silent: true });
+ expect(toastSuccess).toHaveBeenCalledWith('Updated do-replan override for Acme');
+ expect(refetch).toHaveBeenCalledOnce();
+ });
+
+ it('falls back to the app id when the app is unknown', async () => {
+ updateAppTaskTypeOverride.mockResolvedValue({ success: true });
+ const { result } = setup();
+
+ await act(async () => {
+ await result.current.handleUpdateOverride('ghost', 'do-replan', { enabled: false });
+ });
+
+ expect(toastSuccess).toHaveBeenCalledWith('Updated do-replan override for ghost');
+ });
+
+ it('does not refetch and shows an error toast when the update rejects', async () => {
+ updateAppTaskTypeOverride.mockRejectedValue(new Error('boom'));
+ const { result, refetch } = setup();
+
+ await act(async () => {
+ await result.current.handleUpdateOverride('app-1', 'do-replan', { enabled: true });
+ });
+
+ expect(toastError).toHaveBeenCalledWith('boom');
+ expect(refetch).not.toHaveBeenCalled();
+ });
+
+ it('bulk-toggles all apps and refetches with the enabled/disabled wording', async () => {
+ bulkUpdateAppTaskTypeOverride.mockResolvedValue({ success: true });
+ const { result, refetch } = setup();
+
+ await act(async () => {
+ await result.current.handleBulkToggleOverride('do-replan', false);
+ });
+
+ expect(bulkUpdateAppTaskTypeOverride).toHaveBeenCalledWith('do-replan', { enabled: false }, { silent: true });
+ expect(toastSuccess).toHaveBeenCalledWith('Disabled do-replan for all apps');
+ expect(refetch).toHaveBeenCalledOnce();
+ });
+});
diff --git a/client/src/pages/ChiefOfStaff.jsx b/client/src/pages/ChiefOfStaff.jsx
index 3a67906c6c..020a9dfd81 100644
--- a/client/src/pages/ChiefOfStaff.jsx
+++ b/client/src/pages/ChiefOfStaff.jsx
@@ -872,7 +872,7 @@ export default function ChiefOfStaff() {
)}
{activeTab === 'workflow' && (
<div role="tabpanel" id="tabpanel-workflow" aria-labelledby="tab-workflow">
- <WorkflowTab />
+ <WorkflowTab apps={apps} />
</div>
)}
{activeTab === 'digest' && (
diff --git a/server/services/workflow.js b/server/services/workflow.js
index 3799dce145..834893dcaa 100644
--- a/server/services/workflow.js
+++ b/server/services/workflow.js
@@ -190,7 +190,16 @@ export async function getWorkflowGraph({ horizonHours = 24, from = new Date() }
missedSlot: info.status?.missedSlot || null,
pendingDeps: info.status?.pendingDeps || [],
nextRunAt: info.status?.nextRunAt || info.perpetual?.nextRecheckAt || null,
- perpetual: info.perpetual || null
+ perpetual: info.perpetual || null,
+ // Per-app overrides so the timeline can expand a task row to show/edit
+ // which apps run it (mirrors the Schedule tab's PerAppOverrideList).
+ // `taskMetadata`/`managedAgentOptions` are the global defaults the
+ // per-app rows inherit from and render "(inherited)" against.
+ appOverrides: info.appOverrides || {},
+ enabledAppCount: info.enabledAppCount || 0,
+ totalAppCount: info.totalAppCount || 0,
+ taskMetadata: info.taskMetadata || null,
+ managedAgentOptions: info.managedAgentOptions || null
});
for (const dep of runAfter) {
diff --git a/server/services/workflow.test.js b/server/services/workflow.test.js
index 72dfcde6c2..e3e93fdeaa 100644
--- a/server/services/workflow.test.js
+++ b/server/services/workflow.test.js
@@ -92,6 +92,48 @@ describe('getWorkflowGraph', () => {
expect(featureIdeas.pendingDeps).toEqual(['do-replan']);
});
+ it('forwards per-app override config onto task nodes', async () => {
+ getScheduleStatus.mockResolvedValue({
+ tasks: {
+ 'do-replan': {
+ type: 'weekly', enabled: true, runAfter: [], lastRun: null, runCount: 0,
+ status: { shouldRun: true },
+ appOverrides: { 'app-1': { enabled: true, interval: 'daily' } },
+ enabledAppCount: 1,
+ totalAppCount: 3,
+ taskMetadata: { worktree: true },
+ managedAgentOptions: ['worktree']
+ }
+ }
+ });
+ getAllJobs.mockResolvedValue([]);
+
+ const graph = await getWorkflowGraph();
+ const replan = graph.nodes.find(n => n.id === 'task:do-replan');
+ expect(replan.appOverrides).toEqual({ 'app-1': { enabled: true, interval: 'daily' } });
+ expect(replan.enabledAppCount).toBe(1);
+ expect(replan.totalAppCount).toBe(3);
+ expect(replan.taskMetadata).toEqual({ worktree: true });
+ expect(replan.managedAgentOptions).toEqual(['worktree']);
+ });
+
+ it('defaults per-app override fields when absent', async () => {
+ getScheduleStatus.mockResolvedValue({
+ tasks: {
+ 'feature-ideas': { type: 'daily', enabled: true, runAfter: [], lastRun: null, runCount: 0, status: { shouldRun: true } }
+ }
+ });
+ getAllJobs.mockResolvedValue([]);
+
+ const graph = await getWorkflowGraph();
+ const node = graph.nodes.find(n => n.id === 'task:feature-ideas');
+ expect(node.appOverrides).toEqual({});
+ expect(node.enabledAppCount).toBe(0);
+ expect(node.totalAppCount).toBe(0);
+ expect(node.taskMetadata).toBeNull();
+ expect(node.managedAgentOptions).toBeNull();
+ });
+
it('emits a depends-on edge for every runAfter entry', async () => {
getScheduleStatus.mockResolvedValue({
tasks: {