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

Chiusa Adatta ai principianti
#2,590 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 7 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
66/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Inizia da mergeSettingsPreserving e dalla lista INSTALLER_OWNED_KEYS, che la issue indica come i punti in cui vengono riportate le chiavi di proprietà dell'installer. Riproduci con gli input forniti nella issue: la mappa hooks unita dovrebbe mantenere Stop e UserPromptSubmit, ma attualmente conserva solo Stop. È completato quando un merge in cui l'overlay nomina alcuni eventi di hook mantiene gli altri eventi dell'installer, con un test che copre questo caso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
19.7k
Fork
2.5k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di danielmiessler/LifeOS

Tutte le issue di danielmiessler/LifeOS

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.