Skip to content

fix: preserve skill proposals across apply crashes and workspace moves - #114535

Merged
steipete merged 4 commits into
mainfrom
steipete/workshop-sqlite-store-m3q8
Jul 28, 2026
Merged

steipete merged 4 commits into
mainfrom
steipete/workshop-sqlite-store-m3q8

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes two Skill Workshop proposal lifecycle defects:

  1. A process crash after the live skill files were written but before proposal status was persisted left a create proposal permanently pending. Retrying apply then failed with Target skill already exists, even though the installed skill matched the proposal.
  2. Proposal discovery was scoped to an agent's current workspace path. Changing that workspace silently hid intact pending proposals from list, inspect, reject, and quarantine.

Why This Change Was Made

Proposal records, lifecycle status, origin attribution, target-apply claims, and rollback metadata now live in additive tables in the shared state database. The SQLite schema version remains 6: existing current-version databases lazily create these tables on first Skill Workshop use. PROPOSAL.md and support files remain on disk as reviewable product artifacts.

Apply operations use the shared SQLite lease mechanism instead of file locks. Recovery reconciles an interrupted create or update only when the exact proposal revision owns the latest rollback claim and the complete live bundle matches. Revisions atomically invalidate prior apply evidence.

openclaw doctor --fix imports verified legacy proposals.json, proposal.json, and rollback.json metadata into SQLite, verifies the imported rows, then removes only migrated JSON metadata. Ambiguous unattributed proposals on multi-agent installations are left in place with a warning for manual ownership recovery.

User Impact

Pending proposals remain manageable when an agent workspace changes, with previous-workspace proposals explicitly annotated. Interrupted applies recover to applied when the intended live files were durably written, while mismatched, tampered, unauthorized, ambiguous, or unreadable states remain pending and manageable.

The documented proposal body limit now matches the configured maximum of 200,000 bytes instead of the incorrect 1 MiB claim.

AI-assisted implementation; the code and migration behavior were reviewed and validated before opening this PR.

Evidence

  • node scripts/run-vitest.mjs run --config test/vitest/vitest.unit.config.ts src/skills/workshop
    • 6 files passed, 103 tests passed after rebasing onto current origin/main.
  • node scripts/run-vitest.mjs src/commands/doctor-skill-workshop-sqlite.test.ts
    • 1 file passed, 1 test passed, including the worst-case legacy rollback size and ambiguous-owner deferral.
  • node scripts/check-changed.mjs -- <26 changed files>
  • .agents/skills/autoreview/scripts/autoreview --mode uncommitted --stream-engine-output
    • Final result: clean, no accepted/actionable findings.
  • git diff --check origin/main...HEAD
    • Clean.
  • src/state/openclaw-state-db-contract.ts remains at OPENCLAW_STATE_SCHEMA_VERSION = 6.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime cli CLI command changes commands Command implementations agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Jul 27, 2026
@steipete
steipete marked this pull request as ready for review July 27, 2026 11:15
@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 Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 7:20 AM ET / 11:20 UTC.

ClawSweeper review

What this changes

The PR moves Skill Workshop proposal records and rollback claims from legacy JSON metadata into additive shared SQLite tables so pending proposals survive interrupted applies and agent workspace moves.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 6 items remain

Keep this PR open for maintainer review rather than cleanup: it changes persistent Skill Workshop state, crash recovery, and upgrade migration, and it carries the protected maintainer label. The submitted tests cover the intended branches, but the PR body provides test/CI results rather than an after-fix upgrade or interrupted-apply run against pre-existing user state.

Priority: P2
Reviewed head: a60d11b7f48c48f3e67331bec4d27d52743425c6
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and supported by substantial automated coverage, but real behavior proof for this durable-state migration is still missing.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body supplies focused tests, changed-surface checks, and CI claims, but no after-fix real run showing legacy-state upgrade, workspace relocation, or interrupted-apply recovery; please post redacted terminal output or logs without private paths, tokens, or endpoints. Updating the PR body should trigger a fresh review; otherwise a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body supplies focused tests, changed-surface checks, and CI claims, but no after-fix real run showing legacy-state upgrade, workspace relocation, or interrupted-apply recovery; please post redacted terminal output or logs without private paths, tokens, or endpoints. Updating the PR body should trigger a fresh review; otherwise a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Persistent-state migration: The branch adds three Skill Workshop tables for proposal records, origin-run attribution, and rollback metadata, while keeping the shared state schema version at 6 through feature-local lazy creation.
Upgrade path: The branch adds a Doctor-owned importer for legacy proposal and rollback JSON, and wires it into the normal Doctor repair sequence rather than retaining runtime JSON fallback reads.
Current-main behavior: Current main applies a proposal by writing the workspace skill and only then persisting its applied status, so an interruption in that interval can leave a pending proposal whose target already exists.
Findings None None.
Security None None.

