Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

InstallAll aborts when a USER/CONFIG/services.json row has no `optIn`

Open mj-deving opened this issue 1 month ago • 2 comments

Version

LifeOS 8.761.0 (tag v8.761.0, fb9aef4).

What is broken

Services.ts accepts a per-install service row in LIFEOS/USER/CONFIG/services.json that has a label and an install command but no optIn. status --json then emits that row without an optIn field. InstallAll.ts requires optIn to be a boolean on every row and throws malformed Services.ts row, so the whole install stops at the service step. The loader accepts a row that the installer rejects, and nothing tells the user that optIn is mandatory.

Where (file:line)

  • Reader that rejects: LifeOS/Tools/InstallAll.ts:196 (typeof r?.optIn !== "boolean" → throw).
  • Writer that omits the field: LIFEOS/TOOLS/Services.ts:520 (optIn: s.optIn, undefined for a user row, dropped by JSON.stringify).
  • Loader that lets the row in: LIFEOS/TOOLS/Services.ts:294-301 (loadUserServices keeps every isServiceRow, which checks only label and install).
  • Template: install/USER/CONFIG/services.json:10 documents optIn as a field but not as required.

Repro on a clean tree

From the LifeOS/ directory of a v8.761.0 checkout:

bun -e 'import {parseServiceRows} from "./Tools/InstallAll.ts";
try { parseServiceRows(JSON.stringify([{label:"com.example.mine",loaded:true,available:true}])); console.log("accepted") }
catch (e) { console.log(String(e)) }'

Output:

Error: malformed Services.ts row: {"label":"com.example.mine","loaded":true,"available":true}

That is the row shape Services.ts status --json emits for a user row without optIn (Services.ts:520).

Negative control

The same call with "optIn": true added to the row returns the parsed row and does not throw. Only the missing field causes the abort.

Suggested fix

Either default optIn to true for user rows in loadUserServices (a per-install service is an opt-in extra by nature), or have classifyServiceRow mark a row without a boolean optIn as invalid so it is reported where the user wrote it rather than at install time. The template could also say the field is required. Untested.

mj-deving avatar Oct 30 '26 08:10 mj-deving

Clarification on provenance: the repro above was first run on files byte-identical to the tag, not on a checkout. I have now re-run it on a fresh clone of v8.761.0 (fb9aef4, git status clean), with the same output.

I also ran the full path instead of inferring the status --json step from Services.ts:520. With a throwaway HOME whose .claude/LIFEOS/USER/CONFIG/services.json is [{"label":"com.example.mine","install":"echo hi"}], from LifeOS/:

HOME=$TMPHOME bun install/LIFEOS/TOOLS/Services.ts status --json > status.json
bun -e 'import {parseServiceRows} from "./Tools/InstallAll.ts"; parseServiceRows(await Bun.file("status.json").text())'

status --json exits 0 and emits the user row as {"label":"com.example.mine","loaded":false,"installed":false,"available":false,"cadence":null}, with no optIn. parseServiceRows then throws malformed Services.ts row: {...} on that row. With "optIn": true added to the same user row, all 27 rows parse.

mj-deving avatar Oct 30 '26 09:10 mj-deving

[!NOTE] 🤖 Kai (AI assistant) responding on behalf of Daniel Miessler

Thanks @mj-deving, the repro and the negative control made this quick. A services.json row without optIn is now read as opt-in, both when Services.ts loads it and when InstallAll parses the status output, so such a row is no longer treated as core; only optIn: false makes a row core. Tests cover both paths. This lands in the next release.

danielmiessler avatar Nov 06 '26 13:11 danielmiessler