Skip to content

fix(doctor): migrate legacy Skill Workshop backups to verified owners after workspace moves - #148995

Merged
steipete merged 1 commit into
mainfrom
upd/skill-workshop-owner-148974
Sep 15, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/skill-workshop-owner-148974

Conversation

@steipete

@steipete steipete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #148974

What Problem This Solves

openclaw doctor --fix repeatedly preserves a legacy Skill Workshop collection backup with candidate agents: none after its agent's workspace moves, even when the relocated Workshop skills match the backup's recorded results.

Reported by @zoroo07 (#148974).

User Impact

Operators affected on 2026.9.4 can migrate these backups to their uniquely verified agent without changing the current workspace or editing the backup manifest. Missing, changed, partial, or ambiguous content stays preserved with per-agent match counts, failure details, and the supported manual recovery procedure. Restart the Gateway after successful repair to clear its retained startup warning.

Why This Change Was Made

When workspace matching finds no candidate, read-only discovery compares every recorded post-cleanup result hash against each configured agent's Workshop skills. Exactly one complete match supplies the owner; the existing migration still determines restorability and verifies published copies before retiring sources. Empty result sets cannot establish ownership.

The approved Option-1 exception retains workspace-equality admission for the shipped archive and same-pass relocation paths. This preserves history-only publication, completed-archive exclusion, and interrupted recovery. No new flag, v1 source-manifest edit, schema, dependency, or retention change is introduced.

Evidence

  • New regression cases failed on the original code, including the moved-workspace case with candidate agents: none, then all five passed after the repair.
  • node scripts/run-vitest.mjs src/commands/doctor-skill-workshop*.test.ts src/infra/state-migrations.skill-workshop.test.ts: 135 tests passed across 11 files. Existing history-only, interrupted archive, and same-pass relocation tests are unchanged.
  • node scripts/check-changed.mjs: passed, including production/test typechecking, formatting, lint, and repository guards.
  • Fresh autoreview --mode branch --base origin/main --max-priority P1: scoped-clean, with no actionable P0/P1 findings.
  • Isolated pnpm openclaw doctor --fix --non-interactive --no-workspace-suggestions, twice each for standalone and published updater handoff environments: all four runs exited 0. Verified converted backup content, unchanged current skills, retired legacy roots, and quiet second runs. Runtime assets were built through the supported CLI wrapper.

The CLI smoke uses synthetic state and the Doctor environment emitted by the published updater; it does not run a complete npm-global update or restart an operator Gateway. Local proof ran on macOS.

The final patch is identical to the scoped-clean reviewed commit (git range-diff), rebased onto main with the unrelated fixture repairs included. Exact-head CI run 34968948742 completed successfully for 6c279e0a38defa1fc7747f0ac8b19fbf4018d4ce; all 146 successful checks are complete with none pending or failed. The focused Workshop command also passed all 135 tests across 11 files after the first patch-identical rebase.

ClawSweeper review

ClawSweeper's completed review of 6c279e0a38defa1fc7747f0ac8b19fbf4018d4ce found no actionable code findings and acknowledged the recorded proof acceptance. Its generic compatibility-proof checklist item is covered by the migration regression tests and the maintainer-accepted isolated Doctor CLI/updater-environment smoke. A complete npm-global update remains an explicitly accepted proof limitation. No code fixups or manual re-review request were needed.

The same root cause and the content-hash ownership approach were posted independently by @holny on #148974 before this PR; thanks for the analysis.

@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 15, 2026 10:08
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations size: M maintainer Maintainer-authored PR labels Sep 15, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 15, 2026, 9:41 AM ET / 13:41 UTC (Revision 9).

ClawSweeper review

What this changes

Doctor identifies a moved Skill Workshop backup’s agent from a unique complete content match, preserves unresolved backups, and documents recovery with regression coverage.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this remains a useful, coordinated fix absent from fetched main. No actionable patch defects were found. The recorded migration tests and accepted Doctor/updater-environment smoke address the earlier compatibility-proof request.

Priority: P2
Reviewed head: 6c279e0a38defa1fc7747f0ac8b19fbf4018d4ce

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful migration coverage, accepted production CLI observations, successful exact-head CI, and no actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): Recorded macOS Doctor CLI runs exercised the changed backup-discovery and migration path in standalone and published-updater handoff environments, showing correct conversion, unchanged current skills, source retirement, and quiet reruns. The complete npm-global update and Gateway restart remain explicitly accepted coverage limits.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): Recorded macOS Doctor CLI runs exercised the changed backup-discovery and migration path in standalone and published-updater handoff environments, showing correct conversion, unchanged current skills, source retirement, and quiet reruns. The complete npm-global update and Gateway restart remain explicitly accepted coverage limits.
Evidence reviewed 9 items Introduced fallback and preservation: The fallback runs only when the recorded workspace has no configured owner. It requires exactly one agent matching every result, rejects empty result sets, and preserves unresolved roots. Existing workspace admission remains intact.
Existing migration safeguards retained: The production migration holds its state coordinator across discovery, relocation, publication, and retirement. Existing code verifies published manifests and copied trees before removing source backups; this PR does not replace those operations.
Current-main necessity: The comparison confirms fetched main still lacks the content-based fallback and rejects unmatched workspace ownership before relocated-content verification.
Findings None None.
Security None None.