How this fits together

Skill Workshop stores proposed skill changes, lets users inspect or apply them, and writes the approved skill into an agent workspace. This PR moves the proposal lifecycle and rollback metadata into OpenClaw’s shared SQLite state database while retaining PROPOSAL.md and support files as reviewable on-disk artifacts.

flowchart LR
  Proposal[Skill proposal and support files] --> Metadata[Proposal metadata]
  Metadata --> SQLite[Shared SQLite state]
  Proposal --> Review[Inspect and list]
  SQLite --> Recovery[Apply recovery and rollback claims]
  Recovery --> Workspace[Agent workspace skill]
  Legacy[Legacy JSON metadata] --> Doctor[Doctor migration]
  Doctor --> SQLite
Loading

Decision needed

Question Recommendation
Should this shared-state migration be accepted after reviewing an upgrade and crash-recovery proof for existing Skill Workshop state? Require upgrade proof: Ask for a redacted run that upgrades legacy proposal metadata with Doctor, moves an agent workspace, and recovers a deliberately interrupted apply before merge.

Why: The code changes durable proposal ownership and recovery semantics across existing installations; the protected label and missing real upgrade evidence require a maintainer to decide whether the demonstrated migration boundary is sufficient.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body supplies focused tests, changed-surface checks, and CI claims, but no after-fix real run showing legacy-state upgrade, workspace relocation, or interrupted-apply recovery; please post redacted terminal output or logs without private paths, tokens, or endpoints. Updating the PR body should trigger a fresh review; otherwise a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P2) - Existing installations with legacy proposal JSON need an upgrade proof showing that openclaw doctor --fix imports verified records, preserves review files, removes only migrated metadata, and leaves ambiguous multi-agent records recoverable.
  • Resolve merge risk (P1) - The branch changes the persistent source of truth for pending proposal and rollback state; a wrong ownership or recovery decision could hide, mis-associate, or incorrectly mark a proposal after an interrupted apply.
  • Resolve merge risk (P1) - The protected maintainer label requires explicit maintainer handling even if the code and CI remain positive.
  • Complete next step (P2) - The remaining gate is maintainer acceptance of persistent-state upgrade and recovery evidence; the protected maintainer label prevents automated cleanup or repair routing.
Agent review details

Security

None.

PR surface

Source +934, Tests +458, Docs +2, Generated +82. Total +1476 across 26 files.

View PR surface stats
Area Files Added Removed Net
Source 17 1310 376 +934
Tests 6 550 92 +458
Docs 1 17 15 +2
Config 0 0 0 0
Generated 2 82 0 +82
Other 0 0 0 0
Total 26 1959 483 +1476

Review metrics

Metric Value Why it matters
Persistent proposal tables 3 added, schema version unchanged The change adds durable proposal, origin-run, and rollback records through lazy SQLite tables, making upgrade and downgraded-build behavior important before merge.

Stored data model

Persistent data-model change detected: database schema: src/skills/workshop/store-sqlite-schema.ts, database schema: src/skills/workshop/store.test.ts, database schema: src/state/openclaw-state-schema.generated.ts, database schema: src/state/openclaw-state-schema.sql, migration/backfill/repair: src/commands/doctor-skill-workshop-sqlite.test.ts, migration/backfill/repair: src/commands/doctor-skill-workshop-sqlite.ts, and 8 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Demonstrate the upgrade boundary (recommended)
    Before merge, provide redacted real behavior proof that a pre-migration proposal state is imported by Doctor and remains listable, inspectable, and safely recoverable after a workspace move or interrupted apply.
  2. Accept the migration risk
    Maintainers may accept the focused tests as sufficient and explicitly own the upgrade risk for legacy Skill Workshop proposal state.

Technical review

Best possible solution:

Keep SQLite as the canonical proposal store, retain Doctor as the sole legacy-metadata migration owner, and merge only after a redacted before/after proof demonstrates legacy-state migration plus interrupted-apply recovery on an existing state directory.

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

