Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

[bug] MergeSettings drops every installer hook event the user overlay does not mention

Open dsather opened this issue 1 month ago • 1 comments

What happened

MergeSettings drops every installer hook event the user overlay does not mention

Summary

mergeSettingsPreserving carries INSTALLER_OWNED_KEYS (hooks, statusLine, spinnerVerbs, spinnerTipsOverride) forward from the existing settings.json only when neither layer defines the key. Since 8.761.0 the shipped settings.system.json carries no hooks key, so the first time the user overlay defines hooks at all (SettingsBackport writes it as soon as the user adds one hook to one event), the merge takes the overlay's hooks map wholesale and every installer event the overlay does not name disappears from settings.json.

Observed: an overlay naming SessionStart, Stop and StopFailure left settings.json with those 3 events; PreToolUse, PostToolUse, SessionEnd, UserPromptSubmit, PostToolUseFailure, ConfigChange, PermissionRequest and Notification were gone (27 hooks, memory injection and turn records included). /ic hook_wiring reported 17 mis-wired. Nothing warned at merge time.

Repro: mergeSettingsPreserving({}, { hooks: { Stop: [ ... ] } }, { hooks: { Stop: [ ... ], UserPromptSubmit: [ ... ] } }) returns hooks with Stop only.

Fix applied locally: when existing[k] and merged[k] are both plain objects, copy each sub-key of existing[k] that merged[k] lacks. With that, the overlay keeps owning the events it names and the installer's other events survive. Restoring the lost events was a dry-run then --apply of InstallHooks (additive, idempotent), followed by the normal backport + merge.

Related: #2497 (the append annotation leak under a system-absent key), which hides this one because the ignored SessionStart hook is the regeneration itself.

Details

  • Kind: bug
  • LifeOS version: 8.761.0

Filed with the LifeOS /feedback command. The reporter approved this exact text before it was sent; paths, secrets and personal details were stripped locally.

dsather avatar Nov 03 '26 19:11 dsather

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

Thanks @dsather. You were right that the overlay took the whole hooks map. Now the installed hooks in settings.json are always the base when settings.system.json has no hooks, and every event the overlay names is appended to rather than swapped out, so the other installer events stay. A merge that would drop an installed hook group now fails instead of writing. This lands in the next release.

danielmiessler avatar Nov 06 '26 13:11 danielmiessler