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

address review: drop output.txt overwrite + use ?? for zero delays

[._.]/ Adam Eivye50c89239391
diff --git a/server/services/agentTuiSpawning.js b/server/services/agentTuiSpawning.js
index 21d35e24a1..a9e02d60f3 100644
--- a/server/services/agentTuiSpawning.js
+++ b/server/services/agentTuiSpawning.js
@@ -7,7 +7,7 @@
*/
import { join } from 'path';
-import { writeFile, appendFile, rm } from 'fs/promises';
+import { appendFile, rm } from 'fs/promises';
import * as shellService from './shell.js';
import { emitLog } from './cosEvents.js';
import { appendAgentOutputLines, updateAgent, completeAgent } from './cosAgents.js';
@@ -165,7 +165,10 @@ export async function spawnTuiAgent(agentId, task, prompt, workspacePath, model,
}
}
- await writeFile(outputFile, outputBuffer).catch(() => {});
+ // output.txt has already been incrementally appended via flushPendingLines;
+ // do NOT writeFile() it from outputBuffer at finalize — outputBuffer is
+ // capped at OUTPUT_BUFFER_CAP and would silently truncate the on-disk
+ // record for long runs. The append-only stream is the authoritative copy.
const analysisBuffer = rawBuffer || outputBuffer;
const errorAnalysis = finalSuccess ? null : analyzeAgentFailure(analysisBuffer, task, model);
diff --git a/server/services/shell.js b/server/services/shell.js
index 050b3e3989..6c9da76755 100644
--- a/server/services/shell.js
+++ b/server/services/shell.js
@@ -143,7 +143,7 @@ export function createShellSession(socket, options = {}) {
broadcastSessionList();
if (options.initialCommand) {
- setTimeout(() => writeToSession(sessionId, `${options.initialCommand}\n`), options.initialCommandDelayMs || 200);
+ setTimeout(() => writeToSession(sessionId, `${options.initialCommand}\n`), options.initialCommandDelayMs ?? 200);
}
return sessionId;
}