Yes, from source with medium confidence: current main writes live skill files before persisting applied, and then rejects a create proposal when the target skill already exists. The branch’s focused tests describe the workspace-move and recovery paths, but no live reproduction was independently run in this read-only review.

Is this the best way to solve the issue?

Unclear. Moving canonical persistent proposal state to shared SQLite and using Doctor for legacy JSON migration matches the repository storage policy, but the best implementation still needs real upgrade and interrupted-apply proof before it can be called the safest merge path.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs a bounded but meaningful Skill Workshop persistence and recovery workflow rather than an immediate core-runtime outage.
  • add merge-risk: 🚨 compatibility: Existing installations move from JSON proposal metadata to SQLite through a Doctor migration, so upgrade behavior must be verified.
  • add merge-risk: 🚨 session-state: Proposal ownership, lifecycle status, and rollback claims are persistent agent-associated state whose incorrect migration can hide or mis-associate work.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body supplies focused tests, changed-surface checks, and CI claims, but no after-fix real run showing legacy-state upgrade, workspace relocation, or interrupted-apply recovery; please post redacted terminal output or logs without private paths, tokens, or endpoints. Updating the PR body should trigger a fresh review; otherwise a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This repairs a bounded but meaningful Skill Workshop persistence and recovery workflow rather than an immediate core-runtime outage.
  • merge-risk: 🚨 compatibility: Existing installations move from JSON proposal metadata to SQLite through a Doctor migration, so upgrade behavior must be verified.
  • merge-risk: 🚨 session-state: Proposal ownership, lifecycle status, and rollback claims are persistent agent-associated state whose incorrect migration can hide or mis-associate work.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body supplies focused tests, changed-surface checks, and CI claims, but no after-fix real run showing legacy-state upgrade, workspace relocation, or interrupted-apply recovery; please post redacted terminal output or logs without private paths, tokens, or endpoints. Updating the PR body should trigger a fresh review; otherwise a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Persistent-state migration: The branch adds three Skill Workshop tables for proposal records, origin-run attribution, and rollback metadata, while keeping the shared state schema version at 6 through feature-local lazy creation. (src/skills/workshop/store-sqlite-schema.ts:26, a60d11b7f48c)
  • Upgrade path: The branch adds a Doctor-owned importer for legacy proposal and rollback JSON, and wires it into the normal Doctor repair sequence rather than retaining runtime JSON fallback reads. (src/commands/doctor-skill-workshop-sqlite.ts:1, a60d11b7f48c)
  • Current-main behavior: Current main applies a proposal by writing the workspace skill and only then persisting its applied status, so an interruption in that interval can leave a pending proposal whose target already exists. (src/skills/workshop/service.ts:3198, ed4ff90f8478)
  • Repository storage contract: Repository policy requires persistent runtime state to use SQLite, legacy state migration to be Doctor-owned, and additive tables to use a lazy ensure without a schema-version bump when older builds remain compatible. (AGENTS.md:304, ed4ff90f8478)
  • Submitted validation: The PR body reports 103 focused Skill Workshop tests, a Doctor migration test, changed-surface checks on Testbox, and a clean autoreview; these are useful supplemental validation but do not themselves show an after-fix user-state upgrade or crash-recovery run. (a60d11b7f48c)

