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

Open Beginner friendly
#2,590 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 9 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
66/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Start with mergeSettingsPreserving and the INSTALLER_OWNED_KEYS list, which the issue names as the places where installer-owned keys are carried forward. Reproduce with the inputs given in the issue, where the merged hooks map should keep Stop and UserPromptSubmit but currently keeps only Stop. Done means a merge where the overlay names some hook events keeps the installer's other events, with a test covering that case.

Written by the indexing model from the issue text.

Description

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.

Dominant language
TypeScript
Stars
19.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from danielmiessler/LifeOS

All issues in danielmiessler/LifeOS

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.