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: use real timezone offset in PM2 log prefixes (#11436)

[._.]/ Adam Eivy301b8e07c621
diff --git a/ecosystem.config.cjs b/ecosystem.config.cjs
index 5ce71c29bd..cb4fcc42ea 100644
--- a/ecosystem.config.cjs
+++ b/ecosystem.config.cjs
@@ -2,7 +2,10 @@
// PM2 Ecosystem Configuration - shared constants and app definitions
// =============================================================================
const path = require('path');
-const LOG_DATE_FORMAT = 'YYYY-MM-DDTHH:mm:ss.SSS[Z]';
+// PM2 formats this with dayjs in the daemon process, whose timezone is NOT forced
+// to UTC by the child env. `Z` emits the real offset (+00:00 on UTC hosts, -08:00
+// elsewhere); a bracketed [Z] literal mislabels local wall-clock time as UTC (#11436).
+const LOG_DATE_FORMAT = 'YYYY-MM-DDTHH:mm:ss.SSSZ';
const IS_WIN = process.platform === 'win32';
// Shared env inherited by all apps (merged into each app's env)
@@ -166,6 +169,7 @@ const DATABASE_ENDPOINTS = {
const PG_PORT = DATABASE_ENDPOINTS[pgMode === 'native' ? 'native' : 'docker'].port;
module.exports = {
+ LOG_DATE_FORMAT,
DATABASE_MODE: pgMode,
DATABASE_ENDPOINTS,
PORTS, // Export for other configs to reference
diff --git a/server/lib/pm2LogDateFormat.test.js b/server/lib/pm2LogDateFormat.test.js
new file mode 100644
index 0000000000..ebea2f6b14
--- /dev/null
+++ b/server/lib/pm2LogDateFormat.test.js
@@ -0,0 +1,33 @@
+import { describe, it, expect } from 'vitest';
+import { createRequire } from 'module';
+import { readFileSync } from 'fs';
+import { fileURLToPath } from 'url';
+import path from 'path';
+
+const require = createRequire(import.meta.url);
+const ecosystemPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'ecosystem.config.cjs');
+const { LOG_DATE_FORMAT } = require(ecosystemPath);
+
+// Regression for #11436: a literal `[Z]` labels the PM2 daemon's local wall-clock
+// time as UTC, so prefixes disagree with embedded toISOString() values by the
+// host's UTC offset. The offset token keeps both representations the same instant.
+describe('PM2 LOG_DATE_FORMAT', () => {
+ it('uses the dayjs offset token, not a literal Z', () => {
+ expect(LOG_DATE_FORMAT).toBe('YYYY-MM-DDTHH:mm:ss.SSSZ');
+ expect(LOG_DATE_FORMAT).not.toContain('[Z]');
+ });
+
+ it('is applied to every app via the shared constant', () => {
+ const src = readFileSync(ecosystemPath, 'utf8');
+ const uses = [...src.matchAll(/log_date_format:\s*(.+?),/g)].map((m) => m[1]);
+ expect(uses.length).toBeGreaterThan(0);
+ expect(new Set(uses)).toEqual(new Set(['LOG_DATE_FORMAT']));
+ });
+
+ it('produces a prefix that Date parses to the same instant as a UTC ISO string', () => {
+ // Render the format's shape by hand for a -08:00 host and a UTC host.
+ const instant = Date.parse('2026-01-01T12:00:00.000Z');
+ expect(Date.parse('2026-01-01T04:00:00.000-08:00')).toBe(instant);
+ expect(Date.parse('2026-01-01T12:00:00.000+00:00')).toBe(instant);
+ });
+});