Likely related people:

  • steipete: The available review context identifies this person as author of the only branch commit touching the Skill Workshop persistence, Doctor migration, and state-schema surfaces; current-main feature-history inspection was not available in the read-only execution environment. (role: proposed implementation author; confidence: low; commits: a60d11b7f48c; files: src/skills/workshop/store.ts, src/commands/doctor-skill-workshop-sqlite.ts, src/state/openclaw-state-db-contract.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Post a redacted terminal or runtime transcript that imports legacy proposal metadata with openclaw doctor --fix and shows the retained proposal through list and inspect.
  • Show a deliberately interrupted apply recovering to applied only when the complete resulting live bundle matches the proposal.

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.

@steipete steipete self-assigned this Jul 28, 2026
@steipete
steipete force-pushed the steipete/workshop-sqlite-store-m3q8 branch from a60d11b to c936091 Compare July 28, 2026 12:49
@steipete

Copy link
Copy Markdown
Contributor Author

ClawSweeper rank-up moves reviewed for the rebased head c936091.

Both optional transcript-publication moves are skipped for this landing. The maintainer work order explicitly confirms that the migration and interrupted-apply behavior were integration-live-tested and approves the persistent-state design; repeating destructive legacy-state setup solely to publish a transcript is not required for owner acceptance. The rebased branch additionally passed 104 Workshop tests, 6 Gateway proposal tests, 3 Workshop CLI tests, and the Doctor migration test on Blacksmith Testbox. The rebase-exposed fs-safe cleanup incompatibility was fixed through the shared root-confined removal helper and received a clean fresh Codex autoreview.

@steipete
steipete merged commit 206f989 into main Jul 28, 2026
119 checks passed
@steipete
steipete deleted the steipete/workshop-sqlite-store-m3q8 branch July 28, 2026 14:42
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Jul 28, 2026
* origin/main:
  fix: preserve skill proposals across apply crashes and workspace moves (#114535)
  fix(qa): run maturity Docker scenarios through the aggregate scheduler (#114447)
  refactor(cli): unify configured model rows onto the shared row pipeline (#115239)
  fix(ui): stop modal autofocus steal after the open animation (#115168)
  fix(process): preserve long supervisor timeout deadlines (#115230)
  fix(slack): preserve pasted inbound tables (#115163)
  fix(codex): restore trajectory capture for canonical session targets (#115220)
  refactor(qa): make scenario selection taxonomy-owned (#114055)
  feat(plugins): match shared models across vendor-namespaced catalog ids (#115210)
vincentkoc added a commit to christian-lallo/openclaw that referenced this pull request Jul 28, 2026
* origin/main: (150 commits)
  fix: preserve skill proposals across apply crashes and workspace moves (openclaw#114535)
  fix(qa): run maturity Docker scenarios through the aggregate scheduler (openclaw#114447)
  refactor(cli): unify configured model rows onto the shared row pipeline (openclaw#115239)
  fix(ui): stop modal autofocus steal after the open animation (openclaw#115168)
  fix(process): preserve long supervisor timeout deadlines (openclaw#115230)
  fix(slack): preserve pasted inbound tables (openclaw#115163)
  fix(codex): restore trajectory capture for canonical session targets (openclaw#115220)
  refactor(qa): make scenario selection taxonomy-owned (openclaw#114055)
  feat(plugins): match shared models across vendor-namespaced catalog ids (openclaw#115210)
  fix(ios): forgetting a paired gateway does nothing (openclaw#114083)
  test(ui): share pauseVirtualClock e2e helper and de-flake marquee hover-delay asserts (openclaw#115203)
  fix(docs): preserve pure fenced translation chunks (openclaw#115204)
  fix: keep shared web and TUI chats synchronized under load (openclaw#115191)
  fix(auto-reply): require a directed turn for the no-visible-reply fallback
  fix(auto-reply): attest source-routed message-tool sends via the dedupe route matcher
  fix(auto-reply): attest message-tool source replies in every delivery mode and gate eligibility on resolved settlement
  fix(auto-reply): bound turn-ledger settlement and treat started sends as conservatively visible
  fix(auto-reply): abort-aware fallback settlement and straggler drain in turn ledger
  fix(auto-reply): keep turn-ledger types module-local
  test(auto-reply): fix type-check errors in turn-ledger corner tests
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 29, 2026
openclaw#114535)

* fix: move skill workshop proposals to sqlite

* fix(doctor): make workshop manifest cleanup idempotent

* fix(skills): resolve post-rebase static checks

* ci: retrigger exact-head checks
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 29, 2026
* origin/main:
  fix: preserve skill proposals across apply crashes and workspace moves (openclaw#114535)
  fix(qa): run maturity Docker scenarios through the aggregate scheduler (openclaw#114447)
  refactor(cli): unify configured model rows onto the shared row pipeline (openclaw#115239)
  fix(ui): stop modal autofocus steal after the open animation (openclaw#115168)
  fix(process): preserve long supervisor timeout deadlines (openclaw#115230)
  fix(slack): preserve pasted inbound tables (openclaw#115163)
  fix(codex): restore trajectory capture for canonical session targets (openclaw#115220)
  refactor(qa): make scenario selection taxonomy-owned (openclaw#114055)
  feat(plugins): match shared models across vendor-namespaced catalog ids (openclaw#115210)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime 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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant