Commit Graph
3 Commits
Author SHA1 Message Date
muse 45be478d70 fix(host): daemon 循环把显式 --state 透传给 recover/run-due 子进程
复核结论:应继承,不是原行为有意。daemon 本体的 pidfile/
logfile 按解析后 args.state 落盘,但旧循环只传 --config,
子进程回落到配置 state(或默认 state);CLI --state 与
配置 state 不同时,recover/run-due 跑的不是同一 state 文件。
修法:main() 解析前先记 explicit_state(argparse --state
默认 None,未给即 None);循环里仅当 explicit_state 非 None
时追加 --state,未显式给时不加、子进程按原规则解析,
与 daemon 本体一致、行为不变。daemonize() 本身只接
pidfile/logfile,不涉及 state,问题在 main() 循环里。
回归:DaemonStatePassthroughTest(2 项),旧代码上显式
项 fail、无显式项 pass,新代码上 2 项全 pass。
2026-11-03 02:49:25 +00:00
muse 1156d3c754 fix(host): _load_config_file 与 init 的 open() 改用 with 关闭
行号纠正:摘要的 2199/2443 是另一基线行号;origin/main
aebc623 上两处是 _load_config_file 的 json.load(open(path))
与 main() init 分支的 json.dump(init_cfg, open(...)),
2443 行在 aebc623 上是 if not args.repo: 并无 open。
只改资源关闭:open 参数、读写内容、错误语义(坏 JSON 仍
转 RuntimeError)均不变,不加 encoding、不改其它裸 open()。
回归:ConfigFileCloseTest(3 项),旧代码上 3 项全 fail、
新代码上全 pass(warnings 过滤 + gc 证明无 ResourceWarning)。
2026-11-03 02:49:25 +00:00
muse e768959c93 fix(host): _read_loop 跳过非 dict JSON 消息,不再静默死亡
收到合法 JSON 但值不是 dict(如 ""、123、[]、null)时,
旧代码走到 msg.get('params') 抛 AttributeError/TypeError,
被外层 except 吞掉后读线程退出,此后所有 request() 等到超时。
现校验后记 stderr 日志并跳过,读循环继续;脏消息不进
events、不当正常请求处理。畸形 JSON 本已由 json.loads 的
except continue 处理,本次未改动该路径。
回归:tests/test_host_bugfix_host.py ReadLoopNonDictTest(2 项)
2026-11-03 02:49:25 +00:00