Skip to content

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

fix: simplify review — use ToggleSwitch component, remove dead code, fix error handling

Adam Eivy74b9fb63f888
diff --git a/client/src/components/apps/tabs/AutomationTab.jsx b/client/src/components/apps/tabs/AutomationTab.jsx
index 2b602e8eaa..f11fa6034b 100644
--- a/client/src/components/apps/tabs/AutomationTab.jsx
+++ b/client/src/components/apps/tabs/AutomationTab.jsx
@@ -3,6 +3,7 @@ import { RefreshCw, Play } from 'lucide-react';
import toast from 'react-hot-toast';
import BrailleSpinner from '../../BrailleSpinner';
import CronInput from '../../CronInput';
+import ToggleSwitch from '../../ToggleSwitch';
import * as api from '../../../services/api';
import { AGENT_OPTIONS, toggleAppMetadataOverride } from '../../cos/constants';
import { isCronExpression, describeCron } from '../../../utils/cronHelpers';
@@ -114,10 +115,11 @@ export default function AutomationTab({ appId, appName }) {
const handleToggleAll = async () => {
const newEnabled = !allEnabled;
- await api.toggleAllAppTaskTypes(appId, newEnabled).catch(err => {
+ const result = await api.toggleAllAppTaskTypes(appId, newEnabled).catch(err => {
toast.error(err.message);
return null;
});
+ if (!result) return;
setOverrides(prev => {
const updated = { ...prev };
for (const t of taskTypes) {
@@ -135,17 +137,7 @@ export default function AutomationTab({ appId, appName }) {
<h3 className="text-lg font-semibold text-white">Task Type Overrides</h3>
<p className="text-sm text-gray-500">Per-app automation preferences for CoS task scheduling</p>
</div>
- <button
- onClick={handleToggleAll}
- className={`w-10 h-5 rounded-full transition-colors relative shrink-0 ${
- allEnabled ? 'bg-port-success' : 'bg-gray-600'
- }`}
- title={allEnabled ? 'Disable all automations' : 'Enable all automations'}
- >
- <span className={`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${
- allEnabled ? 'left-5' : 'left-0.5'
- }`} />
- </button>
+ <ToggleSwitch enabled={allEnabled} onChange={handleToggleAll} size="sm" activeColor="bg-port-success" ariaLabel={allEnabled ? 'Disable all automations' : 'Enable all automations'} />
</div>
<button
onClick={fetchData}
@@ -175,16 +167,7 @@ export default function AutomationTab({ appId, appName }) {
<div key={taskType} className="bg-port-card border border-port-border rounded-lg p-3 space-y-2">
{/* Row 1: name + toggle + run now */}
<div className="flex items-center gap-3">
- <button
- onClick={() => handleToggle(taskType, isEnabled)}
- className={`w-10 h-5 rounded-full transition-colors relative shrink-0 ${
- isEnabled ? 'bg-port-success' : 'bg-gray-600'
- }`}
- >
- <span className={`absolute top-0.5 w-4 h-4 rounded-full bg-white transition-transform ${
- isEnabled ? 'left-5' : 'left-0.5'
- }`} />
- </button>
+ <ToggleSwitch enabled={isEnabled} onChange={() => handleToggle(taskType, isEnabled)} size="sm" activeColor="bg-port-success" />
<div className="flex-1 min-w-0">
<span className="text-white font-mono text-xs">{taskType}</span>
<div className="text-xs text-gray-500">{effectiveLabel}{intervalSuffix}</div>
diff --git a/server/services/autonomousJobs.js b/server/services/autonomousJobs.js
index 41abf004ce..a04ad8cc59 100644
--- a/server/services/autonomousJobs.js
+++ b/server/services/autonomousJobs.js
@@ -592,23 +592,6 @@ async function getEnabledJobs() {
return data.jobs.filter(j => j.enabled)
}
-/**
- * Check if the current time has passed a job's scheduledTime today.
- * scheduledTime is "HH:MM" in the user's configured timezone.
- * Returns true if no scheduledTime is set, or if current local time >= scheduledTime.
- * @param {string|null} scheduledTime - "HH:MM" or null/undefined
- * @param {string} timezone - IANA timezone string
- * @returns {boolean}
- */
-function isScheduledTimeMet(scheduledTime, timezone) {
- if (!scheduledTime) return true
- const [hours, minutes] = scheduledTime.split(':').map(Number)
- const local = getLocalParts(new Date(), timezone)
- const nowMinutes = local.hour * 60 + local.minute
- const targetMinutes = hours * 60 + minutes
- return nowMinutes >= targetMinutes
-}
-
/**
* Check if today is a weekday (Monday-Friday) in the user's timezone.
* @param {string} timezone - IANA timezone string
@@ -649,13 +632,10 @@ async function getDueJobs() {
const timeSinceLastRun = now - lastRun
if (timeSinceLastRun >= job.intervalMs) {
- // If job has a scheduledTime, compute exact UTC target in user's timezone
if (job.scheduledTime) {
const [hours, minutes] = job.scheduledTime.split(':').map(Number)
const targetUtc = nextLocalTime(now - DAY, hours, minutes, timezone)
- // Not due if today's scheduled time hasn't arrived yet
if (now < targetUtc) continue
- // Already ran since this scheduled occurrence
if (lastRun >= targetUtc) continue
}
@@ -1317,7 +1297,6 @@ export {
generateTaskFromJob,
getJobStats,
getNextDueJob,
- isScheduledTimeMet,
isWeekday,
INTERVAL_OPTIONS,
loadJobSkillTemplate,
diff --git a/server/services/subAgentSpawner.js b/server/services/subAgentSpawner.js
index 1d78d19cac..da764c7c90 100644
--- a/server/services/subAgentSpawner.js
+++ b/server/services/subAgentSpawner.js
@@ -2407,16 +2407,13 @@ async function spawnDirectly(agentId, task, prompt, workspacePath, model, provid
claudeProcess.stderr.on('data', async (data) => {
const text = data.toString();
- // Codex dumps its entire prompt/config to stderr — filter to only useful lines
+ // Codex dumps its entire prompt/config to stderr — filter to useful lines only
if (provider.id === 'codex') {
- const lines = text.split('\n');
- for (const line of lines) {
+ for (const line of text.split('\n')) {
const trimmed = line.trim();
if (!trimmed) continue;
- // Skip initialization noise (prompt dump, config, session info)
if (trimmed.startsWith('Reading prompt from stdin')) continue;
if (trimmed.startsWith('OpenAI Codex v')) continue;
- // Keep exec lines (tool calls) and everything else (errors, progress)
outputBuffer += `[stderr] ${trimmed}\n`;
await appendAgentOutput(agentId, `[stderr] ${trimmed}`);
}