Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Installer: temperature-unit default ignores detected timezone, defaults to Fahrenheit worldwide

Open henrique-franze opened this issue 4 months ago • 2 comments

Bug

On a fresh install, the temperature-unit prompt defaults to Fahrenheit regardless of the timezone the installer just detected/confirmed one step earlier — so most non-US installs end up with Fahrenheit in the statusline weather display unless the user explicitly types C.

Where

LifeOS/install/LIFEOS/LIFEOS_INSTALL/engine/actions.ts:

// line ~1443 — timezone is detected and confirmed here
const detectedTz = state.detection?.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone;
const tz = await getInput("timezone", `Detected timezone: ${detectedTz}...`, "text", detectedTz, ...);
state.collected.timezone = tz.trim() || detectedTz;

// line ~1454-1460 — temperature unit prompt, right after
const defaultTempUnit = state.collected.temperatureUnit || "fahrenheit";   // <-- always "fahrenheit" on a fresh install
const tempUnit = await getInput(
  "temperature-unit",
  `Temperature unit? Type F for Fahrenheit or C for Celsius. (Default: ${defaultTempUnit === "celsius" ? "C" : "F"})`,
  "text",
  defaultTempUnit === "celsius" ? "C" : "F",
  ...
);
const trimmedUnit = tempUnit.trim().toLowerCase();
state.collected.temperatureUnit = (trimmedUnit === "c" || trimmedUnit === "celsius") ? "celsius" : "fahrenheit";

state.collected.timezone is already populated one step above, but defaultTempUnit never looks at it — it only carries over a unit from a prior install (actions.ts:1212, settings.preferences?.temperatureUnit). On a truly fresh install there's nothing to carry over, so every install pre-fills F regardless of locale, and anyone who accepts the default (pressing Enter, or a non-interactive/web install flow) ends up with Fahrenheit.

This then flows unchanged into config-gen.ts:55 (temperatureUnit: config.temperatureUnit || "fahrenheit") and gets written to settings.json, which LIFEOS_StatusLine.sh reads for the weather display.

Suggested fix

Derive the pre-filled default from the timezone already collected, instead of hardcoding "fahrenheit". Something like:

// A short list is enough — Fahrenheit-for-weather is really only the US
// (plus a couple of small outliers) once you exclude it.
const FAHRENHEIT_TIMEZONES = new Set([
  "America/New_York", "America/Chicago", "America/Denver", "America/Los_Angeles",
  "America/Anchorage", "America/Adak", "Pacific/Honolulu",
  "America/Nassau",      // Bahamas
  "America/Belize",
  "America/Cayman",
  "Pacific/Palau",
  "Asia/Yangon",         // Myanmar
  "Africa/Monrovia",     // Liberia
]);

const defaultTempUnit =
  state.collected.temperatureUnit ||
  (FAHRENHEIT_TIMEZONES.has(state.collected.timezone) ? "fahrenheit" : "celsius");

The explicit F/C prompt should stay (so anyone can override it) — this only changes what the default is when the user just accepts it. The timezone list above isn't exhaustive of every IANA alias; happy to help fill it out if useful, but even a partial list beats a global Fahrenheit default for a project whose users are worldwide.

Repro

Fresh install, non-US timezone, accept the temperature-unit prompt's default (or install non-interactively) → settings.json ends up with preferences.temperatureUnit: "fahrenheit" → statusline weather shows °F.

henrique-franze avatar Jul 10 '26 02:07 henrique-franze

Interesting, for my default install experience with 6.05 US Central time zone mine defaulted to Celsius. Having not performed any code analysis this feels like the UOM logic is backwards. Regardless, there is definitely an issue.

bnkath2o avatar Jul 11 '26 14:07 bnkath2o

Thanks—and thanks @bnkath2o for the 6.0.5 data point, which is actually the key to resolving this. The Fahrenheit default lives in the old LIFEOS_INSTALL/engine installer, which was dead pre-6.x code and has been removed from main entirely. The current install flow ships temperatureUnit: "celsius" as the payload default—which is why a 6.0.5 US-timezone install saw Celsius. The default flipped to global Celsius deliberately, since that's correct for most of the world.

The next patch also adds locale guidance to the install doc so the installing AI sets the unit from the user's locale rather than anyone relying on a global default. Closing as already fixed in the current flow.

danielmiessler avatar Jul 12 '26 17:07 danielmiessler