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: Windows atomicWrite uses backup-swap; Daily Log nav icon matches internal tab

Adam Eivyd2afb7787488
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index d8ff0414fe..915362c0c2 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -72,6 +72,7 @@ import {
HardDrive,
MessagesSquare,
BookOpen,
+ NotebookPen,
Search,
Mic
} from 'lucide-react';
@@ -100,7 +101,7 @@ const navItems = [
icon: Brain,
children: [
{ to: '/brain/config', label: 'Config', icon: Settings },
- { to: '/brain/daily-log', label: 'Daily Log', icon: BookOpen },
+ { to: '/brain/daily-log', label: 'Daily Log', icon: NotebookPen },
{ to: '/brain/digest', label: 'Digest', icon: Calendar },
{ to: '/brain/graph', label: 'Graph', icon: Network },
{ to: '/brain/inbox', label: 'Inbox', icon: MessageSquare },
diff --git a/server/lib/fileUtils.js b/server/lib/fileUtils.js
index abcd736058..9d6f77f130 100644
--- a/server/lib/fileUtils.js
+++ b/server/lib/fileUtils.js
@@ -108,19 +108,33 @@ export async function atomicWrite(filePath, data) {
const tmp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
await writeFile(tmp, payload);
// Node's fs.rename uses MoveFileExW with MOVEFILE_REPLACE_EXISTING on Windows (atomic
- // overwrite), but will still fail with EPERM/EACCES if the destination is locked. Fall
- // back to unlink + rename so writes succeed on Windows in those edge cases too.
+ // overwrite), but still fails with EPERM/EACCES if the destination is locked (AV scan,
+ // concurrent reader). Fall back to a backup-swap so the original file is never lost.
const replace = async () => {
const err = await rename(tmp, filePath).then(() => null, (e) => e);
if (!err) return;
if (process.platform === 'win32' && ['EPERM', 'EACCES', 'EEXIST'].includes(err.code)) {
- await unlink(filePath).catch(() => {});
- await rename(tmp, filePath);
+ const bak = `${filePath}.${process.pid}.${Date.now()}.bak`;
+ const hadExisting = await rename(filePath, bak).then(() => true, (e) => {
+ if (e.code === 'ENOENT') return false;
+ throw e;
+ });
+ const renameErr = await rename(tmp, filePath).then(() => null, (e) => e);
+ if (renameErr) {
+ if (hadExisting) await rename(bak, filePath).catch(() => {});
+ throw renameErr;
+ }
+ if (hadExisting) await unlink(bak).catch(() => {});
return;
}
throw err;
};
- await replace();
+ try {
+ await replace();
+ } catch (err) {
+ await unlink(tmp).catch(() => {});
+ throw err;
+ }
}
/**