Repository navigation
Conversation
Activate command services and their add/update callers together; retain accepted-work settlement.
|
🦞👀 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 changesThis PR routes Claw add and update through the serving Gateway or an exclusive offline state owner. Example: Add the agent claw-worker while its Gateway is running, then request agents.list.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 8 items remain Keep open: the ownership repair is useful, but config confirmation can trigger incorrect workspace cleanup, and an added test depends on the following stack slice. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe CLI supplies source paths, options, and consent to the selected state owner, which invokes shared Claw composition, worker persistence, and config publication and returns command output. flowchart TD
CLI[Claw CLI] --> Selection[Local owner selection]
Selection --> Gateway[Serving Gateway]
Selection --> Offline[Exclusive offline owner]
Gateway --> Composition[Shared Claw composition]
Offline --> Composition
Composition --> Persistence[Worker persistence]
Composition --> Config[Config publication]
Persistence --> Output[Command result]
Config --> Output
Technical reviewBest possible solution: Keep the shared owner routing while distinguishing durable config commits from runtime confirmation and preserving resumable state. Do we have a high-confidence way to reproduce the issue? Source tracing establishes the post-write cleanup failure and the migration test mismatch; no target code or tests were executed during this read-only review. Is this the best way to solve the issue? Reusing the existing local state owner and shared composition is appropriate, provided persisted success is not confused with a failed application acknowledgment. Full review comments:
Overall correctness: patch is incorrect 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 authorization bypass was found, but the new retained-settlement boundary still needs final-effect authority evidence. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +327, Tests +190, Docs +13, Other +2. Total +532 across 58 files. Added test files: 0. View PR surface stats
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 Reviewed October 10, 2026, 7:43 AM ET / 11:43 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
A separate CLI process can write Claw-owned SQLite state while the Gateway is live, leaving its in-process caches stale. Accepted work also needs physical-owner authority to finish compensation after request cancellation.
User Impact
Claw add and update run through the selected live Gateway, or take exclusive offline ownership when the Gateway is stopped. Their next Gateway reads observe committed changes. Accepted cleanup retains settlement authority, and config publication checks current request authority.
Why This Change Was Made
Activate
runWithLocalStateOwner, narrow add/update Gateway methods, and their real CLI callers together. Reuse worker persistence, wait for config application, and never replay uncertain remote delivery locally. Delete superseded readiness/plugin reload adapters and native resume readers with their consumers. Preserve current removal behavior for the following slice.This is PR 12 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 +601/−274 (875 changed); tests/support +492/−302; docs +13/−0; tooling +2/−0. 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/claws/add.test.ts,src/claws/update-apply.test.ts,src/claws/packages.runtime.test.ts,src/claws/mcp-update.test.ts,src/claws/lifecycle-remove-ownership.test.ts, andsrc/infra/exec-approvals-store.test.ts.Source identity
PR base
bfa6e27e64b7ba10a0aaeee4ae7a8d1bd1b2402d; head4fe3617a60097b750603cd920cf1d2e9e8f5ed31; tree9968382b51fe14165238e41819f052ec0d54cea6. 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.
Depends on #168431. Land after its prerequisite; this PR remains unmerged.