fix: apply_model_changes 仅在配置变化时备份,修复 extend 类型错误#170
Open
wangjiu7521 wants to merge 1 commit intocft0808:mainfrom
Open
fix: apply_model_changes 仅在配置变化时备份,修复 extend 类型错误#170wangjiu7521 wants to merge 1 commit intocft0808:mainfrom
wangjiu7521 wants to merge 1 commit intocft0808:mainfrom
Conversation
**问题一:无效备份不断堆积** 当 pending_model_changes.json 中的变更与 openclaw.json 现有值相同时 (即 model 已经是目标值),脚本仍会创建备份文件并重写配置, 导致每 15 秒产生一个内容完全相同的 .bak.model-* 文件。 修复:先比较新旧配置的 JSON 内容,只有真正发生变化时才备份和写入。 **问题二:log_data.extend() AttributeError 导致 pending 永不清空** CHANGE_LOG 文件损坏或内容为 dict 时,rj() 返回 dict 而非 list, 调用 .extend() 抛出 AttributeError,使函数在第 75 行中断。 后续的 atomic_json_write(PENDING, []) 永远不会执行, pending_model_changes.json 始终非空,造成每次循环都重复处理。 修复:在 extend 前加 isinstance 检查,非 list 时重置为空列表。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题一:无效备份不断堆积
当 pending_model_changes.json 中的变更与 openclaw.json 现有值相同时 (即 model 已经是目标值),脚本仍会创建备份文件并重写配置,
导致每 15 秒产生一个内容完全相同的 .bak.model-* 文件。
修复:先比较新旧配置的 JSON 内容,只有真正发生变化时才备份和写入。
问题二:log_data.extend() AttributeError 导致 pending 永不清空 CHANGE_LOG 文件损坏或内容为 dict 时,rj() 返回 dict 而非 list,
调用 .extend() 抛出 AttributeError,使函数在第 75 行中断。
后续的 atomic_json_write(PENDING, []) 永远不会执行,
pending_model_changes.json 始终非空,造成每次循环都重复处理。
修复:在 extend 前加 isinstance 检查,非 list 时重置为空列表。
变更描述
变更类型
检查清单
python3 -m py_compile检查run_loop.sh关联 Issue