fix(infra): log restart sentinel cleanup errors instead of silent catch#101687
fix(infra): log restart sentinel cleanup errors instead of silent catch#101687wendy-chsy wants to merge 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 7, 2026, 11:54 AM ET / 15:54 UTC. Summary PR surface: Source +4. Total +4 across 1 file. Reproducibility: yes. Current main has empty catches on both cleanup paths, and the PR body includes live output from forced corrupted-database and invalid-state-path scenarios after the patch. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow diagnostics change once exact-head checks complete, keeping restart sentinel cleanup best-effort while making cleanup failures visible. Do we have a high-confidence way to reproduce the issue? Yes. Current main has empty catches on both cleanup paths, and the PR body includes live output from forced corrupted-database and invalid-state-path scenarios after the patch. Is this the best way to solve the issue? Yes. Logging inside the existing cleanup catches is the narrowest maintainable fix; throwing would change best-effort restart cleanup semantics, and adding a new logger seam would be unnecessary churn here. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3d206140f3f0. Label changesLabel justifications:
Evidence reviewedPR surface: Source +4. Total +4 across 1 file. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…t catch The empty catch blocks in clearRestartSentinel() and removeLegacyRestartSentinel() silently swallowed DB write and file-deletion failures, leaving stale sentinel artifacts that could trigger spurious recovery flows on next restart.
5cf04b6 to
c89de4e
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Superseded by #106385, landed in The landed fix includes this PR's legacy cleanup diagnostic, uses the redacted Thank you for identifying the missing legacy-cleanup visibility and for the original fix. |
Summary
clearRestartSentinel()和removeLegacyRestartSentinel()中的空catch {}改为记录错误Real behavior proof
Behavior or issue addressed: 两个 try-catch 块使用空 catch 吞噬了所有异常,使开发者无法发现清理 restart sentinel 时发生的错误。
Real environment tested: 本地 Linux 环境 (Node 22.21.0, SQLite),通过强制破坏 SQLite 数据库和文件系统结构来触发清理失败路径。
Scenario 1: SQLite 数据库损坏
修复前:此异常被
catch {}静默吞噬,无任何输出。修复后:错误信息和堆栈完整打印到 stderr。
Scenario 2: State 目录被替换为文件(双重失败路径)
修复前:两条错误均被静默吞噬。
修复后:DB 清理和旧版文件清理的失败路径均独立打印错误日志。
Exact steps or command run after this patch:
使用 tsx 脚本强制破坏 SQLite 数据库和文件系统,直接调用 clearRestartSentinel() 触发真实错误。
Evidence after fix:
[openclaw] Failed to ...日志What was not tested:
Tests and validation
所有 27 个现有测试通过,未改动测试文件。
验证命令:
Risk checklist
AI-assisted: 使用 Claude Code 编写此修复。