Skip to content

fix(doctor): detect stale session snapshot paths#82867

Merged
giodl73-repo merged 6 commits into
openclaw:mainfrom
giodl73-repo:fix-doctor-stale-session-snapshots-47534
May 17, 2026
Merged

fix(doctor): detect stale session snapshot paths#82867
giodl73-repo merged 6 commits into
openclaw:mainfrom
giodl73-repo:fix-doctor-stale-session-snapshots-47534

Conversation

@giodl73-repo

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

Copy link
Copy Markdown
Contributor

Fixes #47534.

Summary

  • add a read-only doctor health contribution for stale cached session snapshot metadata
  • scan persisted session stores for cached bundled skill paths in skillsSnapshot.prompt, runtime-only skillsSnapshot.resolvedSkills, and systemPromptReport.injectedWorkspaceFiles
  • distinguish healthy live bundled skills root from stale cached metadata paths and avoid false positives for current runtime paths, workspace skill roots, and Windows paths

Tests

  • CI=1 node scripts/run-vitest.mjs src/commands/doctor-session-snapshots.test.ts src/commands/doctor-session-transcripts.test.ts
  • pnpm exec oxfmt --check --threads=1 src/commands/doctor-session-snapshots.ts src/commands/doctor-session-snapshots.test.ts src/flows/doctor-health-contributions.ts
  • git diff --check
  • pnpm check:changed

Real behavior proof

Behavior or issue addressed: openclaw doctor did not warn when cached session snapshot metadata still referenced bundled skills under an inactive OpenClaw runtime root after an install/runtime path change.

Real environment tested: WSL Ubuntu source checkout with deterministic temp session-store fixtures and the real doctor session snapshot scanner registered through the doctor health contribution list.

Exact steps or command run after this patch: CI=1 node scripts/run-vitest.mjs src/commands/doctor-session-snapshots.test.ts src/commands/doctor-session-transcripts.test.ts, pnpm check:changed, and the scripted before/after proof published below.

Evidence after fix: before/after proof

Observed result after fix: Before origin/main, no doctor session snapshot detector/contribution exists. After this PR, stale POSIX install-root, temp-backed, and Windows cached bundled skill paths are reported, while current-runtime and workspace skill paths are not false positives. The doctor note distinguishes the healthy live bundled skills root from stale cached session metadata and gives safe fresh-session/reset guidance.

What was not tested: A live macOS Homebrew install migration was not run; the proof uses source-level session-store fixtures for the stale cached metadata shape from the issue.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: L maintainer Maintainer-authored PR labels May 17, 2026
@clawsweeper

clawsweeper Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Workflow note: Future ClawSweeper reviews update this same comment in place.

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 maintainer comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors can comment @clawsweeper re-review or @clawsweeper re-run on their own 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.

Summary
The PR adds a read-only openclaw doctor health contribution that scans session snapshot metadata for stale bundled-skill paths after runtime path changes.

Reproducibility: yes. Source inspection shows current main lacks the session snapshot doctor contribution, and the PR proof artifacts demonstrate before/after detection of stale cached bundled-skill paths without current-runtime or workspace false positives.

Real behavior proof
Sufficient (linked_artifact): The PR body and comments include inspected linked logs plus a PNG artifact showing before-main absence and after-fix stale path detection with false-positive checks.

Next step before merge
The PR has a protected maintainer label and no narrow automated repair remains after review, so it should route to maintainer review/landing rather than ClawSweeper repair.

Security
Cleared: The diff adds local read-only session-store scanning, tests, and doctor registration only; no dependency, workflow, permission, credential, or external code-execution change was found.

Review details

Best possible solution:

Merge the bounded read-only doctor diagnostic after maintainer review, keeping it tied to existing session-store and bundled-skill snapshot contracts.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection shows current main lacks the session snapshot doctor contribution, and the PR proof artifacts demonstrate before/after detection of stale cached bundled-skill paths without current-runtime or workspace false positives.

Is this the best way to solve the issue?

