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
address review: fix 5 Copilot review findings (iteration 2)
Adam Eivy796479e54fc9
diff --git a/client/src/components/calendar/ChronotypeOverlay.jsx b/client/src/components/calendar/ChronotypeOverlay.jsxindex f6d7c2c064..cd6fdab968 100644--- a/client/src/components/calendar/ChronotypeOverlay.jsx+++ b/client/src/components/calendar/ChronotypeOverlay.jsx@@ -33,15 +33,15 @@ export default function ChronotypeOverlay({ startHour, pxPerHour }) {return (<divkey={zone.id}- className="absolute left-0 right-0 flex items-center pointer-events-none z-0 group/marker"+ className="absolute left-0 right-0 flex items-center pointer-events-none z-0"+ style={{ top }}>- <style>{`.group\\/marker:hover .chrono-label { opacity: 1; }`}</style><divclassName="flex-1 border-t border-dashed"- style={{ top, borderColor: zone.color }}+ style={{ borderColor: zone.color }}/><span- className="chrono-label absolute right-1 -top-4 text-[10px] font-medium px-1.5 py-0.5 rounded opacity-0 transition-opacity"+ className="absolute right-1 -top-4 text-[10px] font-medium px-1.5 py-0.5 rounded"style={{ color: zone.color, backgroundColor: `${zone.color}20` }}>{zone.label}diff --git a/server/lib/validation.js b/server/lib/validation.jsindex 9a841153f8..320f4cda3a 100644--- a/server/lib/validation.js+++ b/server/lib/validation.js@@ -546,6 +546,9 @@ export function validateRequest(schema, data) {// Agent behavior flags that can be overridden per-pipeline-stageexport const PIPELINE_BEHAVIOR_FLAGS = ['useWorktree', 'openPR', 'simplify', 'reviewLoop'];+// Absolute cap on total agent spawns per task (across all retry types)+export const MAX_TOTAL_SPAWNS = 5;+const ALLOWED_TASK_METADATA_KEYS = [...PIPELINE_BEHAVIOR_FLAGS, 'readOnly'];/**diff --git a/server/services/browserService.js b/server/services/browserService.jsindex 5ff981871a..2335c5b377 100644--- a/server/services/browserService.js+++ b/server/services/browserService.js@@ -251,8 +251,7 @@ export async function getDownloads() {files.push({name,size: info.size,- modified: info.mtime.toISOString(),- path: filePath+ modified: info.mtime.toISOString()});}}diff --git a/server/services/cos.js b/server/services/cos.jsindex 3801c0640f..ea57c341a3 100644--- a/server/services/cos.js+++ b/server/services/cos.js@@ -23,7 +23,7 @@ import { generateProactiveTasks as generateMissionTasks, getStats as getMissionSimport { generateTaskFromJob, recordJobExecution, recordJobGateSkip, isScriptJob, executeScriptJob, isShellJob, executeShellJob } from './autonomousJobs.js';import { checkJobGate, hasGate } from './jobGates.js';import { ensureDir, ensureDirs, formatDuration, safeJSONParse, PATHS } from '../lib/fileUtils.js';-import { sanitizeTaskMetadata, PIPELINE_BEHAVIOR_FLAGS } from '../lib/validation.js';+import { sanitizeTaskMetadata, PIPELINE_BEHAVIOR_FLAGS, MAX_TOTAL_SPAWNS } from '../lib/validation.js';import { addNotification, NOTIFICATION_TYPES } from './notifications.js';import { recordDecision, DECISION_TYPES } from './decisionLog.js';import { getUserTimezone, getLocalParts, nextLocalTime, todayInTimezone } from '../lib/timezone.js';@@ -44,8 +44,7 @@ const REPORTS_DIR = PATHS.reports;const SCRIPTS_DIR = PATHS.scripts;const ROOT_DIR = PATHS.root;-// Must match MAX_TOTAL_SPAWNS in subAgentSpawner.js (dynamic import avoids circular dep)-const MAX_TOTAL_SPAWNS = 5;+// MAX_TOTAL_SPAWNS imported from validation.js (shared with subAgentSpawner.js)/*** Block a task that has exceeded the max spawn limit. Returns true if blocked.diff --git a/server/services/dataManager.js b/server/services/dataManager.jsindex 88a6e8d1e2..2f2c860617 100644--- a/server/services/dataManager.js+++ b/server/services/dataManager.js@@ -36,10 +36,10 @@ const SAFE_NAME = /^[a-z0-9_-]+$/;async function getDirSizeAndCount(dirPath) {if (!existsSync(dirPath)) return { size: 0, fileCount: 0 };const [duOut, findOut] = await Promise.all([- execFileAsync('du', ['-sk', dirPath], { windowsHide: true })+ execFileAsync('du', ['-sk', dirPath], { windowsHide: true, timeout: 30000 }).then(r => r.stdout.trim()).catch(() => '0'),- execFileAsync('find', [dirPath, '-type', 'f'], { windowsHide: true })+ execFileAsync('find', [dirPath, '-type', 'f'], { windowsHide: true, timeout: 30000 }).then(r => r.stdout.trim().split('\n').filter(Boolean).length).catch(() => 0)]);diff --git a/server/services/feeds.js b/server/services/feeds.jsindex 055f7900dc..34539d6b66 100644--- a/server/services/feeds.js+++ b/server/services/feeds.js@@ -278,10 +278,15 @@ export async function getFeedStats() {// ─── Internal Helpers ───────────────────────────────────────────────────────async function fetchFeedXml(url) {+ // Restrict to http/https to prevent SSRF via file://, data://, etc.+ const parsed = new URL(url);+ if (!['http:', 'https:'].includes(parsed.protocol)) return null;+const controller = new AbortController();const timeout = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);const res = await fetch(url, {signal: controller.signal,+ redirect: 'follow',headers: { 'User-Agent': 'PortOS Feed Reader/1.0', Accept: 'application/rss+xml, application/atom+xml, application/xml, text/xml' }}).catch(() => null);clearTimeout(timeout);diff --git a/server/services/subAgentSpawner.js b/server/services/subAgentSpawner.jsindex e0580395e0..52dd13100b 100644--- a/server/services/subAgentSpawner.js+++ b/server/services/subAgentSpawner.js@@ -20,7 +20,7 @@ import { recordSession, recordMessages } from './usage.js';import { isProviderAvailable, markProviderUsageLimit, markProviderRateLimited, getFallbackProvider, getProviderStatus, initProviderStatus } from './providerStatus.js';import { buildPrompt } from './promptService.js';import { registerSpawnedAgent, unregisterSpawnedAgent } from './agents.js';-import { PIPELINE_BEHAVIOR_FLAGS } from '../lib/validation.js';+import { PIPELINE_BEHAVIOR_FLAGS, MAX_TOTAL_SPAWNS } from '../lib/validation.js';import { getMemorySection } from './memoryRetriever.js';import { extractAndStoreMemories } from './memoryExtractor.js';import { getDigitalTwinForPrompt } from './digital-twin.js';@@ -3506,8 +3506,6 @@ export async function killAllAgents() {// Max retries before creating investigation taskconst MAX_ORPHAN_RETRIES = 3;const MAX_TASK_RETRIES = 3;-// Absolute cap on total agent spawns per task (across all retry types)-export const MAX_TOTAL_SPAWNS = 5;// Minimum cooldown between orphan retries (30 minutes)const ORPHAN_RETRY_COOLDOWN_MS = 30 * 60 * 1000;