MergeSettings leaks raw __merge append annotations into settings.json when settings.system.json has no hooks key
Los mantenedores suelen responder en 5 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 82/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- bun, typescript
- Área
- backend
Línea de trabajo
Lee LifeOS/install/LIFEOS/TOOLS/MergeSettings.ts, especialmente mergeSettings() cerca de la línea 187, y reproduce el caso de hooks solo en el overlay con la sonda proporcionada. Confirma que una anotación de anexado se convierte en un array cuando hooks no está en la configuración del sistema; la tarea estará terminada cuando la sonda finalice correctamente y el settings.json generado contenga arrays para los eventos de hooks.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Version
LifeOS 8.761.0. The buggy line is present in v8.761.0 and in current main (both at line 187, checked via the GitHub API). This install now carries the fix below, so attestation reports LIFEOS/TOOLS/MergeSettings.ts as modified.
What is broken
When settings.system.json has no hooks key (as shipped) and the overlay LIFEOS/USER/CONFIG/settings.user.json writes a hook event as an append annotation ({ "__merge": "append", "values": [...] }, the form SettingsBackport.ts produces), MergeSettings.ts copies the annotation object into settings.json unchanged instead of resolving it to an array. Claude Code then rejects each such event at startup (Hook event "Stop" must be an array of matchers; received object. This entry was ignored.) and every hook under it stops running. On this install that was PostToolUse, SessionStart, Stop and UserPromptSubmit (38 matcher entries). MergeSettings.ts --check reports "no differences" in that state, because it compares the file against the same merge.
Where (file:line)
LifeOS/install/LIFEOS/TOOLS/MergeSettings.ts:187, in mergeSettings(): the object branch requires isObjectRecord(system) && isObjectRecord(user), so an overlay-only object key falls through to cloneJsonValue(user) and nested annotations are never resolved.
Repro on a clean tree
- Leave
settings.system.jsonwithout ahookskey (the shipped default). - In
LIFEOS/USER/CONFIG/settings.user.json, set"hooks": { "Stop": { "__merge": "append", "values": [ { "hooks": [ { "type": "command", "command": "true" } ] } ] } }. - Run
bun LIFEOS/TOOLS/MergeSettings.ts --system settings.system.json --user LIFEOS/USER/CONFIG/settings.user.json --output settings.json. hooks.Stopinsettings.jsonis the raw annotation object, and the next Claude Code launch reports it as ignored.
Minimal probe, run next to a copy of LIFEOS/TOOLS/ (plus LIFEOS/PULSE/lib/atomic-write.ts):
import { mergeSettings } from "./LIFEOS/TOOLS/MergeSettings.ts";
const merged = mergeSettings({}, {
hooks: { Stop: { __merge: "append", values: [{ hooks: [{ type: "command", command: "true" }] }] } },
});
const ok = Array.isArray(merged.hooks.Stop);
console.log(`hooks.Stop -> ${ok ? "array" : JSON.stringify(merged.hooks.Stop)}`);
process.exit(ok ? 0 : 1);
Negative control
Unpatched v8.761.0 file, bun probe.ts, exit 1:
hooks.Stop -> {"__merge":"append","values":[{"hooks":[{"type":"command","command":"true"}]}]}
Suggested fix
Recurse whenever the user value is an object, treating an absent system side as {}. Overlay-only keys then get the same annotation handling as shared keys, so a nested append annotation resolves through applyArrayMerge(undefined, annotation) to its values array. The patch applies cleanly to main.
diff --git a/LifeOS/install/LIFEOS/TOOLS/MergeSettings.ts b/LifeOS/install/LIFEOS/TOOLS/MergeSettings.ts
--- a/LifeOS/install/LIFEOS/TOOLS/MergeSettings.ts
+++ b/LifeOS/install/LIFEOS/TOOLS/MergeSettings.ts
@@ -184,7 +184,11 @@ export function mergeSettings(system: any, user: any): any {
);
}
- if (isObjectRecord(system) && isObjectRecord(user)) {
+ if (isObjectRecord(user)) {
+ // A user object whose system side is absent still recurses, so annotations nested under a key
+ // only the overlay defines resolve. settings.system.json omits `hooks`, and SettingsBackport
+ // writes hooks.<Event> as append annotations: cloning here leaked them raw into settings.json.
+ if (!isObjectRecord(system)) system = {};
const merged: Record<string, any> = {};
for (const key of Object.keys(system)) {
Verified after fix
Same probe, exit 0: hooks.Stop -> array. A real regeneration produces arrays for all four events.
Related: Report.ts cannot file this
This was written by hand because Tools/Report.ts could not produce it. Redact.ts swaps every configured name case-insensitively, and when the DA is named LifeOS every LifeOS/LIFEOS path, the repo name and the diff become <name>, and the send gate then refuses any body that still contains the name. Excluding the product name from the redaction list would fix it.
Environment
- OS: macOS 27.3 (arm64)
- Harness: claude-code
- bun: 1.4.4
- Lenguaje dominante
- TypeScript
- Estrellas
- 19.9k
- Forks
- 2.5k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de danielmiessler/LifeOS
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
danielmiessler/LifeOS#2894 ·
Los mantenedores suelen responder en 5 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
danielmiessler/LifeOS#2888 ·
Los mantenedores suelen responder en 5 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
danielmiessler/LifeOS#2886 ·
Los mantenedores suelen responder en 5 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
danielmiessler/LifeOS#2848 ·
Los mantenedores suelen responder en 5 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
danielmiessler/LifeOS#2635 ·
Los mantenedores suelen responder en 5 días
Todos los issues de danielmiessler/LifeOS
Issues similares
-
ready-for-agent
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
LucasSantana-Dev/Lucky#3257 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
XiaomiMiMo/MiMo-Code#2849 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
enhancement frontend good first issue help wanted testing-infrastructure
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 2 días
-
enhancement follow-up
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
obsidian-tasks-group/obsidian-tasks#4155 ·
Los mantenedores suelen responder en 1 día