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: emit failed on network error, live connection check, early return on save failure, validate avatar path, relax cron validation
Adam Eivy4d62f5511a37
diff --git a/client/src/pages/Settings.jsx b/client/src/pages/Settings.jsxindex 550ca63f5f..b55a54275b 100644--- a/client/src/pages/Settings.jsx+++ b/client/src/pages/Settings.jsx@@ -901,10 +901,16 @@ function ImageGenTab() {setSaving(true);const url = sdapiUrl.trim().replace(/\/+$/, '') || undefined;+ let settingsSaved = false;await updateSettings({ imageGen: { sdapiUrl: url } })- .then(() => toast.success('Image gen settings saved'))+ .then(() => { settingsSaved = true; toast.success('Image gen settings saved'); }).catch(() => toast.error('Failed to save settings'));+ if (!settingsSaved) {+ setSaving(false);+ return;+ }+// Register or update the tool in the CoS tools registryconst toolData = {name: 'Stable Diffusion',diff --git a/server/routes/character.js b/server/routes/character.jsindex 126b24aa7e..522e5a75a8 100644--- a/server/routes/character.js+++ b/server/routes/character.js@@ -15,7 +15,7 @@ const router = Router();const updateCharacterSchema = z.object({name: z.string().min(1).max(100).optional(),class: z.string().min(1).max(100).optional(),- avatarPath: z.string().max(500).optional()+ avatarPath: z.string().max(500).regex(/^\/data\/images\/[A-Za-z0-9._-]+$/, 'Invalid avatar path').optional()});const addXPSchema = z.object({diff --git a/server/routes/cos.js b/server/routes/cos.jsindex f198f86b82..54ba7e1e14 100644--- a/server/routes/cos.js+++ b/server/routes/cos.js@@ -966,10 +966,12 @@ router.post('/jobs', asyncHandler(async (req, res) => {if (parts.length !== 5) {throw new ServerError('cronExpression must be a 5-field cron expression (minute hour dayOfMonth month dayOfWeek)', { status: 400, code: 'VALIDATION_ERROR' });}- // Validate syntax, field ranges, and reachability- const nextRun = parseCronToNextRun(cronExpression, new Date(), 'UTC');- if (!nextRun) {- throw new ServerError('Invalid cronExpression: no matching time found (check field ranges)', { status: 400, code: 'VALIDATION_ERROR' });+ // Validate syntax and field ranges; null means no match within search window+ // (valid for infrequent schedules like leap-day), so only reject thrown errors+ try {+ parseCronToNextRun(cronExpression, new Date(), 'UTC');+ } catch (err) {+ throw new ServerError(`Invalid cronExpression: ${err?.message || 'unable to parse'}`, { status: 400, code: 'VALIDATION_ERROR' });}}@@ -989,10 +991,12 @@ router.put('/jobs/:id', asyncHandler(async (req, res) => {if (parts.length !== 5) {throw new ServerError('cronExpression must be a 5-field cron expression', { status: 400, code: 'VALIDATION_ERROR' });}- // Validate syntax, field ranges, and reachability- const nextRun = parseCronToNextRun(cronExpression, new Date(), 'UTC');- if (!nextRun) {- throw new ServerError('Invalid cronExpression: no matching time found (check field ranges)', { status: 400, code: 'VALIDATION_ERROR' });+ // Validate syntax and field ranges; null means no match within search window+ // (valid for infrequent schedules like leap-day), so only reject thrown errors+ try {+ parseCronToNextRun(cronExpression, new Date(), 'UTC');+ } catch (err) {+ throw new ServerError(`Invalid cronExpression: ${err?.message || 'unable to parse'}`, { status: 400, code: 'VALIDATION_ERROR' });}}const job = await autonomousJobs.updateJob(req.params.id, {diff --git a/server/services/imageGen.js b/server/services/imageGen.jsindex 29b1507541..2286ba38a9 100644--- a/server/services/imageGen.js+++ b/server/services/imageGen.js@@ -43,10 +43,13 @@ export async function checkConnection() {const baseUrl = await getSdApiUrl();if (!baseUrl) return { connected: false, reason: 'No SD API URL configured' };- const model = await detectModel(baseUrl);- if (model === 'unknown' && !cachedModel.timestamp) {- return { connected: false, reason: 'SD API unreachable' };- }+ // Always make a live request for status checks — bypass the model cache+ const res = await fetchWithTimeout(`${baseUrl}/sdapi/v1/options`, {}, 10000).catch(() => null);+ if (!res?.ok) return { connected: false, reason: 'SD API unreachable' };+ const options = await res.json().catch(() => null);+ const model = options?.sd_model_checkpoint || 'unknown';+ // Update the cache while we're at it+ cachedModel = { name: model, timestamp: Date.now() };return { connected: true, model };}@@ -126,9 +129,12 @@ export async function generateImage({ prompt, negativePrompt, width, height, ste},300000);- } finally {+ } catch (err) {stopPolling();+ imageGenEvents.emit('failed', { generationId, error: 'Network error contacting image generation service' });+ throw err;}+ stopPolling();if (!res.ok) {const errBody = await res.text().catch(() => '');