Skip to content

Doctor: expose session artifact findings#95976

Merged
giodl73-repo merged 2 commits into
openclaw:mainfrom
giodl73-repo:doctor-session-artifacts-structured-repairs
Jun 25, 2026
Merged

Doctor: expose session artifact findings#95976
giodl73-repo merged 2 commits into
openclaw:mainfrom
giodl73-repo:doctor-session-artifacts-structured-repairs

Conversation

@giodl73-repo

@giodl73-repo giodl73-repo commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Exposes legacy session transcript state as structured Doctor findings.
  • Exposes stale cached session snapshot paths as structured Doctor findings.
  • Treats session artifact findings as advisory info findings so default doctor --lint does not fail existing users with legacy artifacts.
  • Adds dry-run repair effects for transcript rewrites and snapshot path rewrites.
  • Keeps the existing legacy Doctor run paths authoritative for real doctor / doctor --fix mutations.
  • Does not add or change config, plugin, or public SDK contract surface.

This is intentionally the next narrow session-artifacts slice before returning to the broader dry-run preview PR. It does not change transcript repair behavior, snapshot repair behavior, session store target resolution, or the public health-check contract.

Stack

Rebased onto current main at 2e6e17f7c5 (fix(media-generation): preserve trimmed default model flag (#96430)). Current branch head is 482ff8a570 (fix(doctor): make session artifact findings advisory).

Conflict resolution was limited to src/flows/doctor-health-contributions.test.ts; the check ID assertion now keeps the already-merged sandbox, gateway-services, config-audit, session-transcripts, and session-snapshots IDs.

Validation

Current head 482ff8a570:

  • OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs run src/commands/doctor-session-transcripts.test.ts src/commands/doctor-session-snapshots.test.ts src/flows/doctor-health-contributions.test.ts --reporter=dot - 76 tests passed across 2 Vitest shards
  • node_modules/.bin/oxfmt --check src/commands/doctor-session-snapshots.test.ts src/commands/doctor-session-snapshots.ts src/commands/doctor-session-transcripts.test.ts src/commands/doctor-session-transcripts.ts src/flows/doctor-health-contributions.test.ts src/flows/doctor-health-contributions.ts
  • node_modules/.bin/oxlint src/commands/doctor-session-snapshots.test.ts src/commands/doctor-session-snapshots.ts src/commands/doctor-session-transcripts.test.ts src/commands/doctor-session-transcripts.ts src/flows/doctor-health-contributions.test.ts src/flows/doctor-health-contributions.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 origin/main...HEAD
  • git diff --check
  • Hosted exact-head CI/Testbox gates passed on 482ff8a570 after the required main-sync rebase

Previous head c77bedfb7d also had source CLI proof with a temp legacy transcript and OPENCLAW_STATE_DIR override:

  • corepack pnpm openclaw doctor --lint --json --only core/doctor/session-transcripts - exit 0, ok: true, no visible findings at the default warning threshold
  • corepack pnpm openclaw doctor --lint --json --severity-min info --only core/doctor/session-transcripts - exit 1, surfaced one info core/doctor/session-transcripts finding
  • Direct source adapter check via node --import tsx confirmed both transcript and snapshot artifact adapters emit info severity

Notes

The post-rebase patch only changed tests to inspect parsed session-store JSON values instead of searching raw JSON for unescaped Windows paths. That makes the existing snapshot repair tests portable on Windows without changing Doctor behavior.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: M maintainer Maintainer-authored PR labels Jun 23, 2026
@giodl73-repo
giodl73-repo force-pushed the doctor-session-artifacts-structured-repairs branch from 713025a to 88b539e Compare June 23, 2026 05:12
@clawsweeper

clawsweeper Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 25, 2026, 11:25 AM ET / 15:25 UTC.

Summary
The PR adds advisory info-level Doctor health findings and dry-run repair effects for legacy session transcripts and stale cached session snapshot paths.

PR surface: Source +191, Tests +123. Total +314 across 6 files.

Reproducibility: not applicable. This PR adds a structured diagnostic surface around existing Doctor session artifact scanners and repairs rather than fixing a reported bug. The behavior is source-checkable and the PR body includes terminal proof for default lint versus explicit info-threshold lint.

Review metrics: 1 noteworthy metric.

  • Structured Doctor Checks: 2 added. Two new core Doctor check IDs become selectable through --only and visible to explicit info-level structured-output consumers.

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

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] Maintainers should explicitly accept or reject the two new info-level Doctor check IDs before merge.

Risk before merge

  • [P1] Explicit --only, --severity-min info, and structured dry-run preview consumers can newly observe two session-artifact Doctor check IDs and advisory findings for persisted session state.
  • [P1] The protected maintainer label means merge should wait for human acceptance of this diagnostic surface even though no line-level correctness blocker was found.

Maintainer options:

  1. Accept Advisory Doctor Exposure (recommended)
    Maintainers can merge after explicitly accepting that two new info-level session-artifact check IDs are visible to selected structured Doctor consumers while default lint remains non-blocking.
  2. Gate The Structured Checks More Narrowly
    If maintainers want less upgrade-visible diagnostic change, require an explicit opt-in or default-disabled structured check before merge.
  3. Pause For Broader Preview Direction
    Maintainers can pause this PR if the wider structured dry-run preview work should define these artifact findings together.

Next step before merge

  • [P2] Human maintainer review should decide whether to accept the new advisory structured Doctor session-artifact surface; there is no narrow automated repair to request.

Security
Cleared: The diff is limited to Doctor/session-state TypeScript and tests and does not add dependencies, workflows, secret handling, permissions, or external code execution.

Review details

Best possible solution:

Land this only after maintainers explicitly accept exposing legacy session artifacts as advisory structured Doctor findings while keeping real mutations in the existing Doctor repair paths.

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

Not applicable: this PR adds a structured diagnostic surface around existing Doctor session artifact scanners and repairs rather than fixing a reported bug. The behavior is source-checkable and the PR body includes terminal proof for default lint versus explicit info-threshold lint.

Is this the best way to solve the issue?

Yes, if maintainers accept the product direction. The patch reuses existing detectors and keeps mutating repairs in legacy Doctor paths; the safer alternative is narrower gating if maintainers do not want this advisory surface yet.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is a bounded Doctor/session diagnostic improvement with limited runtime blast radius but real compatibility review needs.
  • merge-risk: 🚨 compatibility: The PR adds two structured Doctor check IDs and info-level findings that can affect automation reading Doctor JSON or explicit info-severity output.
  • merge-risk: 🚨 session-state: The surfaced findings and dry-run effects describe persisted session transcript and snapshot artifacts.
  • 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 includes terminal proof that default warning-threshold lint remains non-blocking while explicit info severity surfaces the advisory finding, and the latest exact-head checks include a passing Real behavior proof gate.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes terminal proof that default warning-threshold lint remains non-blocking while explicit info severity surfaces the advisory finding, and the latest exact-head checks include a passing Real behavior proof gate.
Evidence reviewed

PR surface:

Source +191, Tests +123. Total +314 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 198 7 +191
Tests 3 132 9 +123
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 330 16 +314

What I checked:

  • Root policy applied: Root AGENTS.md was read fully; its ClawSweeper policy treats session state, persisted data repair, Doctor diagnostic surfaces, and protected labels as compatibility-sensitive maintainer-review areas. (AGENTS.md:29, 210ea659f77f)
  • Current main is not already implementing this PR: Current main registers the session transcript and session snapshot Doctor contributions with legacy run handlers only, without structured healthChecks for these two session-artifact surfaces. (src/flows/doctor-health-contributions.ts:1298, 210ea659f77f)
  • PR adds two structured Doctor checks: The PR diff adds healthChecks for core/doctor/session-transcripts and core/doctor/session-snapshots while keeping the legacy run handlers authoritative for normal Doctor execution. (src/flows/doctor-health-contributions.ts:1298, 482ff8a57074)
  • Findings are advisory by severity: The PR maps transcript and snapshot artifact findings to info severity, and current doctor --lint defaults to warning severity, so default lint remains non-blocking while explicit info consumers can see the new findings. (src/commands/doctor-lint.ts:48, 482ff8a57074)
  • Live PR state requires human handling: Live GitHub shows the PR is open, not draft, mergeable, head 482ff8a, and carries the protected maintainer label plus compatibility and session-state merge-risk labels. (482ff8a57074)
  • Validation and proof are present: PR checks include passing Real behavior proof and session-diagnostics boundary checks, and the PR body includes terminal proof that default warning-threshold lint stays non-blocking while explicit info severity surfaces the advisory finding. (482ff8a57074)

Likely related people:

  • giodl73-repo: Authored the merged stale session snapshot detector and several recent structured Doctor health-check contribution commits, and this PR builds on that same ordered Doctor contribution surface. (role: feature-history owner and recent area contributor; confidence: high; commits: fb53c2d61092, e56fd1dc0466, 704fc3504392; files: src/commands/doctor-session-snapshots.ts, src/flows/doctor-health-contributions.ts)
  • ggzeng: Authored the merged doctor --fix repair path for stale session snapshot paths that this PR deliberately leaves as the mutation owner. (role: snapshot repair contributor; confidence: high; commits: 4ab2eb45d019; files: src/commands/doctor-session-snapshots.ts, src/commands/doctor-session-snapshots.test.ts, src/flows/doctor-health-contributions.ts)
  • steipete: Authored the merged legacy OpenAI Codex doctor-only transcript cleanup and broader session-state refactor history that overlaps this PR's transcript artifact findings. (role: legacy transcript and session-state contributor; confidence: high; commits: 7423e9cb663c, 538d36eaaaa6, c0b3c8cdb9dc; files: src/commands/doctor-session-transcripts.ts, src/commands/doctor-session-transcripts.test.ts, src/commands/doctor-session-snapshots.ts)
  • joshavant: Current local blame for the central Doctor/session files points to a recent grafted commit that carried the checked-out source, making this a useful routing hint but not the original feature provenance. (role: recent source carrier; confidence: medium; commits: 1d172637d6dd; files: src/commands/doctor-session-transcripts.ts, src/commands/doctor-session-snapshots.ts, src/flows/doctor-health-contributions.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: 🚨 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. labels Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Current head c77bedfb7d addresses the default-lint artifact finding concern by making session transcript/snapshot artifact findings advisory info findings. Default doctor --lint remains at the warning threshold and does not fail existing users with legacy session artifacts; explicit --severity-min info still surfaces the advisory cleanup finding. PR body has the current source CLI proof and focused validation.

@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.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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. labels Jun 24, 2026
@giodl73-repo
giodl73-repo force-pushed the doctor-session-artifacts-structured-repairs branch from c77bedf to adf2f9a Compare June 25, 2026 02:20
@giodl73-repo

giodl73-repo commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Rebased onto current main; current head is adf2f9ad6b8beb6d97ac1e6846f582102d6ffff8. Conflict was limited to the Doctor contribution ID test and resolved by keeping the already-merged sandbox, gateway-services, config-audit, session-transcripts, and session-snapshots IDs.

Validation refreshed in the PR body: focused Doctor Vitest shard is green, changed-file oxfmt/oxlint are green, tsgo core/test-src are green, plugin SDK surface report is clean, and diff check is clean. The only post-rebase patch is test portability for Windows JSON path escaping; Doctor behavior remains the same advisory info-level session artifact surface.

@clawsweeper

clawsweeper Bot commented Jun 25, 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
giodl73-repo marked this pull request as ready for review June 25, 2026 03:03
@giodl73-repo
giodl73-repo force-pushed the doctor-session-artifacts-structured-repairs branch from adf2f9a to 482ff8a Compare June 25, 2026 15:03
@giodl73-repo
giodl73-repo merged commit 82a6a57 into openclaw:main Jun 25, 2026
105 checks passed
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 26, 2026
* feat(doctor): expose session artifact findings

* fix(doctor): make session artifact findings advisory
QiuYuang pushed a commit to QiuYuang/openclaw that referenced this pull request Jul 1, 2026
* feat(doctor): expose session artifact findings

* fix(doctor): make session artifact findings advisory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant