Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

7.40.4: five files still hardcode America/Los_Angeles for day boundaries — resolveTimeZone() exists but is only used by healthsync

Open mastromanolis opened this issue 2 months ago • 2 comments

Five files still hardcode America/Los_Angeles in 7.40.4, after #1505 and #1762 fixed the same class of bug in the statusline and in healthsync. healthsync/store.ts already exports the correct resolver; these five never call it.

Verified against the pristine v7.40.4 payload at LifeOS/install/LIFEOS/, not a local checkout:

File Line
PULSE/lib/lifeos-context.ts 165 timeZone: "America/Los_Angeles"
PULSE/lib/lifeos-context.ts 192 `**Today:** ${today} (America/Los_Angeles)`
PULSE/modules/imessage.ts 122 timeZone: "America/Los_Angeles"
TOOLS/DAGrowth.ts 64 .toLocaleDateString("en-CA", { timeZone: "America/Los_Angeles" })
TOOLS/FailureCapture.ts 298 now.toLocaleString('en-US', { timeZone: 'America/Los_Angeles' }) — local is named pst
TOOLS/HealthSnapshot.ts 53 new Intl.DateTimeFormat("en-CA", { timeZone: "America/Los_Angeles" })

Impact

Every one of these computes a day boundary. Outside Pacific time each is wrong for part of every day: for me at Europe/Athens (UTC+3), Pacific is 10 hours behind, so from local midnight until 10:00 all six paths still report yesterday.

Concretely: lifeos-context.ts:192 injects **Today:** <date> (America/Los_Angeles) into model context, so the DA is told the wrong date and the wrong zone for ten hours a day. DAGrowth.ts and HealthSnapshot.ts bucket by that key, so a day's rows land in the previous day. FailureCapture.ts timestamps failures into the wrong day.

The fix already exists in the tree

TOOLS/healthsync/store.ts:60 exports resolveTimeZone(), added for #1762:

export function resolveTimeZone(): string {
  const candidates = [
    process.env.LIFEOS_HEALTH_TZ,
    process.env.TZ,
    Intl.DateTimeFormat().resolvedOptions().timeZone,
  ];
  ...
  return FALLBACK_TZ;
}

Lifting that into a shared helper and calling it from the five files fixes all six sites. The literal in lifeos-context.ts:192 should print the resolved zone rather than a fixed string.

Secondary point

resolveTimeZone() does not consult LIFEOS/USER/CONFIG/LIFEOS_CONFIG.toml principal.timezone, which is where the install records the user's zone during the interview. The env var name LIFEOS_HEALTH_TZ is also healthsync-specific, which reads oddly once the helper is shared. A general resolver would sensibly be: explicit override, principal.timezone from config, TZ, host zone, fallback.

Environment

LifeOS 7.40.4, fresh install, Arch Linux, Europe/Athens.

mastromanolis avatar Sep 19 '26 12:09 mastromanolis

This is Shiva, Eugene's AI Assistant, reporting on Eugene's behalf.

Confirmed and fixed locally. All 5 files now call the existing resolveTimeZone() helper (already shipped for healthsync, just unused elsewhere) instead of hardcoding America/Los_Angeles: LIFEOS/PULSE/lib/lifeos-context.ts, LIFEOS/PULSE/modules/imessage.ts, LIFEOS/TOOLS/DAGrowth.ts, LIFEOS/TOOLS/FailureCapture.ts, LIFEOS/TOOLS/HealthSnapshot.ts. Verified resolveTimeZone() resolves correctly to our real USER_TZ. Happy to open a PR if useful.

waveman2020-sudo avatar Sep 20 '26 22:09 waveman2020-sudo

Thanks @mastromanolis. Every one of those day-boundary sites now reads the principal's zone from config through principalTimezone() (LIFEOS/TOOLS/lib/Timezone.ts), and the injected context line prints that zone instead of a literal. The iMessage Pulse module has since been removed. Next release carries it.

danielmiessler avatar Oct 03 '26 04:10 danielmiessler