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: address PR review feedback

Adam Eivy450b80d09b37
diff --git a/client/src/components/cos/tabs/TasksTab.jsx b/client/src/components/cos/tabs/TasksTab.jsx
index 0386154eab..1a39ac03f6 100644
--- a/client/src/components/cos/tabs/TasksTab.jsx
+++ b/client/src/components/cos/tabs/TasksTab.jsx
@@ -67,11 +67,17 @@ export default function TasksTab({ tasks, onRefresh, providers, apps }) {
}
};
- // Screenshot handling
+ // Screenshot handling - limit to 10MB per file
+ const MAX_FILE_SIZE = 10 * 1024 * 1024; // 10MB
+
const handleFileSelect = async (e) => {
const files = Array.from(e.target.files);
for (const file of files) {
if (!file.type.startsWith('image/')) continue;
+ if (file.size > MAX_FILE_SIZE) {
+ toast.error(`File "${file.name}" exceeds 10MB limit`);
+ continue;
+ }
const reader = new FileReader();
reader.onload = async (ev) => {
diff --git a/ecosystem.config.cjs b/ecosystem.config.cjs
index d2a1371297..145fc89852 100644
--- a/ecosystem.config.cjs
+++ b/ecosystem.config.cjs
@@ -22,11 +22,12 @@ module.exports = {
interpreter: 'node',
// CoS Agent Runner - isolated process for spawning Claude CLI agents
// Does NOT restart when portos-server restarts, preventing orphaned agents
+ // Security: Binds to localhost only - not exposed externally
ports: { api: 5558 },
env: {
NODE_ENV: 'development',
PORT: 5558,
- HOST: '0.0.0.0'
+ HOST: '127.0.0.1'
},
watch: false,
autorestart: true,
diff --git a/server/cos-runner/index.js b/server/cos-runner/index.js
index 45c59aa8e0..e0c8b749b1 100644
--- a/server/cos-runner/index.js
+++ b/server/cos-runner/index.js
@@ -14,7 +14,6 @@ import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
import { writeFile, mkdir, readFile } from 'fs/promises';
import { existsSync } from 'fs';
-import { v4 as uuidv4 } from 'uuid';
import http from 'http';
import { Server as SocketServer } from 'socket.io';
diff --git a/server/services/runner.js b/server/services/runner.js
index 5301dbf3b7..95492e3434 100644
--- a/server/services/runner.js
+++ b/server/services/runner.js
@@ -438,7 +438,12 @@ export async function executeApiRun(runId, provider, model, prompt, workspacePat
responseBody = await response.text().catch(() => null);
if (responseBody) {
// Try to parse as JSON for structured error
- const parsed = JSON.parse(responseBody).catch?.(() => null);
+ let parsed = null;
+ try {
+ parsed = JSON.parse(responseBody);
+ } catch {
+ // Not valid JSON, ignore
+ }
if (parsed?.error?.message) {
errorDetails = `${response.status}: ${parsed.error.message}`;
} else if (parsed?.message) {
@@ -479,7 +484,13 @@ export async function executeApiRun(runId, provider, model, prompt, workspacePat
const data = line.slice(6);
if (data === '[DONE]') continue;
- const parsed = JSON.parse(data).catch?.(() => null);
+ let parsed = null;
+ try {
+ parsed = JSON.parse(data);
+ } catch {
+ // Not valid JSON, skip this chunk
+ continue;
+ }
if (parsed?.choices?.[0]?.delta?.content) {
const text = parsed.choices[0].delta.content;
output += text;
@@ -703,7 +714,6 @@ async function syncActiveRuns() {
// Run output exists but no endTime - run is likely stuck or orphaned
// Mark it as failed
console.log(`⚠️ Run ${runId} appears orphaned - marking as failed`);
- const output = await readFile(outputPath, 'utf-8').catch(() => '');
metadata.endTime = new Date().toISOString();
metadata.success = false;
metadata.error = 'Run was orphaned (process ended without proper completion)';
diff --git a/server/services/subAgentSpawner.js b/server/services/subAgentSpawner.js
index b59b80c52b..bf17bca94e 100644
--- a/server/services/subAgentSpawner.js
+++ b/server/services/subAgentSpawner.js
@@ -403,7 +403,10 @@ export async function initSpawner() {
initCosRunnerConnection();
// Sync any agents that were running before server restart
- const synced = await syncRunnerAgents();
+ const synced = await syncRunnerAgents().catch(err => {
+ console.error(`❌ Failed to sync runner agents: ${err.message}`);
+ return 0;
+ });
if (synced > 0) {
console.log(`🔄 Recovered ${synced} agents from CoS Runner`);
}
@@ -425,7 +428,7 @@ export async function initSpawner() {
});
onCosRunnerEvent('agent:completed', async (data) => {
- const { agentId, taskId, exitCode, success, duration, outputLength } = data;
+ const { agentId, exitCode, success, duration } = data;
const agent = runnerAgents.get(agentId);
if (agent) {
clearTimeout(agent.initializationTimeout);