How this fits together

Skill Workshop stores each agent’s learned skills and collection backups. Doctor reads legacy backups and configured agents, then either migrates verified backups into an agent’s backup directory or preserves them with recovery guidance.

flowchart TD
  A[Legacy backups] --> C[Doctor ownership discovery]
  B[Configured agents and Workshop skills] --> C
  C --> D{Workspace owner exists?}
  D -->|Yes| F[Existing migration and copy verification]
  D -->|No| E{One complete content match?}
  E -->|Yes| F
  E -->|No| G[Preserve backups with diagnostics]
  F --> H[Agent backup available; verified source retired]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +78, Tests +120, Docs +8. Total +206 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 79 1 +78
Tests 1 120 0 +120
Docs 1 8 0 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 207 1 +206

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +78 net lines; tests +120 Production growth implements the bounded fallback inside the existing owner; the added tests exercise migration outcomes without adding a production test seam.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-skill-workshop-collection-backups.ts, unknown-data-model-change: src/commands/doctor-skill-workshop-collection-backups.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #148974
Summary: This PR is the coordinated implementation candidate for the open moved-workspace backup report.

Members:

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

Technical review

Best possible solution:

Keep ownership recovery in the existing Doctor migration, requiring a unique complete match while retaining ambiguous backups and existing archive safeguards.

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

Yes, from source: a legacy backup naming a former workspace gets zero configured owners and cannot reach downstream hash verification on fetched main. This read-only review did not execute a reproduction.

Is this the best way to solve the issue?

Yes. The patch extends the existing admission path and reuses established target resolution, tree hashing, publication, and retirement safeguards without changing configuration or backup formats.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 49c1bc4d6ee9.

Labels

Label justifications:

  • P2: This repairs a bounded legacy-backup recovery failure while existing backup data remains preserved.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): Recorded macOS Doctor CLI runs exercised the changed backup-discovery and migration path in standalone and published-updater handoff environments, showing correct conversion, unchanged current skills, source retirement, and quiet reruns. The complete npm-global update and Gateway restart remain explicitly accepted coverage limits.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded macOS Doctor CLI runs exercised the changed backup-discovery and migration path in standalone and published-updater handoff environments, showing correct conversion, unchanged current skills, source retirement, and quiet reruns. The complete npm-global update and Gateway restart remain explicitly accepted coverage limits.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • holny: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

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

History

Review history (8 earlier review cycles)
  • reviewed 2026-09-15T10:15:57.457Z sha c05eab7a0c74e9c0d2583829168f29cc57cf35cf :: blocked before merge. :: none
  • reviewed 2026-09-15T10:23:11.131Z sha c05eab7a0c74e9c0d2583829168f29cc57cf35cf :: blocked before merge. :: none
  • reviewed 2026-09-15T10:39:52.334Z sha e4eb0f80892283019c0e29bea5c6a0a68063ded9 :: blocked before merge. :: none
  • reviewed 2026-09-15T11:02:43.648Z sha e4eb0f80892283019c0e29bea5c6a0a68063ded9 :: blocked before merge. :: none
  • reviewed 2026-09-15T11:18:18.717Z sha 6d917781f7d60035eb2178d10fbf2b4f772507c8 :: blocked before merge. :: none
  • reviewed 2026-09-15T11:26:38.532Z sha 894698f8950982aeb33cbe6bbd535208f2948eb8 :: blocked before merge. :: none
  • reviewed 2026-09-15T11:46:29.660Z sha 23ef212 :: blocked before merge. :: none
  • reviewed 2026-09-15T12:35:59.677Z sha 6c279e0 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Sep 15, 2026
@steipete
steipete force-pushed the upd/skill-workshop-owner-148974 branch from c05eab7 to e4eb0f8 Compare September 15, 2026 10:32
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 15, 2026
@steipete
steipete force-pushed the upd/skill-workshop-owner-148974 branch from e4eb0f8 to 6d91778 Compare September 15, 2026 11:06
@steipete
steipete force-pushed the upd/skill-workshop-owner-148974 branch 2 times, most recently from 894698f to 23ef212 Compare September 15, 2026 11:40
@steipete
steipete force-pushed the upd/skill-workshop-owner-148974 branch from 23ef212 to 6c279e0 Compare September 15, 2026 12:27
@steipete
steipete merged commit 235184c into main Sep 15, 2026
199 of 201 checks passed
@steipete
steipete deleted the upd/skill-workshop-owner-148974 branch September 15, 2026 13:48
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR 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.

[Bug]: 2026.9.4 Doctor cannot migrate legacy Skill Workshop backup with old workspace path

1 participant