Yes. A read-only doctor contribution is the narrowest maintainable solution for this diagnostic request, and the latest scanner uses existing bundled-skill and session-store contracts rather than changing runtime session behavior.

What I checked:

  • Current main lacks this diagnostic: Current main has no doctor-session-snapshots module or doctor:session-snapshots contribution registered, so this PR is not redundant on main. (a5a5df67da35)
  • PR registers the doctor contribution: The PR adds runSessionSnapshotsHealth() and registers doctor:session-snapshots in the doctor health contribution list. (src/flows/doctor-health-contributions.ts:359, 0c8c1761fc06)
  • Scanner covers stale cached bundled skill paths: The scanner expands ~/ paths, skips current bundled roots, maps stale bundled-skill paths to the active bundled skills root, and reads raw session-store JSON so legacy resolvedSkills can be inspected before normal store loading strips it. (src/commands/doctor-session-snapshots.ts:174, 0c8c1761fc06)
  • Regression coverage targets the prior findings: Tests cover home-relative snapshot paths, raw legacy skillsSnapshot.resolvedSkills, configured session stores, templated session stores, Windows paths, current-runtime suppression, and workspace false-positive suppression. (src/commands/doctor-session-snapshots.test.ts:116, 0c8c1761fc06)
  • Real behavior proof inspected: The linked proof summary/logs show detector_present=false before the PR and detector_present=true after, with stale POSIX/temp/Windows findings and no workspace or current-runtime false positives. (0c8c1761fc06)
  • GitHub check-run status: The check-runs API reported no failing check runs for the PR head across the fetched pages: 91 success, 21 skipped, and 1 neutral. (0c8c1761fc06)

Likely related people:

  • steipete: Introduced the doctor health contribution orchestration and appears repeatedly in recent doctor, session, and skills history for the affected flow. (role: recent doctor/session area contributor; confidence: high; commits: 7d6d642cb825, ef763d0f0bb7; files: src/flows/doctor-health-contributions.ts, src/config/sessions/store-load.ts, src/agents/skills/workspace.ts)
  • shakkernerd: Split the session store loader from maintenance, which is relevant because this PR intentionally reads raw session JSON instead of the normal stripping loader for the diagnostic. (role: session store refactor contributor; confidence: medium; commits: c2e93c76bd43; files: src/config/sessions/store-load.ts)
  • gumadeiras: Carried the custom session-store discovery hardening that this PR reuses through resolveAllAgentSessionStoreTargetsSync. (role: session-store discovery contributor; confidence: medium; commits: 46f0bfc55b58; files: src/config/sessions/targets.ts)
  • snese: Implemented compact skill prompt fallback, including prompt-facing skill path behavior that made home-compacted skillsSnapshot.prompt paths relevant to this scanner. (role: skills prompt snapshot contributor; confidence: medium; commits: f8bcfb9d73f0; files: src/agents/skills/workspace.ts)

Remaining risk / open question:

  • No live macOS Homebrew migration was proven; the current evidence uses deterministic session-store fixtures, linked before/after artifacts, and CI/check-run proof.

Codex review notes: model gpt-5.5, reasoning high; reviewed against a5a5df67da35.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Updated proof artifacts for the stale session snapshot doctor check:

The corrected before log now proves \ lacks the detector/contribution, and the after log proves the PR reports stale install/temp/Windows runtime paths without current-runtime or workspace false positives.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Corrected the PR body markdown after the first proof update mangled inline backticks.

Final proof artifacts:

The before log proves origin/main lacks the detector/contribution; the after log proves the PR reports stale install/temp/Windows runtime paths without current-runtime or workspace false positives.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. P2 Normal backlog priority with limited blast radius. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. labels May 17, 2026
Warn when cached session snapshot metadata still references bundled skill paths from inactive OpenClaw runtime roots, while keeping workspace skill roots and current runtime paths quiet.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
giodl73-repo and others added 2 commits May 17, 2026 07:27
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Updated for ClawSweeper P2 on configured session stores.

What changed:

  • noteSessionSnapshotHealth now accepts cfg and resolves store paths through resolveAllAgentSessionStoreTargetsSync, so normal doctor health checks cover configured session.store targets and {agentId} templates.
  • The doctor health contribution now passes ctx.cfg into the session snapshot check.
  • Added regressions for direct configured stores and templated configured stores.

Validation:

  • CI=1 node scripts/run-vitest.mjs src/commands/doctor-session-snapshots.test.ts src/commands/doctor-session-transcripts.test.ts
  • pnpm exec oxfmt --check --threads=1 src/commands/doctor-session-snapshots.ts src/commands/doctor-session-snapshots.test.ts src/flows/doctor-health-contributions.ts
  • git diff --check
  • pnpm check:changed

Crabbox note: node scripts/crabbox-wrapper.mjs run --shell -- "pnpm check:changed" leased an AWS raw box but failed before validation with pnpm: command not found; rerunning with --provider blacksmith-testbox failed because .github/workflows/crabbox-hydrate.yml has no Testbox step configured. Local hydrated pnpm check:changed passed on pushed head 8a41822.

@giodl73-repo

Copy link
Copy Markdown
Contributor Author

/review

@clawsweeper

clawsweeper Bot commented May 17, 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.

Re-review progress:

Expand home-relative cached snapshot paths before stale bundled-skill classification and scan raw session-store JSON so persisted resolvedSkills are inspected before normal session-store normalization strips them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Addressed the remaining ClawSweeper P2 findings.

What changed:

  • Home-relative cached snapshot paths such as ~/.../node_modules/openclaw/skills/.../SKILL.md are expanded before stale bundled-skill classification, so they are no longer skipped as non-absolute paths.
  • noteSessionSnapshotHealth now scans raw session-store JSON for this diagnostic, so persisted skillsSnapshot.resolvedSkills paths are inspected before normal session-store normalization strips the runtime cache.
  • Added focused regressions for both cases.

Validation:

  • CI=1 node scripts/run-vitest.mjs src/commands/doctor-session-snapshots.test.ts
  • pnpm exec oxfmt --check --threads=1 src/commands/doctor-session-snapshots.ts src/commands/doctor-session-snapshots.test.ts
  • git diff --check
  • pnpm check:changed

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 17, 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.

Re-review progress:

@giodl73-repo giodl73-repo merged commit fb53c2d into openclaw:main May 17, 2026
113 checks passed
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 20, 2026
* fix(doctor): detect stale session snapshot paths

Warn when cached session snapshot metadata still references bundled skill paths from inactive OpenClaw runtime roots, while keeping workspace skill roots and current runtime paths quiet.

* fix(doctor): honor configured session stores

* fix(doctor): scan raw snapshot paths

Expand home-relative cached snapshot paths before stale bundled-skill classification and scan raw session-store JSON so persisted resolvedSkills are inspected before normal session-store normalization strips them.
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
* fix(doctor): detect stale session snapshot paths

Warn when cached session snapshot metadata still references bundled skill paths from inactive OpenClaw runtime roots, while keeping workspace skill roots and current runtime paths quiet.

* fix(doctor): honor configured session stores

* fix(doctor): scan raw snapshot paths

Expand home-relative cached snapshot paths before stale bundled-skill classification and scan raw session-store JSON so persisted resolvedSkills are inspected before normal session-store normalization strips them.
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
* fix(doctor): detect stale session snapshot paths

Warn when cached session snapshot metadata still references bundled skill paths from inactive OpenClaw runtime roots, while keeping workspace skill roots and current runtime paths quiet.

* fix(doctor): honor configured session stores

* fix(doctor): scan raw snapshot paths

Expand home-relative cached snapshot paths before stale bundled-skill classification and scan raw session-store JSON so persisted resolvedSkills are inspected before normal session-store normalization strips them.
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
* fix(doctor): detect stale session snapshot paths

Warn when cached session snapshot metadata still references bundled skill paths from inactive OpenClaw runtime roots, while keeping workspace skill roots and current runtime paths quiet.

* fix(doctor): honor configured session stores

* fix(doctor): scan raw snapshot paths

Expand home-relative cached snapshot paths before stale bundled-skill classification and scan raw session-store JSON so persisted resolvedSkills are inspected before normal session-store normalization strips them.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* fix(doctor): detect stale session snapshot paths

Warn when cached session snapshot metadata still references bundled skill paths from inactive OpenClaw runtime roots, while keeping workspace skill roots and current runtime paths quiet.

* fix(doctor): honor configured session stores

* fix(doctor): scan raw snapshot paths

Expand home-relative cached snapshot paths before stale bundled-skill classification and scan raw session-store JSON so persisted resolvedSkills are inspected before normal session-store normalization strips them.
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 25, 2026
* fix(doctor): detect stale session snapshot paths

Warn when cached session snapshot metadata still references bundled skill paths from inactive OpenClaw runtime roots, while keeping workspace skill roots and current runtime paths quiet.

* fix(doctor): honor configured session stores

* fix(doctor): scan raw snapshot paths

Expand home-relative cached snapshot paths before stale bundled-skill classification and scan raw session-store JSON so persisted resolvedSkills are inspected before normal session-store normalization strips them.
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
* fix(doctor): detect stale session snapshot paths

Warn when cached session snapshot metadata still references bundled skill paths from inactive OpenClaw runtime roots, while keeping workspace skill roots and current runtime paths quiet.

* fix(doctor): honor configured session stores

* fix(doctor): scan raw snapshot paths

Expand home-relative cached snapshot paths before stale bundled-skill classification and scan raw session-store JSON so persisted resolvedSkills are inspected before normal session-store normalization strips them.
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
* fix(doctor): detect stale session snapshot paths

Warn when cached session snapshot metadata still references bundled skill paths from inactive OpenClaw runtime roots, while keeping workspace skill roots and current runtime paths quiet.

* fix(doctor): honor configured session stores

* fix(doctor): scan raw snapshot paths

Expand home-relative cached snapshot paths before stale bundled-skill classification and scan raw session-store JSON so persisted resolvedSkills are inspected before normal session-store normalization strips them.
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
* fix(doctor): detect stale session snapshot paths

Warn when cached session snapshot metadata still references bundled skill paths from inactive OpenClaw runtime roots, while keeping workspace skill roots and current runtime paths quiet.

* fix(doctor): honor configured session stores

* fix(doctor): scan raw snapshot paths

Expand home-relative cached snapshot paths before stale bundled-skill classification and scan raw session-store JSON so persisted resolvedSkills are inspected before normal session-store normalization strips them.
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
* fix(doctor): detect stale session snapshot paths

Warn when cached session snapshot metadata still references bundled skill paths from inactive OpenClaw runtime roots, while keeping workspace skill roots and current runtime paths quiet.

* fix(doctor): honor configured session stores

* fix(doctor): scan raw snapshot paths

Expand home-relative cached snapshot paths before stale bundled-skill classification and scan raw session-store JSON so persisted resolvedSkills are inspected before normal session-store normalization strips them.
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
* fix(doctor): detect stale session snapshot paths

Warn when cached session snapshot metadata still references bundled skill paths from inactive OpenClaw runtime roots, while keeping workspace skill roots and current runtime paths quiet.

* fix(doctor): honor configured session stores

* fix(doctor): scan raw snapshot paths

Expand home-relative cached snapshot paths before stale bundled-skill classification and scan raw session-store JSON so persisted resolvedSkills are inspected before normal session-store normalization strips them.
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* fix(doctor): detect stale session snapshot paths

Warn when cached session snapshot metadata still references bundled skill paths from inactive OpenClaw runtime roots, while keeping workspace skill roots and current runtime paths quiet.

* fix(doctor): honor configured session stores

* fix(doctor): scan raw snapshot paths

Expand home-relative cached snapshot paths before stale bundled-skill classification and scan raw session-store JSON so persisted resolvedSkills are inspected before normal session-store normalization strips them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] doctor detects stale session snapshots after runtime-path changes

1 participant