Skip to content

Doctor: expose session lock findings#84366

Merged
giodl73-repo merged 8 commits into
openclaw:mainfrom
giodl73-repo:doctor-state-session-structured-repairs
Jun 24, 2026
Merged

Doctor: expose session lock findings#84366
giodl73-repo merged 8 commits into
openclaw:mainfrom
giodl73-repo:doctor-state-session-structured-repairs

Conversation

@giodl73-repo

@giodl73-repo giodl73-repo commented May 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Exposes stale session write locks as structured doctor health findings.
  • Adds dry-run repair effects for stale lock removal while keeping the existing session-lock note/repair function authoritative for real doctor / doctor --fix cleanup.
  • Wires the structured check through the ordered doctor contribution path.
  • Keeps core/doctor/session-locks default-disabled for broad lint compatibility, but available through explicit --only core/doctor/session-locks.
  • Keeps the default-selection metadata internal to the doctor runner; defaultEnabled is not part of the public HealthCheck SDK 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 main after #84340 merged. Current branch head is signed commit d0a2fb7b4197af2bdfb0b3469f0bf6ffbdee9c97 (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 shards
  • node_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.ts
  • node_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.ts
  • node node_modules/@typescript/native-preview/bin/tsgo.js -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo --declaration false --singleThreaded --checkers 1
  • node 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 1
  • node scripts/plugin-sdk-surface-report.mjs --check
  • git diff --check

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels May 20, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 24, 2026, 9:43 AM ET / 13:43 UTC.

Summary
The branch adds an opt-in structured Doctor health check for stale session locks, maps lock inspections to findings and repair-preview effects, keeps broad lint compatibility through internal default-selection metadata, and updates adjacent Doctor/session tests.

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.

  • Default-Disabled Doctor Checks: 1 added, 0 removed. The PR adds one opt-in Doctor lint check, which matters because default selection controls whether existing broad doctor --lint users see a new session-state warning.

Stored data model
Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-lint.test.ts, migration/backfill/repair: src/commands/doctor-session-locks.test.ts, migration/backfill/repair: src/commands/doctor-session-locks.ts, migration/backfill/repair: src/flows/doctor-core-checks.test.ts, migration/backfill/repair: src/flows/doctor-core-checks.ts, migration/backfill/repair: src/flows/doctor-health-contributions.ts, and 7 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: canonical
Canonical: #84366
Summary: This PR is the current canonical session-lock slice of a broader structured Doctor health/repair migration stack; related PRs are adjacent slices rather than duplicates or replacements.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Wait for the remaining whole-shard CI jobs to finish before merge.
  • Maintainer should explicitly accept the opt-in default-disabled behavior for core/doctor/session-locks.

Risk before merge

  • [P1] Maintainers still need to accept that broad doctor --lint skips core/doctor/session-locks by default while targeted --only core/doctor/session-locks exposes the new warning surface.
  • [P1] Session-state previews are sensitive: future edits must keep sessionLockToRepairEffect aligned with shouldRemoveLockDuringCleanup so operators are not told a real doctor --fix will remove a lock that legacy cleanup preserves.
  • [P1] At the live check snapshot, two whole-shard CI jobs were still pending; no completed relevant job failure was visible.

Maintainer options:

  1. Accept Opt-In Session-Lock Lint (recommended)
    Maintainers can keep this slice as an explicit-only structured check so existing broad lint users do not get a new stale-lock failure surface.
  2. Wait For Full Structured Repair Ownership
    Maintainers can pause this PR if they want session-lock findings to move only when the actual doctor --fix mutation path is also owned by structured health checks.
  3. Make The Default Policy Explicit In Tests And Review Notes
    If maintainers want extra guardrails, require the branch to keep focused coverage for broad-skip and targeted-run behavior before merge.

Next step before merge

  • [P2] Human review is the right route because the branch has a protected maintainer label and the remaining blocker is maintainer acceptance of compatibility/session-state behavior, not a narrow automated repair.

Security
Cleared: No concrete security or supply-chain concern found; the diff is limited to TypeScript Doctor/session code and tests, with no CI, dependency, lockfile, package-script, permission, or secret-handling changes.

Review details

Best 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 cleanStaleLockFiles and keeping defaultEnabled in internal runner types is the narrowest maintainable approach compared with moving real cleanup now or expanding the public SDK contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against f0be8e7b6ee8.

Label changes

Label justifications:

  • P2: The PR changes Doctor lint and repair-preview visibility for session-lock state with limited but real operator impact.
  • merge-risk: 🚨 compatibility: Merging changes Doctor lint selection semantics by adding an internal default-disabled check that maintainers must accept as the compatible default.
  • merge-risk: 🚨 session-state: The PR exposes stale session-lock repair previews, so drift from the real cleanup predicate could mislead operators about session-state cleanup.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body and comments include terminal/source CLI proof for targeted session-lock lint and broad default-skip behavior; the latest head only changes tests after that proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body and comments include terminal/source CLI proof for targeted session-lock lint and broad default-skip behavior; the latest head only changes tests after that proof.
Evidence reviewed

PR surface:

Source +118, Tests +208. Total +326 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 7 130 12 +118
Tests 5 211 3 +208
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 341 15 +326

What I checked:

Likely related people:

  • giodl73-repo: Recent merged Doctor health-check work established the normalized repair runner, ordered contribution model, and adjacent gateway-services structured check that this PR extends. (role: structured Doctor contributor; confidence: high; commits: 056378efd582, e56fd1dc0466, 67ee0dee00e8; files: src/flows/doctor-core-checks.ts, src/flows/doctor-health-contributions.ts, src/flows/doctor-lint-flow.ts)
  • steipete: Recent session-lock commits shaped live-owned stale-lock preservation, retry behavior, and cleanup/removability semantics that this PR previews as structured effects. (role: recent session-lock behavior contributor; confidence: high; commits: 0b86decf948d, 7ca77124fea0, 210adf1d1189; files: src/agents/session-write-lock.ts, src/commands/doctor-session-locks.ts)
  • Grynn: The legacy stale session-lock watchdog and Doctor cleanup behavior appears to date to the merged fix that added doctor-session-locks.ts and the session write-lock cleanup path. (role: original stale-lock Doctor behavior introducer; confidence: medium; commits: e91a5b021648; files: src/agents/session-write-lock.ts, src/commands/doctor-session-locks.ts)
  • galiniliev: A current PR review found no blocking findings on the previous production-code head; the latest head only adjusts tests for lint satisfaction. (role: recent reviewer; confidence: medium; files: src/commands/doctor-session-locks.test.ts, src/flows/doctor-core-checks.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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 keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels May 20, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@giodl73-repo
giodl73-repo force-pushed the doctor-state-session-structured-repairs branch from ca60316 to 7e3faf7 Compare May 20, 2026 02:13
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label May 20, 2026
@giodl73-repo
giodl73-repo force-pushed the doctor-state-session-structured-repairs branch from e704105 to 27db45d Compare May 20, 2026 04:44
@giodl73-repo
giodl73-repo force-pushed the doctor-state-session-structured-repairs branch from 27db45d to da396f8 Compare May 20, 2026 22:54
@giodl73-repo
giodl73-repo force-pushed the doctor-state-session-structured-repairs branch 3 times, most recently from 47d1818 to 173ca1c Compare May 21, 2026 19:51
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels May 21, 2026
@giodl73-repo
giodl73-repo force-pushed the doctor-state-session-structured-repairs branch 2 times, most recently from d411237 to 88274db Compare May 22, 2026 14:19
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels May 22, 2026
@giodl73-repo
giodl73-repo force-pushed the doctor-state-session-structured-repairs branch 2 times, most recently from de82d85 to 2c1f019 Compare May 22, 2026 20:20
@clawsweeper

clawsweeper Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Pushed 79885a2 to address the session-lock structured lint findings.

Change made:

  • Added defaultEnabled support to health checks in the lint runner.
  • Marked core/doctor/session-locks as defaultEnabled: false so broad doctor --lint stays compatible and does not newly fail on stale lock files.
  • Targeted lint remains available with --only core/doctor/session-locks.
  • Added runner coverage that default-disabled checks are skipped by default and run when explicitly selected.
  • Added the missing removable field to typed SessionLockInspection fixtures in main-session restart recovery tests.

Validation:

  • OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/commands/doctor-session-locks.test.ts src/agents/main-session-restart-recovery.test.ts src/flows/doctor-core-checks.test.ts src/flows/doctor-lint-flow.test.ts src/commands/doctor-lint.test.ts src/flows/doctor-health-contributions.test.ts --reporter=dot
  • pnpm exec oxlint src/agents/session-write-lock.ts src/agents/main-session-restart-recovery.test.ts src/commands/doctor-session-locks.ts src/commands/doctor-session-locks.test.ts src/commands/doctor-lint.ts src/commands/doctor-lint.test.ts src/flows/doctor-core-checks.ts src/flows/doctor-core-checks.test.ts src/flows/doctor-lint-flow.ts src/flows/doctor-lint-flow.test.ts src/flows/health-checks.ts src/flows/doctor-health-contributions.ts src/flows/doctor-health-contributions.test.ts
  • pnpm exec oxfmt --check src/agents/session-write-lock.ts src/agents/main-session-restart-recovery.test.ts src/commands/doctor-session-locks.ts src/commands/doctor-session-locks.test.ts src/commands/doctor-lint.ts src/commands/doctor-lint.test.ts src/flows/doctor-core-checks.ts src/flows/doctor-core-checks.test.ts src/flows/doctor-lint-flow.ts src/flows/doctor-lint-flow.test.ts src/flows/health-checks.ts src/flows/doctor-health-contributions.ts src/flows/doctor-health-contributions.test.ts
  • pnpm tsgo:core
  • git diff --check

@clawsweeper

clawsweeper Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Pushed caa3808 to address the defaultEnabled propagation finding.

Change made:

  • normalizeHealthCheck now preserves defaultEnabled for split checks.
  • normalizeHealthCheck now preserves defaultEnabled for runnable checks.
  • RunnableHealthCheck now includes the optional defaultEnabled field in its shared contract.
  • The lint-flow regression now normalizes the default-disabled check, so it catches adapter regressions.

Validation:

  • OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/flows/doctor-lint-flow.test.ts src/commands/doctor-session-locks.test.ts src/agents/main-session-restart-recovery.test.ts src/flows/doctor-core-checks.test.ts src/commands/doctor-lint.test.ts src/flows/doctor-health-contributions.test.ts --reporter=dot
  • pnpm exec oxlint src/flows/health-check-adapter.ts src/flows/health-check-runner-types.ts src/flows/doctor-lint-flow.test.ts
  • pnpm exec oxfmt --check src/flows/health-check-adapter.ts src/flows/health-check-runner-types.ts src/flows/doctor-lint-flow.test.ts
  • pnpm tsgo:core
  • git diff --check

@clawsweeper

clawsweeper Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Updated the PR body for current head caa3808338d1e2c75ae9022c505c29a0adba72fb so the proof/status gate is not reading the older 1eaff161... head. No code changes after the pushed defaultEnabled normalization fix.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Pushed ded10b780d0e8b89ec6128b1dc7e1df2ed7d6d3c to resolve the public defaultEnabled contract finding.

Change made:

  • Removed defaultEnabled from the public HealthCheck interface exported through openclaw/plugin-sdk/health.
  • Added internal runner selection metadata (HealthCheckSelectionOptions / SplitHealthCheckInput) so core doctor checks can remain default-disabled without expanding the plugin SDK contract.
  • Kept DoctorLintRunOptions public-facing as HealthCheck[]; broad lint now reads the internal flag through a local runtime guard.
  • Preserved defaultEnabled normalization for split and runnable internal check records.

Current-head proof added to the PR body:

  • Source harness at ded10b780d0e8b89ec6128b1dc7e1df2ed7d6d3c against the real core/doctor/session-locks check: broad selection ran 0 checks, skipped 1, and reported 0 session-lock findings; targeted selection ran 1 check and reported 1 session-lock finding.
  • Source CLI node --import tsx src/entry.ts doctor --lint --json --only core/doctor/session-locks: ran 1 check, skipped 22, reported 1 core/doctor/session-locks warning, exit 1.
  • A full broad source CLI run with all default checks timed out locally after 180s before JSON output; the PR body records this as not tested and uses the focused real-check source harness for the broad-selection rule.

Validation:

  • node scripts/run-vitest.mjs run src/flows/doctor-lint-flow.test.ts src/flows/doctor-core-checks.test.ts src/flows/doctor-health-contributions.test.ts --reporter=verbose
  • pnpm tsgo:test:src
  • pnpm exec oxlint src\flows\health-checks.ts src\flows\health-check-runner-types.ts src\flows\health-check-adapter.ts src\flows\doctor-core-checks.ts src\flows\doctor-lint-flow.ts
  • pnpm exec oxfmt --check src\flows\health-checks.ts src\flows\health-check-runner-types.ts src\flows\health-check-adapter.ts src\flows\doctor-core-checks.ts src\flows\doctor-lint-flow.ts
  • node scripts/plugin-sdk-surface-report.mjs --check
  • git diff --check

@clawsweeper

clawsweeper Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Rebased #84366 onto current upstream/main and force-with-lease pushed 15410e711506a96dc43c86da4740f766c03911c0.

Validation after rebase:

  • $env: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 - 73 passed across 3 shards
  • changed-file oxlint
  • changed-file oxfmt --check
  • pnpm tsgo:test:src
  • git diff --check

pnpm tsgo:core is currently blocked on rebased upstream/main by untouched src/config/sessions/session-accessor.ts:1545 (sessionStore unused, TS6133), so I left that outside this session-lock doctor PR.

@clawsweeper please re-review current head.

@clawsweeper

clawsweeper Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper assist is taking a look at your question.

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

clawsweeper Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper assist: I can’t perform a full correctness re-review from this assist context. The current PR head is 15410e711506a96dc43c86da4740f766c03911c0; use @clawsweeper review for the full current-head review pass.

Evidence:

  • PR Doctor: expose session lock findings #84366 is open, draft, mergeable clean, head 15410e711506a96dc43c86da4740f766c03911c0.
  • The author rebased onto upstream/main and force-pushed that head on 2026-06-22T15:37:22Z.
  • Reported validation at current head: 73 focused tests passed, changed-file oxlint, changed-file oxfmt --check, pnpm tsgo:test:src, and git diff --check.
  • Reported blocker: pnpm tsgo:core fails in untouched upstream src/config/sessions/session-accessor.ts:1545 due to unused sessionStore TS6133.
  • Previous ClawSweeper review covered older SHA ded10b780d0e8b89ec6128b1dc7e1df2ed7d6d3c, not the current head.

Suggested next action: Comment @clawsweeper review on #84366 to trigger a full current-head review.


Source: #84366 (comment)
Assist reasoning: low.

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

Updated #84366 to current head bab5116935cc84ae137659266f3ac6478d2cb597 with fix(doctor): unblock session accessor typecheck.

Change made:

  • Removed the unused sessionStore destructure from resolveSessionTranscriptRuntimeReadTarget(...), matching the read/delete probe path and unblocking tsgo:core on this branch.
  • Kept defaultEnabled out of the public HealthCheck SDK contract; the PR body still records the plugin SDK surface check.

Validation at current head:

  • Focused session-lock/lint/core/lint-flow/main-session Vitest: 73 tests passed across 3 shards.
  • Changed-file oxlint including src/config/sessions/session-accessor.ts.
  • Changed-file oxfmt --check including src/config/sessions/session-accessor.ts.
  • Core tsgo passed.
  • Test-source tsgo passed.
  • node scripts/plugin-sdk-surface-report.mjs --check passed.
  • git diff --check passed.

@clawsweeper

clawsweeper Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

Refreshed #84366 after #84340 merged and pushed current head d0a2fb7b4197af2bdfb0b3469f0bf6ffbdee9c97.

Change made:

  • Rebased the session-lock structured Doctor slice onto current main.
  • Resolved the ordered core-check conflict by keeping Doctor: expose extra gateway service findings #84340's gateway-services structured check and Doctor: expose session lock findings #84366's session-lock check together.
  • The prior sessionStore cleanup dropped out because it is already on current main via the merged stack.
  • Public plugin contract remains unchanged: defaultEnabled stays out of public HealthCheck, and plugin-sdk-surface-report --check passes.

Validation at current head:

  • Focused session-lock/lint/core/lint-flow/main-session Vitest: 78 tests passed across 3 shards.
  • Changed-file oxlint passed.
  • Changed-file oxfmt --check passed.
  • Core tsgo passed.
  • Test-source tsgo passed.
  • node scripts/plugin-sdk-surface-report.mjs --check passed.
  • git diff --check passed.

@clawsweeper

clawsweeper Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@galiniliev galiniliev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --fix cleanup, 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 defaultEnabled to the public plugin SDK HealthCheck interface: rejected because the only current need is core runner selection metadata, and the PR keeps src/plugin-sdk/health.ts surface 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.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Thanks @giodl73-repo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants