Skip to content

feat(claws): expose lifecycle backend for Control UI - #162987

Closed
giodl73-repo wants to merge 4 commits into
openclaw:mainfrom
giodl73-repo:giodl/claws-lifecycle-backend
Closed

giodl73-repo wants to merge 4 commits into
openclaw:mainfrom
giodl73-repo:giodl/claws-lifecycle-backend

Conversation

@giodl73-repo

@giodl73-repo giodl73-repo commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Convergence Decision

We are converging on Patrick's Agents/Labs stack (#163298, final stack #163307), not continuing the separate Plugins > Claws journey. Decision recorded for Patrick and Vyctor.

This PR is retained as a closed reference, superseded by the selected Agents/Labs stack. Do not land it independently or bulk-merge its implementation into Patrick's stack. Carry over only verified missing fixes into the existing owners; no source push, closure, merge, default enablement, deployment, or publishing is part of this decision.

The comparison is pinned to final stack 6765a8741e490a5df5bc143aa4795a40140a11cd. Adopted-agent ownership and legacy read-only inventory already have matching regression coverage there. Its installed-agent panel loads status independently and checks Gateway, request, and agent identity; our separate diagnostics-loading fix is not a direct port. This is source comparison, not new runtime proof or blanket stack approval.

The bounded comparison of our reviewed fixes found no concrete port required at that tip. Host config persistence, host-local cron rollback, brokered lease admission, explicit MCP recovery, and effective-home workspace resolution cover or replace the old branch-specific repairs. No old worker bridge or compensation transport is being copied into the selected stack. Existing stack release gates and runtime-proof limitations remain; this is not a full-stack approval.

Preserved Local Evidence

Local commit f89da51329f39c3e45020e85d529fbe81bbea634, not pushed: the conflict repair against pinned main d6411f28a12cb1b436c830a3a341f90164d4f3bd preserves main's provenance worker and the inventory reader. The final 36-file code follow-up passed P0/P1 AutoReview with no actionable findings. The latest focused run passed 127 tests in 442.21s, including real-worker add 1.0.0, update 1.1.0, and removal with durable cleanup. Core production types, scoped test types, formatting, and the import-cycle check passed. Final scoped lint is clean; the main-relative file-size guard passed 148 changed source files, and the assertion-safety guard passed after removing one obsolete allowance (37 authored follow-up paths including that shrink-only baseline edit). The earlier extraction run passed 226 tests with two existing platform/root skips. These results are local candidate evidence, not the published head or combined Gateway authority-chain proof.

Published Branch Context

The following describes this reference branch, not the selected Agents/Labs implementation.

Related: #142974
Related: #162314

What Problem This Solves

The terminal-free Claw install, update, and uninstall journey needs Gateway access to the existing canonical lifecycle operations.

User Impact

Provides the backend for Plugins > Claws: inventory, release previews, exact-plan administrator confirmation, install, update, and removal. There are no UI changes in this PR.

Draft: real Gateway and browser lifecycle validation remains incomplete. This is not a merge-readiness claim.

