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: readFileTail returns null (not '') on FileHandle.read failure
Adam Eivycfac40c6e828
diff --git a/server/services/agentTuiSpawning.js b/server/services/agentTuiSpawning.jsindex d7dd9e1898..0faa3729e4 100644--- a/server/services/agentTuiSpawning.js+++ b/server/services/agentTuiSpawning.js@@ -65,9 +65,12 @@ async function readFileTail(path, maxBytes) {const buf = Buffer.alloc(length);// Honour bytesRead — the file can shrink between stat and read, or the// OS can return a short read; decoding the whole `buf` would otherwise- // append NULs to the returned string.- const { bytesRead } = await fh.read(buf, 0, length, start).catch(() => ({ bytesRead: 0 }));- return buf.toString('utf8', 0, bytesRead);+ // append NULs to the returned string. Read failures surface as null so+ // callers can distinguish "empty file" ('') from "read error" (null) —+ // a `bytesRead: 0` fallback would conflate the two.+ const readResult = await fh.read(buf, 0, length, start).catch(() => null);+ if (readResult === null) return null;+ return buf.toString('utf8', 0, readResult.bytesRead);} finally {await fh.close().catch(() => {});}