Doctor: expose session lock findings#84366
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 24, 2026, 9:43 AM ET / 13:43 UTC. Summary PR surface: Source +118, Tests +208. Total +326 across 12 files. Reproducibility: not applicable. as a bug reproduction. This PR adds a structured Doctor visibility path for existing session-lock cleanup behavior, so the relevant check is whether source and proof preserve cleanup semantics while adding targeted lint output. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 only after maintainers accept the opt-in structured-lint behavior and session-state preview contract, keeping legacy session-lock cleanup as the real mutation owner until a deliberate full structured-repair migration. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction. This PR adds a structured Doctor visibility path for existing session-lock cleanup behavior, so the relevant check is whether source and proof preserve cleanup semantics while adding targeted lint output. Is this the best way to solve the issue? Yes, if maintainers accept the product choice. Reusing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f0be8e7b6ee8. Label changesLabel justifications:
Evidence reviewedPR surface: Source +118, Tests +208. Total +326 across 12 files. 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 PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
ca60316 to
7e3faf7
Compare
e704105 to
27db45d
Compare
27db45d to
da396f8
Compare
47d1818 to
173ca1c
Compare
d411237 to
88274db
Compare
de82d85 to
2c1f019
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Pushed 79885a2 to address the session-lock structured lint findings. Change made:
Validation:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Pushed caa3808 to address the defaultEnabled propagation finding. Change made:
Validation:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Updated the PR body for current head |
|
@clawsweeper re-review Pushed Change made:
Current-head proof added to the PR body:
Validation:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Rebased #84366 onto current Validation after rebase:
@clawsweeper please re-review current head. |
|
🦞👀 I queued a lightweight read-only assist pass. It will post a separate answer comment and will not edit the durable ClawSweeper review comment or trigger close, merge, repair, label, or branch changes. Request: please re-review current head. |
|
ClawSweeper assist: I can’t perform a full correctness re-review from this assist context. The current PR head is Evidence:
Suggested next action: Comment Source: #84366 (comment) |
|
@clawsweeper review Updated #84366 to current head Change made:
Validation at current head:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper review Refreshed #84366 after #84340 merged and pushed current head Change made:
Validation at current head:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
galiniliev
left a comment
There was a problem hiding this comment.
This PR exposes stale session write locks through the structured Doctor health-check path while keeping the existing legacy session-lock note and cleanup function as the real doctor / doctor --fix owner. That matters because the new doctor --lint --only core/doctor/session-locks path can now report session-state problems without broad lint starting to fail on existing stale locks.
LOC: +330/-15 (12 files)
By: Gio Della-Libera (@giodl73-repo, acct 2025-09-30) | OpenClaw: 185 PRs, 14 issues, 134 commits/12mo | GitHub: 6339 commits, 219 PRs, 29 issues, 17 reviews/12mo
Findings: No blocking findings.
Affected surface: Doctor lint/repair health checks and session write-lock diagnostics: src/commands/doctor-session-locks.ts, src/agents/session-write-lock.ts, src/flows/doctor-core-checks.ts, src/flows/doctor-lint-flow.ts, src/flows/health-check-adapter.ts, and the adjacent doctor/session tests.
Bug/behavior being fixed: stale session lock files are now available as structured Doctor findings/effects for explicit lint selection, while broad doctor --lint remains compatible because core/doctor/session-locks is default-disabled.
Provenance: N/A. This is a structured Doctor migration slice on top of the existing session-lock cleanup behavior, not a regression fix.
Best-fix verdict: best. The PR reuses cleanStaleLockFiles(..., removeStale: false) plus the same shouldRemoveLockDuringCleanup-derived removable decision used by real cleanup, so preview effects do not fork the session-state ownership predicate. Keeping defaultEnabled in internal runner types instead of the public HealthCheck SDK contract is also the right boundary for an OpenClaw-core selection policy.
Alternatives considered:
- Move session-lock cleanup fully into the structured repair runner now: rejected because the ordered legacy contribution still owns user-visible
doctor --fixcleanup, and this PR intentionally avoids adding a second mutating path. - Enable the structured check by default in broad
doctor --lint: rejected because existing users can have stale/report-only lock files, so broad lint would gain a new session-state failure surface. - Add
defaultEnabledto the public plugin SDKHealthCheckinterface: rejected because the only current need is core runner selection metadata, and the PR keepssrc/plugin-sdk/health.tssurface unchanged.
Code read: src/commands/doctor-session-locks.ts, src/agents/session-write-lock.ts, src/agents/session-dirs.ts, src/config/paths.ts, src/commands/doctor-lint.ts, src/flows/doctor-core-checks.ts, src/flows/doctor-health-contributions.ts, src/flows/doctor-lint-flow.ts, src/flows/doctor-repair-flow.ts, src/flows/health-check-adapter.ts, src/flows/health-check-runner-types.ts, src/flows/health-checks.ts, src/plugin-sdk/health.ts, and adjacent tests.
Validation run locally at current PR head d0a2fb7b4197af2bdfb0b3469f0bf6ffbdee9c97:
OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs run src/commands/doctor-session-locks.test.ts src/commands/doctor-lint.test.ts src/flows/doctor-core-checks.test.ts src/flows/doctor-lint-flow.test.ts src/agents/main-session-restart-recovery.test.ts --reporter=dot- passed, 78 tests across 3 shards.git diff --check origin/main...HEAD- passed.node scripts/plugin-sdk-surface-report.mjs --check- passed.
Live check snapshot: gh pr checks 84366 --watch=false shows required/relevant checks passing or skipped on this draft, including Real behavior proof, actionlint, dispatch, no-tabs, and runner-admission.
Remaining uncertainty: I did not run broad Crabbox/Testbox proof or full pnpm check; this is still a draft PR with compatibility/session-state risk labels, so maintainer acceptance of the opt-in structured-lint behavior is still the merge decision.
|
Merged via squash.
Thanks @giodl73-repo! |
Summary
doctor/doctor --fixcleanup.core/doctor/session-locksdefault-disabled for broad lint compatibility, but available through explicit--only core/doctor/session-locks.defaultEnabledis not part of the publicHealthCheckSDK contract.This is intentionally the session-lock slice from the doctor repair stack. It does not change session directory discovery, lock ownership detection, or the real mutating cleanup path.
Stack
Rebased onto current
mainafter #84340 merged. Current branch head is signed commitd0a2fb7b4197af2bdfb0b3469f0bf6ffbdee9c97(fix(doctor): keep health check defaults internal).Validation
Current head
d0a2fb7b4197af2bdfb0b3469f0bf6ffbdee9c97:OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs run src/commands/doctor-session-locks.test.ts src/commands/doctor-lint.test.ts src/flows/doctor-core-checks.test.ts src/flows/doctor-lint-flow.test.ts src/agents/main-session-restart-recovery.test.ts --reporter=dot- 78 tests passed across 3 shardsnode_modules/oxlint/bin/oxlint src/agents/main-session-restart-recovery.test.ts src/agents/session-write-lock.ts src/commands/doctor-lint.test.ts src/commands/doctor-session-locks.test.ts src/commands/doctor-session-locks.ts src/flows/doctor-core-checks.test.ts src/flows/doctor-core-checks.ts src/flows/doctor-health-contributions.ts src/flows/doctor-lint-flow.test.ts src/flows/doctor-lint-flow.ts src/flows/health-check-adapter.ts src/flows/health-check-runner-types.tsnode_modules/oxfmt/bin/oxfmt --check src/agents/main-session-restart-recovery.test.ts src/agents/session-write-lock.ts src/commands/doctor-lint.test.ts src/commands/doctor-session-locks.test.ts src/commands/doctor-session-locks.ts src/flows/doctor-core-checks.test.ts src/flows/doctor-core-checks.ts src/flows/doctor-health-contributions.ts src/flows/doctor-lint-flow.test.ts src/flows/doctor-lint-flow.ts src/flows/health-check-adapter.ts src/flows/health-check-runner-types.tsnode node_modules/@typescript/native-preview/bin/tsgo.js -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo --declaration false --singleThreaded --checkers 1node node_modules/@typescript/native-preview/bin/tsgo.js -p test/tsconfig/tsconfig.test.src.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/test-src.tsbuildinfo --declaration false --singleThreaded --checkers 1node scripts/plugin-sdk-surface-report.mjs --checkgit diff --check