OPENCLAW_EXPERIMENTAL_CLAWS=1 remains required. Plugin-bearing Claws remain blocked pending canonical plugin consent (#147280). No defaults, releases, publishing, dependency overrides, or database schemas are changed.

Why This Change Was Made

Separates backend repairs from #162314 and calls canonical Claws operations rather than introducing another lifecycle owner.

  • Cron compensation retains private, one-use operation receipts and current scheduler/database authority. Already-owned rollback can settle after browser revocation; revocation cannot authorize new work.
  • Worker config health and audit persistence use the host-owned SQLite broker. Native health/audit handlers now request the existing transaction and commit grants; ordinary callers supply their existing admission factories. Source guards, rollback, observation invalidation, and typed errors remain intact.
  • Canonical rollback retains only a short-lived metadata scope. It cannot authorize config-file or scheduler changes.
  • The cron adapter uses the Gateway service contract, fixing the full-build type mismatch without a cast.
  • New Claw workspaces honor the documented OPENCLAW_HOME/home precedence through the existing resolver. Explicit workspace selections are unchanged.
  • Pinned main a6ee7e12d29c4cd77a132ca40b87374d86c9bbfb was integrated for the previously observed protocol-input failure.

Existing monitor/package cleanup still contains synchronous database work. This PR does not claim a broader storage migration.

Evidence

  • Published backend head: 07d77ddaed7a87352056c0a5ea98a3b9ea4263fb. The test-only follow-up leaves production source identical to the previously built and reviewed 3498b7673a299c68e4459d9ca27b87e3cf5e7dae.
  • Independent Ubuntu/WSL checkout: frozen install passes with Node 24.19.0, pinned pnpm 12.5.1, fs-safe 0.22.0, Codex 0.158.0, and Mermaid 12.0.0. The npm registry override was local to installation; no dependency substitutions, committed overrides, binaries, or TLS bypasses. The earlier Windows fallback did not prove the pinned runtime and is not the current dependency proof.
  • Native config health/audit suite: 62 tests passed across six files, exit 0, 145.27s wrapper time. Previously failing revocation-at-COMMIT and observation-invalidation cases now pass without weakened assertions; ordinary audit writes and durable reopening are covered.
  • Claws/Gateway/admission regressions: 298 passed across 13 files, one existing macOS-only skip on Linux, exit 0, 186.06s wrapper time. Covers config bridge, compensation, lazy cron, Gateway mutations, native database relocation, and in-process completion.
  • Real worker plus synthetic local ClawHub registry: install 1.0.0 and update to 1.1.0 pass with durable inventory, config, package contents, workspace hashes, and credential-free requests checked. The follow-up also checks the persisted config-health fingerprint against the config file. Config observation and agent readiness are shimmed; this is not Gateway/browser E2E.
  • The health-persistence warning was a test-host routing defect: Linux's ordinary unit lane ran the simulated Gateway host inside a worker thread, where the host-only SQLite broker correctly refused admission. The test now uses the existing forked database-worker lane. No production code or guard was changed. The new fingerprint assertion fails on the old route (missing health state, exit 1) and passes on the corrected route with no health-persistence warning.
  • Corrected lifecycle proof plus existing routing-registry checks: 9 tests passed across two shards, exit 0, 127.65s wrapper time. The lifecycle itself took 15.67s (52.62s infra shard); registry checks took 701ms including the shard. A pre-existing test-host bare return was made explicitly undefined for lint. Final two-file formatting and type-aware lint pass, zero warnings/errors in 15.9s; source matches the Linux validation copy.
  • Fresh AutoReview of the final two-file test-only delta against 3498b7673a299c68e4459d9ca27b87e3cf5e7dae: scoped-clean at P0/P1, exit 0, no findings, final source verification passed.
  • Dedicated home-path cases: 2/2 pass, 80ms combined test time; 109.99s wrapper time including cold worker compilation. The preceding schema-suite run also passed these cases before they were moved out to respect the file-size limit.
  • Core production typecheck passes after the cron-contract correction. Formatting and lint pass for all ten changed files; lint reports zero warnings/errors in 49.1s. Linux and integration-checkout source hashes match.
  • Independent AutoReview of the exact ten-file delta against e5c72eb5e9fa70b282193782edff12842c91aa05: scoped-clean at P0/P1, exit 0, final source verification passed. The unresolved worker warning was included as a limitation.
  • Full pnpm build passes with the locked Linux installation, exit 0 in 22m 13.5s: native protocol preparation, plugin assets, runtime and all declaration batches, 96 external plugins, CLI bootstrap guard, runtime postbuild, SDK exports, UI bundle/performance checks, and startup metadata. The prior cron-contract type failure is fixed. Startup CSS remains above its advisory target but below the existing hard ceiling; no baseline or guard was changed. This builds the backend branch, not the pending UI restack.
  • Earlier e5c72eb5e9fa70b282193782edff12842c91aa05 source review and diagnostic proof remain historical evidence, not current native E2E proof. The follow-up review found three missing test admission callers; those fixtures now use real grants and their Linux suites pass.

Remaining Gaps

  • Both drafts conflict with current main. Against pinned d6411f28a12cb1b436c830a3a341f90164d4f3bd, backend merge analysis identifies src/claws/lifecycle-status.ts and src/claws/mcp.ts, overlapping Peter's merged refactor(claws): move Gateway provenance writes to workers #163112 (Gateway provenance writes moved to workers). Integration must preserve those worker operations and this branch's inventory reads; the new MCP record owner also requires updating the inventory reader import. No conflict resolution or UI restack is claimed yet.
  • Real Gateway install/update/uninstall, especially monitor/package cleanup with actual persistence, and the complete browser journey.
  • UI restack plus inspected desktop/mobile before/after screenshot delivery in chat and feat(claws): add experimental controls under Plugins #162314. That draft still overlaps older backend preview scaffolding.
  • Full current-head CI, CI test cost, and full native protocol contract/determinism checks remain unproven. Local preparation is not CI clearance.

The original UI checkout's 62 dirty backend files and the original backend checkout are preserved. No merge, ready-for-review transition, default enablement, or release is requested.

Extract the Gateway and canonical lifecycle changes from the Control UI draft. Keep browser presentation separate. This draft retains known cron compensation and config worker integration blockers; it is not ready to merge.
@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

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 agents Agent runtime and tooling size: XL labels Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed October 1, 2026, 11:08 PM ET / October 2, 2026, 03:08 UTC (Revision 5).

ClawSweeper review

What this changes

Adds experimental Gateway methods for reviewing, installing, updating, and removing Claws, OpenClaw’s packaged agent setups, through existing lifecycle owners.

Merge readiness

⛔ Blocked before merge - 6 items remain

This remains a distinct, useful backend contribution absent from current main and the latest release. The follow-up strengthens persistence evidence without changing production code; no new actionable correctness finding was established.

Priority: P2
Reviewed head: 07d77ddaed7a87352056c0a5ea98a3b9ea4263fb

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful canonical integration and improved persistence evidence remain limited by the unproven combined authority boundary.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Authority-chain proof required: the introduced Gateway handler, application worker, config bridge, and scheduler compensation need combined final-effect evidence for administrator success, read-only denial, revocation before persistence, and receipt-bound recovery. Reported real-worker install/update now verifies durable health state and resolves the prior warning, but substitutes config observation/readiness and omits uninstall. A production-path harness may inject authority changes while retaining real owners. No stored-data contract change was identified. Post redacted terminal output, logs, or diagnostic recordings; remove private endpoints and credentials. Updating the PR body should trigger re-review automatically; otherwise ask a maintainer to comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: the introduced Gateway handler, application worker, config bridge, and scheduler compensation need combined final-effect evidence for administrator success, read-only denial, revocation before persistence, and receipt-bound recovery. Reported real-worker install/update now verifies durable health state and resolves the prior warning, but substitutes config observation/readiness and omits uninstall. A production-path harness may inject authority changes while retaining real owners. No stored-data contract change was identified. Post redacted terminal output, logs, or diagnostic recordings; remove private endpoints and credentials. Updating the PR body should trigger re-review automatically; otherwise ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed 9 items Pinned introduction and checkout: Verified the repository remote and inspected introduced hunks from a6ee7e1 to the recorded head. The checkout remained clean. Endpoint drift was not treated as PR-owned work.
Latest follow-up resolves the health-warning evidence gap: GitHub commit metadata confirms exactly two test-related changes against the previous reviewed head: registration in the existing database-worker lane and an assertion comparing durable config-health state with the config file hash. Local historical blob inspection failed; the read-only GitHub commit API supplied the exact delta instead. The captured body reports the negative control failing and the corrected run passing without the health warning.
Useful worker proof has a defined boundary: The integration fixture exercises real HTTP artifact delivery, the application worker, canonical install/update operations, files, inventory, and health persistence. Its host substitutes configuration observation and agent readiness, never revokes authority during these operations, and does not exercise uninstall.
Findings None None.
Security None None.

How this fits together

The Gateway receives lifecycle requests from operator clients and resolves versioned ClawHub artifacts into canonical plans. Application workers apply approved changes through configuration, workspace, provenance, and scheduler owners.

flowchart TD
  A[Operator client] --> B[Experimental Gateway methods]
  C[ClawHub release] --> D[Canonical lifecycle plan]
  B --> D
  D --> E[Exact plan and live authority checks]
  E --> F[Application worker]
  F --> G[Config workspace and scheduler owners]
  G --> H[Inventory and completion result]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: the introduced Gateway handler, application worker, config bridge, and scheduler compensation need combined final-effect evidence for administrator success, read-only denial, revocation before persistence, and receipt-bound recovery. Reported real-worker install/update now verifies durable health state and resolves the prior warning, but substitutes config observation/readiness and omits uninstall. A production-path harness may inject authority changes while retaining real owners. No stored-data contract change was identified. Post redacted terminal output, logs, or diagnostic recordings; remove private endpoints and credentials. Updating the PR body should trigger re-review automatically; otherwise ask a maintainer to comment @clawsweeper re-review.
  • Resolve merge risk (P1) - Combined production final-effect evidence remains missing for administrator success, read-only denial, revocation before persistence, and exact compensation that cannot authorize fresh work.
  • Resolve merge risk (P1) - The draft remains conflicted with main; integration must preserve the merged provenance-worker operations and connect the inventory reader to the current MCP record owner.
  • Complete next step (P2) - Resolve the actual main conflicts while preserving the merged provenance-worker operations and updating the MCP inventory import, then record the applicable protocol checks for the integrated head.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
New Gateway surface 9 methods: 6 read-scoped, 3 administrator mutations The new remote lifecycle boundary makes scope enforcement and final-effect authorization central to review.
Production versus test growth production +4813/-497, net +4316; tests +6653/-124, net +6529 The branch justifies production growth through lifecycle adapters, inventory reads, and authority transport; test volume does not replace combined boundary proof.

Stored data model

Persistent data-model change detected: database schema: src/claws/control-ui-plan.ts, database schema: src/claws/control-ui-update-plan.ts, unknown-data-model-change: packages/gateway-protocol/src/schema/claws.ts, unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify the integrated authority boundary (recommended)
    Resolve the overlapping worker integration and supply production-path observations showing allowed mutations, forbidden-client rejection, revocation, and receipt-bound compensation before final effects.

Technical review

Best possible solution:

Keep one canonical lifecycle behind the experimental Gateway adapter, with durable outcomes and narrowly owned recovery that remain correct after caller revocation.

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

Not applicable as a feature request. Source confirms the missing Gateway lifecycle surface; reported worker runs cover install/update, while actual Gateway authorization and uninstall remain unproven.

Is this the best way to solve the issue?

Yes, extending the existing lifecycle owners through a worker adapter is the appropriate direction; the integrated authority and cleanup behavior still needs production-boundary verification.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0b025d14d064.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded experimental lifecycle improvement without demonstrated urgent user-facing regression.
  • merge-risk: 🚨 security-boundary: The introduced Gateway-to-worker authority and retained compensation paths lack combined proof that forbidden or revoked callers cannot reach fresh final effects.
  • 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. Needs stronger real behavior proof before merge: Authority-chain proof required: the introduced Gateway handler, application worker, config bridge, and scheduler compensation need combined final-effect evidence for administrator success, read-only denial, revocation before persistence, and receipt-bound recovery. Reported real-worker install/update now verifies durable health state and resolves the prior warning, but substitutes config observation/readiness and omits uninstall. A production-path harness may inject authority changes while retaining real owners. No stored-data contract change was identified. Post redacted terminal output, logs, or diagnostic recordings; remove private endpoints and credentials. Updating the PR body should trigger re-review automatically; otherwise ask a maintainer to comment @clawsweeper re-review.

Evidence

What I checked:

  • Pinned introduction and checkout: Verified the repository remote and inspected introduced hunks from a6ee7e1 to the recorded head. The checkout remained clean. Endpoint drift was not treated as PR-owned work. (07d77ddaed7a)
  • Latest follow-up resolves the health-warning evidence gap: GitHub commit metadata confirms exactly two test-related changes against the previous reviewed head: registration in the existing database-worker lane and an assertion comparing durable config-health state with the config file hash. Local historical blob inspection failed; the read-only GitHub commit API supplied the exact delta instead. The captured body reports the negative control failing and the corrected run passing without the health warning. (src/claws/control-ui-worker.integration.test.ts:352, 07d77ddaed7a)
  • Useful worker proof has a defined boundary: The integration fixture exercises real HTTP artifact delivery, the application worker, canonical install/update operations, files, inventory, and health persistence. Its host substitutes configuration observation and agent readiness, never revokes authority during these operations, and does not exercise uninstall. (src/claws/control-ui-worker.integration.test.ts:159, 07d77ddaed7a)
  • Authority boundary and supplemental coverage: Mutation handlers require current administrator scope, connection authority, cancellation status, and the enclosing commit guard. Registered-handler tests cover denial and revocation with a mocked worker; config-host tests mock persistence owners. These do not establish rejection before actual final filesystem, database, and scheduler effects across the combined production path. (src/gateway/server-methods/claws-mutations.ts:213, 07d77ddaed7a)
  • Earlier concrete findings remain addressed: Cron compensation retains private one-use receipts and checks current scheduler/database ownership and the exact committed job identity. Config metadata routes through the host broker. New methods append to the existing table, and docs describe the backend without claiming a UI. The latest completed review retained no findings. (src/claws/control-ui-cron-compensation.ts:164, 07d77ddaed7a)
  • Current main does not supersede the backend: Current main’s method table contains only the existing Claw monitor and package-removal methods, not this branch’s nine lifecycle methods. The merged writer cutover at refactor(claws): move Gateway provenance writes to workers #163112 owns overlapping MCP reconciliation and package-provenance writes, not the requested browser-facing lifecycle backend. (src/gateway/methods/core-descriptors.ts:613, 0b025d14d064)

Likely related people:

  • giodl73-repo: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Patrick-Erichsen: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Add production final-effect proof for read-only denial and revocation before filesystem, config, database, and scheduler writes, including exact compensation that admits no new work.
  • Demonstrate Gateway install, update, and uninstall with actual readiness and durable monitor/package cleanup.
  • Record applicable native protocol contract and determinism checks for the integrated candidate; preserve the already valid full-build evidence.

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 (4 earlier review cycles)
  • reviewed 2026-10-01T20:50:22.384Z sha 3673822 :: needs real behavior proof before merge. :: [P1] Retain exact-operation authority for cron compensation | [P1] Connect lifecycle config persistence to the host broker | [P2] Append new methods after the existing method table | [P2] Document the backend surface actually registered by this branch
  • reviewed 2026-10-02T01:04:40.298Z sha e5c72eb :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-02T02:34:10.126Z sha 3498b76 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-02T02:47:31.117Z sha 3498b76 :: needs real behavior proof before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 2, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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 Oct 2, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 2, 2026
@giodl73-repo

Copy link
Copy Markdown
Contributor Author

Closing as superseded by Patrick's Agents/Labs stack: #163298, with the final stack in #163307. We selected that single journey and the scoped comparison found no concrete missing fixes to carry over from this draft. The code and discussion remain as reference; this is not a merge or launch-readiness claim. Convergence decision: #163298 (comment)

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 docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. 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