Skip to content

fix(claws): recover interrupted ownership and preserve safe removal - #163307

Closed
Patrick-Erichsen wants to merge 34 commits into
codex/claw-1093-v2-27-line-cap-extractionsfrom
codex/claw-1093-v2-29-mcp-recovery-stack
Closed

Patrick-Erichsen wants to merge 34 commits into
codex/claw-1093-v2-27-line-cap-extractionsfrom
codex/claw-1093-v2-29-mcp-recovery-stack

Conversation

@Patrick-Erichsen

@Patrick-Erichsen Patrick-Erichsen commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Publication Refresh: October 7

Layer 12/16. Previous: #163306 | Next: #166798. Published checkpoint: 2ab926ce8c93.

The stack now includes 45 previously local follow-up commits in four additional draft PRs, ending at #166801 (9e653a8ed286). Fresh combined-tip checks passed: 100 backend tests and 13 built-UI browser tests with a mocked Gateway. Before/after review captures are attached. Evidence below that names 6765a8741e4 remains historical evidence for that revision, not a new real-ClawHub run or per-layer CI result.

The stack remains draft and its first layer conflicts with current main. Reconciliation, exact-head CI/review, and the existing release gates remain outstanding. No merge or deployment is authorized by this publication.

What Problem This Solves

Interrupted MCP installs and concurrent cron changes can leave a Claw in an uncertain ownership state or make removal unsafe. This original final layer in the Claws Labs stack recovers recorded MCP ownership, compares live cron revisions before removal, and keeps setup chat bound to the Gateway where Add completed.

User Impact

