MergeSettings leaks raw __merge append annotations into settings.json when settings.system.json has no hooks key
メンテナーはふだん 5 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 82/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- bun, typescript
- 領域
- backend
調査の方向性
LifeOS/install/LIFEOS/TOOLS/MergeSettings.tsを読み、特に187行目付近のmergeSettings()を確認し、提供されたプローブを使ってoverlayのみに存在するhooksのケースを再現してください。システム設定にhooksがない場合に、appendアノテーションが配列になることを確認してください。プローブが正常終了し、生成されたsettings.jsonにhookイベントの配列が含まれれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- TypeScript
- スター
- 19.9k
- フォーク
- 2.5k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
danielmiessler/LifeOS のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
danielmiessler/LifeOS#2894 ·
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
danielmiessler/LifeOS#2888 ·
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
danielmiessler/LifeOS#2886 ·
メンテナーはふだん 5 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
danielmiessler/LifeOS#2848 ·
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
danielmiessler/LifeOS#2635 ·
メンテナーはふだん 5 日以内に返信
danielmiessler/LifeOS の issue をすべて見る
似ている issue
-
ready-for-agent
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
LucasSantana-Dev/Lucky#3257 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
XiaomiMiMo/MiMo-Code#2849 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement frontend good first issue help wanted testing-infrastructure
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信
-
enhancement follow-up
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
obsidian-tasks-group/obsidian-tasks#4155 ·
メンテナーはふだん 1 日以内に返信