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: validate callback data, bail on provider failure, safe clone default
Adam Eivy4a0700f2f0bd
diff --git a/server/lib/fileUtils.js b/server/lib/fileUtils.jsindex 7c0fa97f98..f22b76c370 100644--- a/server/lib/fileUtils.js+++ b/server/lib/fileUtils.js@@ -301,18 +301,20 @@ export function createCachedStore(filePath, defaultValue, { ttl = 2000, contextlet cache = null;let cacheTimestamp = 0;const dir = dirname(filePath);+ // Safe clone for plain JSON defaults (structuredClone requires Node 17+)+ const cloneDefault = () => JSON.parse(JSON.stringify(defaultValue));const load = async () => {const now = Date.now();if (cache && (now - cacheTimestamp) < ttl) return cache;await ensureDir(dir);if (!existsSync(filePath)) {- cache = structuredClone(defaultValue);+ cache = cloneDefault();cacheTimestamp = now;return cache;}const content = await readFile(filePath, 'utf-8');- cache = safeJSONParse(content, structuredClone(defaultValue), { context });+ cache = safeJSONParse(content, cloneDefault(), { context });cacheTimestamp = now;return cache;};diff --git a/server/services/meatspacePostDrillCache.js b/server/services/meatspacePostDrillCache.jsindex d5ca7b9d17..c9ade50988 100644--- a/server/services/meatspacePostDrillCache.js+++ b/server/services/meatspacePostDrillCache.js@@ -54,6 +54,7 @@ function replenishType(type, providerId, model) {(async () => {let generated = 0;+ let consecutiveFailures = 0;try {for (let i = 0; i < needed; i++) {const drill = await generateLlmDrill(type, { count: 5 }, providerId, model).catch(err => {@@ -63,6 +64,14 @@ function replenishType(type, providerId, model) {if (drill) {cache[type].push(drill);generated++;+ consecutiveFailures = 0;+ } else {+ consecutiveFailures++;+ // Bail early if provider appears unavailable (2+ consecutive failures)+ if (consecutiveFailures >= 2) {+ console.log(`⚠️ POST cache: bailing on ${type} after ${consecutiveFailures} consecutive failures`);+ break;+ }}}if (generated > 0) {diff --git a/server/services/telegram.js b/server/services/telegram.jsindex a7a42947ba..d88dcf6020 100644--- a/server/services/telegram.js+++ b/server/services/telegram.js@@ -326,6 +326,12 @@ async function handleCallbackQuery(query) {const colonIdx = data.indexOf(':');const action = data.slice(0, colonIdx);const memoryId = data.slice(colonIdx + 1);++ if (!memoryId) {+ await bot.answerCallbackQuery(query.id, { text: '⚠️ Invalid callback data' }).catch(() => {});+ return;+ }+const isApprove = action === CALLBACK_APPROVE;let result;