Repository navigation
fix: allow Claw removal with a running Gateway - #166889
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: needs maintainer review before merge. Reviewed October 7, 2026, 10:47 PM ET / October 8, 2026, 02:47 UTC (Revision 2). ClawSweeper reviewWhat this changesRoutes Claw removal journal creation and rollback through the running Gateway while preserving the CLI’s deletion lease and handling uncertain replies. Example: Remove workspace-agent while Cron is enabled in the Gateway
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR remains useful and has no actionable correctness findings. The exact-head CLI/Gateway run resolves the previous proof request; ordinary CI and landing gates still apply. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherClaws packages create agents and track the resources they own. Removal uses a durable deletion journal to coordinate configuration, database, scheduled-work, and resource cleanup across the CLI and Gateway. flowchart TD
A[CLI removal with confirmed plan] --> B[Original deletion lease]
B --> C[Gateway journal request]
C --> D[Current request and ownership checks]
D --> E[Existing Cron authority owner]
E --> F[SQLite worker commit]
F --> G[Confirmed cleanup or retained uncertain outcome]
Technical reviewBest possible solution: Keep journal publication with the serving Cron owner, preserve native offline callers, and retain the original deletion lease whenever remote settlement is uncertain. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the competing Cron-custody acquisition, and the existing lifecycle scenario supplies a concrete CLI/Gateway path. A baseline failing run has not yet been established; the recorded local timeout occurred earlier. Is this the best way to solve the issue? Yes. Delegating journal publication to the existing serving owner preserves the intended custody boundary and avoids competing local writers or unsafe replay. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d327a36593da. Provenance checked
TestingProof path: shipped entry point. Added test files: 3. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +724, Tests +179. Total +903 across 22 files. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
|
Route Claw deletion journal begin and rollback through the serving Gateway Cron receipt owner while retaining the CLI deletion lease and physical database identity. Prove the original Cron custody timeout on unchanged main and successful Claw removal with sibling-job preservation on the candidate. Focused runtime proof, both cycle checks, production types, wrapper closure checks, independent review, and exact-head hosted CI completed. Slice 1 of the approved Heartbeat to Automations split (openclaw#164265, openclaw#134994).
What Problem This Solves
Fixes Claw removal failing when a running Gateway already owns Cron receipt authority. The CLI tried to acquire the same custody while beginning or rolling back its deletion journal, following the owner change in
58bcc015a37.User Impact
Claw removal can complete through the serving Gateway while preserving unrelated scheduled jobs. The CLI retains its original deletion lease and physical database identity. A lost reply preserves an uncertain outcome and prevents unsafe release or local replay.
No configuration, SQLite schema, plugin SDK, or heartbeat delivery behavior changes in this slice.
Why This Change Was Made
Only journal begin/rollback move to the existing serving Cron owner. The Gateway validates the current request, configuration, Claw installation, deletion lease, and physical database at native transaction/commit admission; it acknowledges the recorded native outcome. Existing offline callers retain their current path.
This is slice 1 of the maintainer-approved split of #164265. Immediate session events follow in slice 2; Doctor conversion and periodic heartbeat retirement land atomically in slice 3 under #134994. The original PR remains open until all slices merge.
Production grows by 724 lines (+769/−45) because this repair supplies the missing journal transport and settlement handling. Tests grow by 179 lines (+181/−2). No generated output or test support is included in the production count.
Evidence
5fa9edbad099. The assertion failures concern deferred startup inspection; this slice changes only deletion publication in that owner.pnpm build qaRuntimepassed, including 14 runtime-postbuild phases and all control-plane imports, on a source-identical isolated copy before the two unused exports were made private.7a0ab1eb73236416f3cacd225bb7e32920d1f956: fresh remote PR checkout, independently pinned bootstrap, Node 24.21.0, runtime build 57.7s, and the selected real CLI/Gateway custody case passed in a 60.9s Vitest run. It enables Cron, creates a disabled sibling through the public API, removes the Claw through a separate CLI process, and verifies the sibling survives. Runrun_a6e227b4eaf8c31fbed0058f54905a8a; leasecbx_974b2d2d83e6stopped after proof. The three other lifecycle cases were not selected by this focused command.5fa9edbad099plus only this regression test: realclaws removereturnedmonitor_cleanup_failedand a lock timeout onopenclaw.sqlite.cron-authority(28.4s case, 58.2s Vitest run). The primary7a0ab1echeckout stayed unchanged; baseline source and the sole test diff/hash were verified. Runrun_5b9dee020d400905b51f78118b87d26f; its separate lease is released. Earlier local CPU-starvation and temporary-directory quota failures did not count as negative controls.37715769749, attempt 2, completed successfully. Attempt 1 failed in Android Maven dependency resolution and cancelled ten sibling jobs; the failed/cancelled jobs reran without code changes after the artifact endpoints recovered. Two cancelled auxiliary automation jobs also reran successfully. Local full declaration build was interrupted for the cycle correction; it is not claimed as passing. No test deadline was increased.Known main failure:
test/scripts/lint-suppressions.test.tsreceives two additionaltypescript/unbound-methodsuppressions insrc/logging/redact-pattern-runtime.tsandsrc/logging/redact.ts(80 versus 78). The same failure was independently reproduced on unchanged product commit5fa9edbad099; this PR touches neither logging file nor the suppression test/baseline. No exception is claimed for missing or cancelled CI coverage.Admission failure details:
does not let an unavailable required agent hide a newer required databasereceives no synchronous newer-schema failure;keeps a secondary with malformed ownership isolated while required agents startreceives the existingagent-database-inspection-pendingrefusal; the twocleanersecondary variants reach their unchanged 120-second deadline on both source versions. These remain failures, not passing coverage; hosted CI and source attribution govern landing.