Repository navigation
refactor(config): simplify guarded config writes - #159605
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 September 27, 2026, 7:00 PM ET / 23:00 UTC (Revision 9). ClawSweeper reviewWhat this changesThe branch moves root and included-config atomic write guards to fs-safe while retaining OpenClaw’s conflict checks, backups, permissions, and conditional recovery. Merge readiness✅ Ready for maintainer review Current main and the latest release still use the existing guarded writer, so this PR remains distinct work. The scoped behavior evidence is strong and this review found no concrete introduced defect. The published-updater run verified config publication but timed out during later Gateway readiness. Priority: P2 Review scores
Verification
How this fits togetherCLI, updater, and Gateway config requests reach OpenClaw’s config writer with a snapshot and any included files. The writer checks ownership and conflicts, delegates file replacement to fs-safe, then records publication or performs conditional recovery. flowchart LR
A[CLI and updater requests] --> B[Config snapshot and includes]
B --> C[OpenClaw write guard]
C --> D[fs-safe atomic write]
D --> E[Config and backup files]
D --> F[Publication receipt]
F --> G[Conditional recovery]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -119, Tests +106. Total -13 across 9 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep fs-safe responsible for atomic filesystem effects and OpenClaw responsible for config conflicts and recovery, with root and included writes preserving their backup and rollback behavior. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving refactor. Root/include CLI runs, native Windows handle cases, and fault-injection tests provide checks for the behavior it must retain. Is this the best way to solve the issue? Yes: the released fs-safe contract is the narrower owner for atomic file effects, while the config writer retains its conflict and recovery policy, including the pre-verification rename observation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0722b96fe87a. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
7ccb8df to
e8a4897
Compare
e8a4897 to
fe5a276
Compare
b61c130 to
5667d4d
Compare
Replace the filesystem-wide write proxy with fs-safe atomic authority callbacks and destination-state facts. Keep config/include conflict policy, backup identity checks, and rollback decisions with the config writer. Preserve ordinary root rename of hardlinked configs without changing aliases. This local prototype depends on the pending fs-safe atomic hook API. Keep the released dependency pin unchanged until that API ships. Validation: owning core and config/CLI test types pass against the local proposal; 355 existing consumer cases pass with five native Windows skips. After restoring root hardlink admission, the affected 257-case cohort passes. The new real-file regression fails on the stricter variant and passes with alias bytes intact (1.173s body; 55.70s single-worker cold command). Fresh independent review reports no actionable P0-P2 findings.
Retain descriptor-derived successful-rename observations so post-rename verification failures still receive conditional rollback. Cover that publication boundary and hardlink compatibility through the existing config IO fixture, extracting coherent cases without growing its oversized test file.
Install the fsync spy before the writer captures filesystem functions. Arm revocation at beforeCommit and assert it occurs, preserving the existing file, backup, identity, and directory-mode assertions.
5667d4d to
dc67105
Compare
|
Merged via squash.
|
* refactor(config): prototype atomic mutation guards Replace the filesystem-wide write proxy with fs-safe atomic authority callbacks and destination-state facts. Keep config/include conflict policy, backup identity checks, and rollback decisions with the config writer. Preserve ordinary root rename of hardlinked configs without changing aliases. This local prototype depends on the pending fs-safe atomic hook API. Keep the released dependency pin unchanged until that API ships. Validation: owning core and config/CLI test types pass against the local proposal; 355 existing consumer cases pass with five native Windows skips. After restoring root hardlink admission, the affected 257-case cohort passes. The new real-file regression fails on the stricter variant and passes with alias bytes intact (1.173s body; 55.70s single-worker cold command). Fresh independent review reports no actionable P0-P2 findings. * refactor(config): preserve recovery with fs-safe guards Retain descriptor-derived successful-rename observations so post-rename verification failures still receive conditional rollback. Cover that publication boundary and hardlink compatibility through the existing config IO fixture, extracting coherent cases without growing its oversized test file. * test(config): preserve updater revocation injection Install the fsync spy before the writer captures filesystem functions. Arm revocation at beforeCommit and assert it occurs, preserving the existing file, backup, identity, and directory-mode assertions.
What Problem This Solves
Config writes duplicate filesystem mutation fencing and descriptor tracking that released fs-safe 0.21.0 can now own.
User Impact
No intended user-visible change: root and included config writes retain conflict checks, backups, permissions, and conditional recovery. No configuration or migration is required.
Why This Change Was Made
Use fs-safe's mutation guards and destination receipts, removing 115 net production implementation lines (119 physical lines). OpenClaw retains config policy and include-directory mode preservation.
A small descriptor-based rename observer remains necessary: rename can succeed before fs-safe's destination verification throws. Recording that effect preserves the existing recovery behavior without claiming the destination has been verified.
Evidence
b61c130ae7366b8dc4680acdc92a93fe1dccdbd7; one worker, 663.40 seconds wrapper wall including compilation. The three branch patches remain identical after integrating main's newer recovery handling and canonical CI fixture repairs.pnpm openclaw --profile <profile> config setcommands passed for root and include writes, recovery backups, root-byte preservation, and file/directory modes. Synthetic state was removed; no operator Gateway changed.Published updater → candidate config publication is verified. In run 36351266940, genuine published
[email protected]installed frozen candidateb61c130a. Both candidate-package and installed-payload identity checks passed. The initial update receipt recordssuccessfulUpdateCheck.outcome: "passed",plugins.status: "ok", andplugins.changed: true; candidate source produces that positive result only after its awaited config commit, and the published parent consumes it after joining child settlement. Automatic config/state survival passed for 4,800 sessions, 23,890 events, and 2,200 cron jobs. No later standalone Doctor or recovery supplied this result. This evidence applies to the unchanged atomic implementation on current head.The complete upgrade scenario remains failed. Its later
gateway-startexceeded the unchanged readiness budget: HTTP bound around 49 seconds and plugin loading finished around 74 seconds, with no recorded exception or OOM before subsequent startup work exhausted the wait. Gateway health/RPC, volume-history, idempotence, and restart checks were not reached. The separate post-core exit snapshot is unavailable; no natural child exit code is claimed. The verified result artifact retains the initial update receipt, failure report and lane log.The earlier base scenario 36342219335 failed before candidate execution when the published baseline reached ready after its 90-second budget. A subsequent successful candidate build in
36348693598hit source-reachability validation after this PR was rebased; a temporary branch now retains the frozen commit, and36351266940reused that exact integrity-verified tarball. No budgets or assertions were weakened and no replacement package was rebuilt.Earlier CI failures and retained proof
The rotated-parent registry failure in runs
36314958232and36321950634was repaired canonically by #159735 (77847b567203). A local 326-pass/one-skip replay alone did not establish that fix. The subsequent ended-schema failure in run36333119253was resolved by main's revert1664e4cf2626; the original 68-file selection then passed all 949 tests locally in 557.75 seconds. These canonical repairs are incorporated.Run
36335209359exposed the updater spy-capture mismatch repaired here. The original hosted group had 1,015 passes, one failure, and one skip; an interrupted 57-file local replay is not counted as proof. Run36339385089subsequently hit unrelated ACP/media test-type errors, now repaired on main by #159836 (0b6f02faae37) and incorporated through the rebase. Original failure logs are retained.In run
36348533086,check-dependenciesfailed: full-tree Knip could not discover the newly added shell-invokedscripts/pr-lib/merge-prior-ci.mjs. Canonical main fix0d02ab7aaf657c1872a5dac32369e88504e3bd5cregisters the real entry and has green main CI. Current headdc671053a71a7a070683de2cb54ffee8838f06e2incorporates it; all three branch patches are identical in range-diff, and config/updater production files and dependency inputs are unchanged. The published-updater proof remains pinned tob61c130a; the workflow was subsequently cancelled after the corrected head was pushed.Run
36349688566exposed a separate native-completion fixture failure: the retired-turn-receipt case observed two timers instead of zero. The original sequential Memory→Codex prefix passes all 242+279 tests locally (1,533.50 seconds); a focused allocation trace passes all four cases and observes the expected 10-ms retry followed by zero timers (349.21 seconds, predominantly compilation). These are non-reproductions, not fixes. Canonical main repair #159864,aea667c764a8592d58a0efa4e85d741a70b4862b, scopes real database setup/teardown to the durable-receipt case while preserving every delivery, pin-release and zero-timer assertion. Current headdc671053a71a7a070683de2cb54ffee8838f06e2incorporates that repair; all three branch patches remain identical in range-diff and config/updater production and dependency inputs are unchanged. The shared repair owner retains the Linux causal qualification. No competing fixture edit or unchanged CI rerun was made here; fresh receiving CI is required.Earlier applicable proof includes 356 config/include/rollback/source-lock/uninstall tests (266.72 seconds), 334 config/include/deferred-migration tests (686.56 seconds), and a post-rename verification regression that failed with the callback-only implementation and passed with the retained observer (175 ms). Existing review and platform evidence applies to the unchanged production patch; fresh hosted CI remains required before landing.