From 553c43708f1e1fbc2a2c9c403db218b2f0d1a26b Mon Sep 17 00:00:00 2001 From: clagentic <10177887+akuehner@users.noreply.github.com> Date: Fri, 12 Jun 2026 05:56:21 -0400 Subject: [PATCH] fix(config): preserve file timestamps in all data-dir migrations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cpSync without preserveTimestamps stamps every copied file with the current time. Session lastActivity is derived from file mtime, so a migration without this option collapses all session recency to a single timestamp — breaking the hub's cross-project recent-sessions sort. Add preserveTimestamps: true to both migration cpSync calls: - ~/.clay/ → ~/.clagentic/ (clay→clagentic rebrand) - ~/.clagentic/ root → ~/.clagentic/console/ (console subdir migration) Co-Authored-By: Claude Sonnet 4.5 --- lib/config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/config.js b/lib/config.js index 5305796..2785644 100644 --- a/lib/config.js +++ b/lib/config.js @@ -44,7 +44,7 @@ var CLAGENTIC_HOME = process.env.CLAGENTIC_HOME var OLD_CLAY_HOME = path.join(REAL_HOME, ".clay"); if (!fs.existsSync(CLAGENTIC_HOME) && fs.existsSync(OLD_CLAY_HOME)) { try { - fs.cpSync(OLD_CLAY_HOME, CLAGENTIC_HOME, { recursive: true }); + fs.cpSync(OLD_CLAY_HOME, CLAGENTIC_HOME, { recursive: true, preserveTimestamps: true }); console.log("[config] Migrated " + OLD_CLAY_HOME + " → " + CLAGENTIC_HOME + " — ~/.clay/ can be deleted when verified"); } catch (e) { console.error("[config] Migration failed:", e.message); @@ -75,7 +75,7 @@ if (!fs.existsSync(_consoleMigrated) && fs.existsSync(CLAGENTIC_HOME)) { var _src = path.join(CLAGENTIC_HOME, _rootEntries[_ri]); var _dst = path.join(CLAGENTIC_HOME, "console", _rootEntries[_ri]); if (!fs.existsSync(_dst)) { - try { fs.cpSync(_src, _dst, { recursive: true }); } catch (_ce) {} + try { fs.cpSync(_src, _dst, { recursive: true, preserveTimestamps: true }); } catch (_ce) {} } } // Write sentinel only after the sweep completes so a crash mid-sweep