Across the draft OpenClaw stack, users can enable the dedicated Claws Labs setting, browse official @openclaw/* Claws from ClawHub, review and Add one, then inspect, Update, or safely Remove it. Installed agents keep running and remain removable when Labs is off. The old OPENCLAW_EXPERIMENTAL_CLAWS flag is not required.

Evidence

  • Source checks passed at 6765a8741e4: pnpm check:changed, focused backend 63/63, UI 34/34, core/test/UI typechecks, lint and format. A fresh codex review --base a960b533f0d found no actionable regression in the final UI commit.
  • An installable tarball built from that exact commit passed integrity checks and started its Control UI at 371,662 bytes of startup JavaScript, under the 372,347-byte budget. The isolated Gateway ran with OPENCLAW_EXPERIMENTAL_CLAWS unset.
  • A local ClawHub served exactly 30 latest official @openclaw/* Claws. All 30 staged sources validated and built; the local source-sync dry run reported 30 exact-match skip actions after the Executive Assistant version correction. This is local-only publication, not a production catalog claim.
  • From the packaged Control UI: Labs defaulted off; enabling it exposed official-only search. Workflow Operator showed its Lobster plugin and effective capabilities in review, then Add created a ready agent. Its Lobster tool completed a real four-check readiness workflow and wrote a handoff. An explicit absolute workflow path was used because the plugin's cwd is Gateway-relative.
  • A locally published canary Update advanced Workflow Operator and Lobster; a second real Lobster task completed with five checks. Project Manager was also added and completed a separate real task, producing JSON, Markdown, and HTML artifacts.
  • Turning Labs off blocked catalog/Add/Update in Gateway and local-source CLI while both installed agents continued to run. Status and reviewed Remove remained available. Removing Workflow Operator released its Lobster reference without deleting the shared plugin, Project Manager, or user files. After a clean Gateway restart, Project Manager and the Labs-off setting persisted; retained file SHA-256 hashes matched before Remove and after restart. The scratch local E2E harness and its fixture data were not committed.

Visual Proof

Labs defaults off; enabling it reveals the official catalog:

Claws Labs setting defaults off
Official Claws catalog from local ClawHub

Reviewed plugin installation and a real Lobster-backed task:

Workflow Operator plugin capability review
Workflow Operator real readiness task

Updated plugin task, second Claw artifact, and post-Remove persistence:

Workflow Operator task after plugin Update
Project Manager real task artifact
Project Manager retained after Remove and Gateway restart

Release Gates

Keep the stack draft and do not merge or deploy yet. Land ClawHub #3883 before the public OpenClaw toggle, reconcile plugin-installer consent ownership with OpenClaw #147280, close the Claws RFC #48 contract, and land the Lobster #200 approval behavior. The official catalog still needs production publication, security-audit review, and final production-path verification; the local ClawHub intentionally has no recorded security analysis for its scratch packages.

@clawsweeper

clawsweeper Bot commented Oct 2, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes scripts Repository scripts agents Agent runtime and tooling size: XL labels Oct 2, 2026
@Patrick-Erichsen Patrick-Erichsen changed the title codex/claw 1093 v2 29 mcp recovery stack fix(claws): recover interrupted ownership and preserve safe removal Oct 2, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

The branch adds explicit recovery for interrupted Claw MCP ownership, protects scheduled-job removal against concurrent edits, rechecks policy around plugin activation, and keeps setup chat on the installation Gateway.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful implementation and substantial regression coverage support continued review, while authority and existing-state proof limit merge confidence.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Merge readiness

⛔ Blocked before merge - 7 items remain

This PR retains distinct, useful lifecycle work that current main does not fully provide. No definite introduced correctness bug was established, but the earlier authority and existing-state proof gaps remain unresolved.

Priority: P2
Reviewed head: 2ab926ce8c934f326c7c63ebb18d4f8cd79ca917

Before merge

  • Add real behavior proof - Authority-chain proof required: historical packaged-host images and narrative support catalog, Add, real task, and ordinary removal behavior, but do not show read-only or revoked callers and replaced plugin owners stopping at the changed final-effect boundaries. Handoff tests mock staging or continuation. Copied existing pending-row recovery, drift rejection, and restart compatibility remain unshown; three unavailable images are a reviewer limitation and do not determine this verdict. 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 security concern: Verify revocation across plugin activation - The branch carries reviewed authorization across activation and then resumes privileged lifecycle effects. Mocked continuation coverage does not establish that a read-only operator or authority revoked during the handoff causes no new final I/O; this is an unresolved proof gap, not a demonstrated exploit.
  • Resolve merge risk - The activation handoff lacks production-boundary evidence that a read-only operator, revoked caller, or replaced plugin owner is rejected before new runtime, workspace, configuration, or database effects.
  • Resolve merge risk - Recovery changes how existing pending ownership is resolved; copied existing-state evidence has not established successful recovery, blocked drift, retained configuration, and restart persistence.
  • Resolve merge risk - The stack's recorded reconciliation, plugin-consent coordination, production catalog verification, and public-enablement prerequisites remain outstanding; the supplied test merge is stale.
  • Complete next step - Provide final-effect authority and copied existing-state recovery evidence, then reconcile the stack and complete its recorded consent and public-enablement prerequisites before making it ready to land.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [medium] Verify revocation across plugin activation — src/claws/gateway-add-apply.ts:409
Agent review details

How this fits together

Claws are versioned packages that configure an agent and its workspace, plugins, MCP servers, and scheduled work. Gateway and CLI lifecycle operations translate reviewed plans into changes while preserving ownership and user-managed resources.

flowchart TD
  A[UI or CLI request] --> B[Reviewed lifecycle plan]
  B --> C[Current policy and ownership]
  C --> D[Plugin activation]
  D --> C
  C --> E[Workspace and configuration changes]
  C --> F[Ownership database worker]
  C --> G[Revision-checked schedule removal]
  E --> H[Status and setup chat]
  F --> H
  G --> H
Loading

Technical review

Best possible solution:

Keep recovery and deletion in the canonical lifecycle owners, preserve user-managed state, and establish final-effect authority and existing-state compatibility before landing the coordinated stack.

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

Unclear for a live reproduction: source and supplemental regressions identify interrupted ownership and concurrent-removal paths, but this read-only review did not execute them through an installed current-main host.

Is this the best way to solve the issue?

Yes in direction: exact-consent recovery and revision checks belong in the existing lifecycle owners; the available evidence does not yet establish the complete authority and upgrade behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 40d735e451b1.

Merge-risk options

Maintainer options:

  1. Prove the lifecycle boundaries (recommended)
    Use the production owners to demonstrate allowed and denied final effects plus recovery from copied pending ownership, preserving configuration and checking state after restart.
  2. Retain the draft checkpoint
    Keep this layer as a draft while the stack owner reconciles the selected implementation and completes its recorded publication prerequisites.

Security

Needs attention: No concrete bypass or supply-chain regression was established, but the changed activation handoff still needs final-effect authority evidence.

Evidence

Security concerns:

  • [medium] Verify revocation across plugin activation — src/claws/gateway-add-apply.ts:409
    The branch carries reviewed authorization across activation and then resumes privileged lifecycle effects. Mocked continuation coverage does not establish that a read-only operator or authority revoked during the handoff causes no new final I/O; this is an unresolved proof gap, not a demonstrated exploit.
    Confidence: 0.9

What I checked:

  • Pinned introduction and clean checkout: Reviewed the introduced base-to-head delta, not current-main drift. The raw head commit records parent 0de2eb2. Final status inspection was clean; no code or tests were executed. (2ab926ce8c93)
  • Explicit recovery owner: Recovery acquires agent, MCP, and configuration-source ownership, rebuilds exact consent, and delegates the pending-reference transition to the database worker while retaining live configuration. (src/claws/mcp-recovery.ts:177, 2ab926ce8c93)
  • Final database guards: The recovery worker compares all references for the server and checks live leases at transaction and commit admission. New tests cover changed sibling ownership and retired caller authority, but do not supply an installed-host recovery transcript. (src/claws/provenance-write.worker.ts:107, 2ab926ce8c93)
  • Authority-bearing activation handoff: Gateway Add releases the staging plugin lease for activation, then reacquires ownership and compares installed-owner snapshots before continuing. This materially carries reviewed authorization across awaited activation into workspace, configuration, and persistence effects. (src/claws/gateway-add-apply.ts:409, 2ab926ce8c93)
  • Supplemental handoff coverage: Add and Update handoff suites cover disabled policy, replaced owners, and authority loss, but mock staging and continuation or the runtime client. They do not observe the complete production final-effect boundary for a read-only or revoked operator. (src/claws/gateway-add-apply.plugin-batch.test.ts:33, 2ab926ce8c93)
  • Revision-checked removal: Removal now compares the reviewed revision under scheduler ownership and passes the precondition into durable persistence. The service regression exercises rejection after an edit and successful removal with the current revision; this review did not run it. (src/cron/service/ops-mutations.ts:465, 2ab926ce8c93)

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Production versus test growth production net +1,405 lines; tests and test support net +3,036 lines Growth is explained by explicit recovery and staged policy checks, while the substantial supplemental coverage still leaves production-boundary proof outstanding.
Operator and protocol additions 1 recovery command; 1 optional cron-removal precondition These add an explicit operator recovery path and preserve ordinary cron removal while allowing callers to reject concurrent edits.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is bounded lifecycle reliability work in an experimental launch stack, with no demonstrated urgent current-user regression.
  • merge-risk: 🚨 security-boundary: Reviewed authority crosses asynchronous plugin activation before privileged effects, and forbidden or revoked final-effect coverage remains incomplete.
  • merge-risk: 🚨 compatibility: Existing pending ownership now requires explicit recovery rather than status-driven completion, and existing-state recovery compatibility remains unproven.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rank-up moves

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

  • Add production final-effect evidence for a read-only operator and caller revocation or plugin-owner replacement during activation, showing rejection before new I/O.
  • Provide an installed-CLI transcript recovering copied pending ownership and rejecting a changed cron revision, with configuration and retained state checked after restart.
  • Attach current before/after captures for the setup continuation and read-only review changes; redact private information and update the PR body for automatic re-review, or ask a maintainer for @clawsweeper re-review.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-02T06:14:25.697Z sha 6fc956f :: blocked before merge. :: none
  • reviewed 2026-10-02T11:08:42.639Z sha 6765a87 :: needs real behavior proof before merge. :: none

Reviewed October 7, 2026, 7:27 PM ET / 23:27 UTC (Revision 3).

Keep status, Doctor, and export read-only. Add a per-ref operator CLI preview/apply flow with exact plan integrity, agent/MCP leases, and worker-owned compare-and-swap for complete or release while retaining live config. Resume Add after a landed MCP config write only while its managed ref remains exact.
@Patrick-Erichsen
Patrick-Erichsen force-pushed the codex/claw-1093-v2-29-mcp-recovery-stack branch from 6765a87 to 2ab926c Compare October 7, 2026 23:15
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 7, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Closing as superseded: #171623 replaced the Claws plan/review/update/remove lifecycle with a one-way Add operation, and main no longer has the lifecycle modules this layer changes. Any hardening here that still matters should be redone against the new Add flow.

Closed by Roboclaw at the author's request after an audit of his open PRs. The branch is kept, so this can be reopened if needed.

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

Labels

agents Agent runtime and tooling app: web-ui App: web-ui cli CLI command changes docs Improvements or additions to documentation extensions: lobster Extension: lobster gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts 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.

2 participants