Repository navigation
Conversation
Retain runtime, fixture, and static-analysis repairs from the verified source.
Run cleanup under the existing state lease while preserving the physical database context.
|
🦞👀 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 real behavior proof before merge. What this changesRoute Claw removal through the serving Gateway and require exclusive offline ownership for migration apply. Example: Run openclaw claws migrate worker --yes with the consented plan integrity while the Gateway is running.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep open: this PR completes a useful ownership cutover that current main does not provide; no definite introduced code defect was found. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherClaw CLI commands select the local state owner, which coordinates configuration, provenance workers, scheduler drainage, and resource cleanup before returning command output. flowchart TD
CLI[Claw CLI] --> Owner[Local state owner selection]
Owner --> Gateway[Serving Gateway]
Owner --> Offline[Exclusive offline owner]
Gateway --> Removal[Removal composition]
Removal --> Workers[Provenance and deletion workers]
Removal --> Cleanup[Config application and resource cleanup]
Offline --> Migration[Migration composition]
Technical reviewBest possible solution: Complete the existing-owner cutover while preserving consent, configuration-application ordering, deletion custody, and recovery semantics. Do we have a high-confidence way to reproduce the issue? Current main composes removal and migration outside the complete serving-owner route; source establishes the ownership gap, but no target code was executed during this read-only review. Is this the best way to solve the issue? Reusing the existing state owner, deletion lease, and cleanup services is a coherent repair, and the superseded CLI adapters are removed with their callers. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 45c7bc9e9ca9. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete bypass was found, but the new deletion RPC still needs final-effect authority proof. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +99, Tests -21, Docs +4, Other +4. Total +86 across 40 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 Reviewed October 10, 2026, 7:42 AM ET / 11:42 UTC. |
|
Superseded by #168586, which merged. Claws CLI mutations now refuse while a live Gateway owns the state and use the existing exclusive offline owner otherwise, in 43 production lines. That meets the outside-writer requirement in AGENTS.md without moving Claw provenance writes into workers. Closing this part of the chain unmerged, following the "choose good compromises" guidance. The branch is preserved. |
What Problem This Solves
Claw removal and enrollment could still mutate state outside the live Gateway after add/update gained owner routing.
User Impact
Claw remove uses the serving Gateway and waits for config application before dependent cleanup.
openclaw claws migrateapply instructs the operator to stop a live Gateway and takes exclusive offline ownership; dry-run remains available.Why This Change Was Made
Finish the owner cutover with the removal handler and CLI wrapper together, then delete their superseded adapters. Preserve raw workspace inventory during restoration while keeping strict mutation record types, separate provenance worker types from kernels, and update generated worker ownership evidence. MCP cleanup uses the existing deletion state lease so its physical database context survives the worker boundary without weakening the ownership guard.
This is PR 13 of a 13-PR dependency-ordered Claw ownership stack. The first eleven publication heads are unchanged. PR 12 activates add/update with their service callers and settlement repairs; PR 13 activates removal, guards offline migration, and completes worker typing cleanup. Each changed command signature and registration lands with its caller.
Size
Direct diff: production +403/−304 (707 changed); tests/support +150/−171; docs +42/−38; tooling +36/−32. Shared ownership services and complete caller migration account for the size. Schema, durability, retention, and permission contracts are unchanged.
Evidence
Intermediate proof
All first eleven publication heads retain their completed core typechecks (120.33 s total). Intermediate PR 12 at
c9dbd8de72c6dd9748ca9a9dc81c0eb6991a4778passedpnpm tsgo:corein 14.18 s andpnpm deadcode:knipin 101.64 s after a 21.34 s frozen install. The run used the local proof slot under the authorized remote-wait fallback; admission load was below 48 and free disk exceeded 82 GiB. Both service modules are consumed by registered add/update handlers; no unused-file exception or dummy caller is used. Evidence:intermediate-12/result.json,core-typecheck.log, andknip.log. The final PR12 head4fe3617a60097b750603cd920cf1d2e9e8f5ed31additionally passedpnpm check:deprecated-api-usagein 58.21 s after its two-line semantic-owner registration; evidence:intermediate-12/deprecated-guard-result.jsonanddeprecated-guard.log.Focused owner coverage for this slice:
src/cli/claws-command-owner.test.tsandsrc/cli/claws-migrate-cli.runtime.test.ts; earlier slice coverage includes the removal-journal and lifecycle owner tests.Source identity
PR base
4fe3617a60097b750603cd920cf1d2e9e8f5ed31; head240f037c5469f37c1091d02b2833782a65be8297; tree0c2855b7e4c86ecd76bd369098e2c1094b76475c. The final PR 13 head240f037c5469f37c1091d02b2833782a65be8297and accepted source32500e05d7f81c893d1134f774aef9611c9ef296have the identical complete repository tree0c2855b7e4c86ecd76bd369098e2c1094b76475c, including file modes. The private-index construction preserved the source worktree and its index. This is source-equivalence evidence, not runtime proof.Regression sensitivity
Seven historical negative-control invocations produced 10 intended assertion failures and eight passing controls, with no import/tool failures, in 401.20 s total. They cover canceled MCP/cron/workspace rollback, update config/partial-state recovery, package runtime settlement, and add preflight authority. The first six use production
5033d4802c38; add usesef67140233cbplus its recorded historical test blob. Exact commands, blobs, and assertions:local-missing/results.jsonandlocal-missing/negative-assertions.txt. These establish regression sensitivity, not positive proof at a later source.Final-candidate proof
The accepted source
32500e05d7f81c893d1134f774aef9611c9ef296and final publication head240f037c5469f37c1091d02b2833782a65be8297have the identical full repository tree0c2855b7e4c86ecd76bd369098e2c1094b76475c. The results below identify the source actually tested; they do not imply every intermediate passed every gate.agents.listand persisted-install readback068229eeee731e3fa270e59f19cf5ce92b1819cf5ce92b1832500e05d7f832500e05d7f8The focused commands use
pnpm test <listed files> --maxWorkers=1. The latest CLI/schema run coverssrc/cli/claws-cli.test.ts,src/cli/claws-cli-legacy-resume.test.ts, and all three cases insrc/claws/read-only-state-compat.test.ts. It verifies the repaired test ownership/ordering contracts and Doctor guidance for legacy schema failures without a new schema probe. Evidence:ow2-root-proof/local-root-claw/claw-owners.log,local-repair-proof/results.json, andlocal-final-targets/results.json. CI seconds are unavailable before publication.The 26-file run at
1e3fa270e59fcompleted all selected files in 1,539.75 s: 319 tests passed, 14 failed. It also passed 22 Gateway package/removal-journal cases and the other reader/provenance coverage. The CLI/schema failures are superseded by the passing 36-case run above. Earlier MCP cancellation, package cleanup, and update-order failures are superseded by the passing 52-case owner run. The final approval-removal retry and its two sibling files passed all 20 selected cases in 380.52 s; the 16 unselected cases in the targeted file were filtered out, not rerun. Exact commands and counts:local-mcp-repair/results.json. No mixed earlier invocation is presented as wholly passing.32500e05d7f8core-test-otherandcore-test-config-clitype graphs19cf5ce92b1819cf5ce92b1819cf5ce92b1819cf5ce92b1819cf5ce92b1832500e05d7f832500e05d7f832500e05d7f832500e05d7f832500e05d7f81e3fa270e59fAll 10 final follow-up commands at
32500e05d7f8passed in 351.38 s total. The source-static gate list has no unexecuted checks after composing retained evidence. The preceding19cf5ce92b18checkpoint retains all 19 passing commands (675.16 s). All 27 canonical core test graphs are covered: 24 unchanged graphs from1e3fa270e59f,core-test-config-clifrom19cf5ce92b18, andcore-test-agents-rootpluscore-test-otherfrom32500e05d7f8. Static T1 inventory sites fell 749→707 (−42); these are source sites, not runtime SQL or worker-request savings. Exact pins, commands, times, and inherited exceptions:static-final-32500e05.md/.jsonandstatic-checkpoint-19cf5ce9.md/.json. Runs used the shared local proof slot under the authorized remote-wait fallback, with load below 48 and sufficient disk at admission.The remote build at
c00514bd22a6passed in 451.13 s. The final SDK comparison at32500e05d7f8passed in 691.31 s, with digestb35261b1c710197e15c516c267119755b8469d8b291f29341f840ec535c7f7adexactly equal to the earlier inventory comparison. It reports 148 reachable export impacts, 15 unique dependency declaration changes, zero direct export declaration changes, and zero added or removed entrypoints. The workspace worker contract retains strict read/insert/status types and raw inventory list/restore types. Evidence:mcp-sdk-result.json,mcp-sdk.json, andmcp-sdk.md; declaration deduplication is recorded ininventory-sdk-unique-declarations.json. Cumulative SQL evidence and its unchanged-owner attribution follow below.The
mcp_cleanup_failedresult observed at19cf5ce92b18is resolved by the tested final repair: MCP cleanup runs under the existing deletion state lease and physical database context, preserving lock scope/key, timing, and the strict authority guard. All required lane proof is complete with the documented inherited/LOC exceptions. The published-driver × candidate update cell remains pending (lander); CI seconds are unavailable before PR creation.Known exceptions are explicit: the inherited unused exports are
isTelegramReadOnlyControlLaneTextinextensions/telegram/src/sequential-key.tsandresolveContextTokensinsrc/auto-reply/reply/model-selection.ts(coordinator-confirmed on main; fixed upstream byafb4f0ff366b, PR #168048, run 38004851105). The line-cap ratchet reportsagent-lifecycle-registry.ts700→718 andclaws/packages.ts700→709; these production-size exceptions follow the task's non-gating LOC instruction, with no baseline suppression added. The original full core lint also found 12 untouched foundation errors inconfig-state-owner.process.test.ts,config-journal-snapshot.ts,io.audit.ts, andconfig-state-mutation.ts; the separate foundation repair is35f80e7942cb. The 21 Claw lint findings were fixed and the repaired files passed typed lint. No additional inherited exception is asserted.Statement and request impact
This is shared cumulative Claw-group evidence for all thirteen PRs, not a separate measurement of each intermediate. Under the coordinator's one-pair override, the shared harness ran one alternating whole-workload base→candidate pair on the owned remote lease: base
74f5fe25a6b34d53b818faa557bf421bcf3f182b(tree231170bd664e60fcd6d54fc91c1f43f260d0e354) and candidatec00514bd22a6def1280522b27efc2a84636ea29a(tree396f35af21d7dc06953895af2f1dcc5ba2d00eb8). N=1 per side; each median/min/max therefore describes one run. Warmed values are the ten-turn mean within that run, not a median of individual turns. The duration ratio for warmed covers the full ten-turn window. Phase movement and timing are diagnostic under this override.The whole workload changed by +80 all-thread statements, +5 MAIN statements, −20 worker requests, and +0.695 s. Warmed-turn values changed by −5.6 statements and −0.3 requests per turn. No statement or request savings are claimed. The coordinator accepted the whole-workload gate using unchanged-owner noise attribution: all eighteen nonzero source-attributed caller files have identical base/candidate Git blobs. Operation shifts include database preparation +76 statements/+2 requests, domain execution −48/−7, corpus inventory +35/+2, entry reads +30/0, and plugin compare-delete −26/−4. These are invocation-count and phase-distribution differences, not removed SQL classes.
extensions/memory-core/src/memory/manager-cpu-worker-runtime.tssrc/config/config-state-mutation.tssrc/config/sessions/session-accessor.sqlite-entry-admission.tssrc/config/sessions/session-accessor.sqlite-reclamation-run.tssrc/config/sessions/session-accessor.sqlite-replacement-worker.tssrc/config/sessions/session-entry-patch.tssrc/config/sessions/session-entry-read-ordered.tssrc/config/sessions/session-entry-read-writable.tssrc/config/sessions/session-lifecycle-projection.tssrc/config/sessions/session-pending-input-store.tssrc/config/sessions/session-transcript-execution-read.tssrc/config/sessions/session-transcript-read-worker-runtime.tssrc/config/sessions/session-transcript-worker-runtime.tssrc/config/sessions/session-turn.tssrc/plugin-state/plugin-state-worker-client.tssrc/state/openclaw-agent-execution-native.tssrc/state/openclaw-agent-worker-store.tssrc/state/openclaw-state-read-worker.tsExisting same-pin root74 runs from the four required group pairs span 23,218–23,684 statements and 3,465–3,505 requests; these are descriptive controls, not extra pairs:
Attribution evidence is retained in
groups/claw/phase-table-and-operations.md,groups/claw/source-owner-identity.json, andsame-root74-control.json/.mdunder remote proof invocation17a52631a749/collected. The later assertion/record-type, generated-inventory, static cleanup, and missing-schema error-translation repairs do not change emitted statement/request classes; they are not presented as a new SQL measurement.Moving persistence to a worker is an ownership correction, not a saving. Administrative Claw operations can add worker dispatches and broader ownership reads; lease/deletion checks remain in totals. The ordinary tool-policy and prepared-provenance read modules are unchanged.
Review closure
The cumulative source reached the third P2 review round. The accepted config-publication and canceled-work settlement corrections are retained, along with subsequent focused failure and static-analysis repairs in the pinned source. Publication partitioning changes only grouping; no additional review round or new review result is claimed.
The final slice also carries the accepted assertion and worker-record type corrections plus the committed generated inventory. These are appended after the original cutover commit; earlier publication heads are unchanged.
Depends on #168432. Land after its prerequisite; this PR remains unmerged.