Repository navigation
fix(memory): close maintenance CLI resources on every exit - #242
Conversation
|
Root 独立审查 exact 独立复跑7/7生命周期子进程测试通过;另3/3组合异常反例通过(业务失败+四项清理失败保留原异常对象、成功+四项失败仅固定stage、usage失败+四项失败保留usage)。四项清理均按序尝试,私有sentinel不进入新清理错误输出,无process.exit强制结束。作者server lint/typecheck通过。本review未安装依赖或操作生产。 这是公开memory:maintain CLI的资源收尾修复,不是原始对话记忆召回延迟的归因,也不需要重做已完成的生产内容迁移。#216实际5条迁移及授权20/20索引已由独立operator v2完成并验收;此PR尚未合并或部署。挂起disposer的额外超时机制及真实服务CLI复验不在这次最小异常/退出修复的测试覆盖中。 独立报告SHA256 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6f0961c63
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ['redis',() => redis.disconnect()], | ||
| ['database',closeDatabasePools], | ||
| ] as const) { | ||
| try {await close()} |
There was a problem hiding this comment.
Bound cleanup stages before advancing
When any disposer never settles, this unbounded await prevents every later disposer from running, so a hung stopLingxiOSControl() leaves both Redis clients and the database pools open and the one-shot CLI still never exits. This is a concrete lifecycle case already covered by docs/evidence/release-215-216-219/memory-maintenance-20261020/v2/lifecycle-budget.test.mjs, where a never-resolving control stop must time out and still allow database cleanup; apply a per-stage deadline and continue recording the failed stage. The new regression only exercises disposers that return or throw, so it misses this path.
AGENTS.md reference: AGENTS.md:L35-L35
Useful? React with 👍 / 👎.
memory:maintaincan finish its public API operation yet remain alive because importing the product runtime opens business Redis clients that the CLI never closes. Its previous shutdown also closed only the primary PostgreSQL pool, and a control shutdown error skipped the remaining cleanup.Close native control, both business Redis clients and both PostgreSQL pools on every exit, including argument validation failures. Attempt all cleanup steps, preserve the operation's existing error when it fails, and report cleanup failures using fixed stage names without printing underlying connection errors. Maintenance authorization, API arguments and normal result payloads are unchanged.
Validation: seven real CLI child-process cases first timed out against the old code, then passed without forced exit after the fix. They cover success, operation/argument failure, each failed disposer, cleanup order and sensitive-error sentinel suppression.
npm run server:lintandnpm run server:typecheckpass.Related to #216. This is a CLI lifecycle defect, not a claim about the original memory recall cause. No production deployment or operator-script change is included.