[bug] MergeSettings.ts leaves { "__merge": "append" } wrappers under hooks in the…
维护者通常 5 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- bun, typescript
- 领域
- tooling
调研方向
阅读 LIFEOS/TOOLS/MergeSettings.ts,尤其是 mergeSettings,并追踪当系统层省略用户专有对象键的父键时,这些对象键如何处理。使用提供的系统和用户 JSON 重现该情况,然后检查嵌套的追加注释是否解析为数组,以及其他输出键是否保持不变。添加建议的回归测试,并将其与使用 --check 的合并命令一同运行。
由索引模型根据 Issue 内容生成。
描述
What happened
MergeSettings.ts leaves { "__merge": "append" } wrappers under hooks in the generated settings.json when settings.system.json has no hooks key, so Claude Code ignores PostToolUse, SessionStart, Stop and UserPromptSubmit hooks
Summary
What happens
LIFEOS/TOOLS/MergeSettings.ts writes { "__merge": "append", "values": [...] } wrappers into the generated settings.json when the annotated key sits under a parent that the system layer does not define.
Claude Code then rejects each affected hook event:
Hook event "PostToolUse" must be an array of matchers; received object. This entry was ignored.
Every hook under those events stops running. The SessionStart hook that reruns the merge is one of them, so the install does not repair itself.
Cause
In mergeSettings(system, user), a key that exists only in the user overlay is merged as mergeSettings(undefined, user[key]). When that value is a plain object, neither the annotation branch nor the object-merge branch matches, and the function returns cloneJsonValue(user). The object is copied whole, so append annotations nested inside it are never resolved.
settings.system.json ships without a hooks key (hooks are installer-owned), so hooks always takes this path. SettingsBackport.ts writes append annotations into the user overlay for appended hooks, which is what puts them there. permissions.allow is unaffected because permissions exists in the system layer.
validateRoundTripOrThrow and --check both pass on the broken output.
Reproduce
- System layer: any valid file with no
hookskey. - User overlay:
{ "hooks": { "Stop": { "__merge": "append", "values": [ { "hooks": [ { "type": "command", "command": "true" } ] } ] } } }
- Run the merge to a scratch path:
bun LIFEOS/TOOLS/MergeSettings.ts --system system.json --user user.json --output out.json
hooks.Stopinout.jsonis the wrapper object. Expected: the array fromvalues.
Fix verified locally
Before the final return cloneJsonValue(user); in mergeSettings:
if (isObjectRecord(user)) {
const merged: Record<string, any> = {};
for (const key of Object.keys(user)) {
if (isRemoveAnnotation(user[key])) continue;
merged[key] = mergeSettings(undefined, user[key]);
}
return merged;
}
With this patch the four affected events (PostToolUse, SessionStart, Stop, UserPromptSubmit) come out as arrays with the same content, every other key in the output is unchanged, and --check reports no differences.
Suggested follow-ups
- A regression test for an append annotation nested under a parent the system layer omits.
- Make the round-trip validation fail when any
__mergekey survives in the output.
Versions
LifeOS 8.761.0, MergeSettings 1.3.16 (file header), macOS.
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.
- 主要语言
- TypeScript
- 星标
- 19.9k
- 派生
- 2.5k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
danielmiessler/LifeOS 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 67/100
danielmiessler/LifeOS#2894 ·
维护者通常 5 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
danielmiessler/LifeOS#2891 ·
维护者通常 5 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
danielmiessler/LifeOS#2888 ·
维护者通常 5 天内回复
-
难度 1/5 1 小时以内 新手友好度 68/100
danielmiessler/LifeOS#2848 ·
维护者通常 5 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
danielmiessler/LifeOS#2635 ·
维护者通常 5 天内回复
查看 danielmiessler/LifeOS 的全部 Issue
相似的 Issue
-
[功能请求] 设置选项语言调整未关闭功能请求
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
antithesishq/bombadil#473 ·
维护者通常 2 天内回复
-
The structured output reference promises null results for refusals that carry validation details未关闭bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
mattermost/mattermost-mobile#10358 ·
维护者通常 1 天内回复
-
ready-for-agent
难度 1/5 1 小时以内 新手友好度 86/100
LucasSantana-Dev/Lucky#3257 ·
维护者通常 1 天内回复