Skip to content

fix(lifecycle): 修复进程生命周期缺陷,防止投递停滞 (#71) - #72

Open
hugozhu wants to merge 2 commits into
mainfrom
fix/71-process-lifecycle
Open

fix(lifecycle): 修复进程生命周期缺陷,防止投递停滞 (#71)#72
hugozhu wants to merge 2 commits into
mainfrom
fix/71-process-lifecycle

Conversation

@hugozhu

@hugozhu hugozhu commented Jul 23, 2026

Copy link
Copy Markdown
Owner

背景

dws event consume 会派生 dws event _bus 子进程持流连接。旧代码 kill <consumer> 会把 _bus 甩成孤儿被 init 收养——它继续占着订阅消费消息,重启后新旧 _bus 抢投递,表象为「投递停滞 / 收不到消息」(#71)。

改动

  • dws-connect.sh:consumer 退出 / 收 TERM 时,连同其 dws event _bus 子树一起清(_kill_subtree + EXIT/TERM trap),不再留孤儿。
  • stop.sh / monitor.sh:新增 stop_extra_cleanup custom 钩子,按 DWS_PROFILE 精确清扫进程树够不着的残留 dws event 孤儿;stop.sh 按「bash+路径」双条件杀 monitor(含无参数手工启动的)。
  • reboot.sh:用 env -i 干净环境跑 stop/start,使改后的 config/constants.local.sh 生效(避免继承旧 env 压住 ${VAR:-...} 赋值)。
  • e2e 脚本:HTTP serve 就绪探测替代裸 sleep + 模型兜底;文本测试补 keychain 锁定提示。
  • unit_test.sh:补 彻底优化:重新审视项目现状并做一次系统性梳理与优化 #71 生命周期回归断言。

测试

🤖 Generated with Claude Code

hugozhu and others added 2 commits July 23, 2026 19:10
ack 之前只在失败时记 monitor.log,成功回执无迹可循——遇到"用户消息有
表情但看不到日志"时无从判断回执到底跑没跑。

新增 _dlog():AGENT_DEBUG 时把 收到/升级/收尾/仅已读 四个生命周期点记到
monitor.log(复用 core.log,与 ack 失败日志同文件同 "ack:" 前缀),均带
msgId,可与 agent-connect.log 入站行同 id 对齐。失败日志不受开关影响,恒记。

验证:test_ack_capability.py 38/38;打桩直连 on_inbound → monitor.log 出现
三行 [agent] ack: 收到/升级/收尾。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- dws-connect.sh: consumer 退出/收 TERM 时连同 `dws event _bus` 子树一起清,
  避免 _bus 被甩成孤儿继续占订阅(新旧 _bus 抢投递 → 投递停滞)
- stop.sh / monitor.sh: 新增 stop_extra_cleanup 钩子,按 DWS_PROFILE 精确清扫
  进程树够不着的残留 dws event 孤儿;stop.sh 按「bash+路径」双条件杀 monitor
- reboot.sh: 用 env -i 干净环境跑 stop/start,使改后的 config 生效
- e2e 脚本: HTTP serve 就绪探测替代裸 sleep + 模型兜底;文本测试 keychain 锁定提示
- unit_test.sh: 补 #71 生命周期回归断言(29 passed)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant