Repository navigation
fix(doctor): preserve migration authority and stop refused repairs - #139683
fuller-stack-dev merged 10 commits into
Conversation
Keep live caller authority separate from artifact-preserving copied-state planning. Carry planned endpoints and requiredness through ordered receipts, close required refusals, and settle deferred plugin work after its writer. Continue the migration work from openclaw#136529 by Jason (Json), @fuller-stack-dev, without replacing the original public branch or history.
|
🦞👀 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. |
Snapshot publication cleanup correctionPublished 98dd65039879, tree The snapshot failure catch could infer cleanup ownership from a later pathname observation and remove another writer's replacement. The existing fs-safe publisher already retains the original opened-object identity. This correction removes SQLite's second failed-publication cleanup path. Successful publication still records its receipt before strict directory-sync validation and retains guarded cleanup for its own target. Production changes are +27/-42, net -15; tests are +99/-16. One tradeoff is explicit: bytes linked from a substituted staging pathname are not proven to belong to this publication. They may remain after refusal. The operation still fails and never accepts those bytes as a verified snapshot or retries an overwrite. Tests retain the refusal and assert preservation. Unmodified captured collision/unknown-zero cases refused publication but deleted the literal replacement and ended in ENOENT. A separate staging-transition control reproduced the same loss in the first draft. All corrected captured cases preserve the replacement. The existing independent reader assessed the additive packet The same 24 publication controls pass, including owned hardlink/exclusive-copy durability cleanup. Corrected max-P2 review is scoped-clean. The 21 affected or previously unreached native stages passed, with eight unchanged predecessor stages retained separately. This is not a fabricated uninterrupted gate pass. The integrated runner also passed two selected CI-plan checks and the same 24 publication controls. No build or broader behavior matrix was repeated. The latest review's intentional stop-on-required-refusal behavior remains within the accepted migration contract, with partial-invalid-config, advisory-warning and legacy-plugin controls preserved. No schema version, stored representation or dependency policy changed. User merge authorization is already recorded; this does not claim a secops review or organization membership. The existing Linux package/auth/API and later caller-lock evidence keep their original source identities and limitations; the PR's public evidence links remain unchanged. Exact-head CI run 34017907280, including native Windows and security/audit, is still required. Old-head green CI is not substituted. Native preparation and verified merge remain pending. |
|
Follow-up to the 07:05 review of For installed
SHA256, respectively: The SQLite correction removes the compensating cleanup owner rather than using the numeric error receipt as deletion authority. An unowned target can remain after a refused publication; it is not accepted, overwritten or retried. The retained replacement/staging-substitution controls and corrected scoped review cover that choice. No native Windows cause or real inode-reuse claim is added. Exact-head CI 34017907280 and Workflow Sanity completed successfully, including Windows and all three fixed-256-MiB session-memory scenarios. The production audit completed with no matching high-or-higher npm-bulk advisories; its stated coverage limit remains. Native preparation passed without changing the public head. Required-refusal behavior, legacy/advisory compatibility and the previously recorded user-directed scope acceptance remain unchanged. No security-team review is being represented by that acceptance. Earlier evidence keeps its original source/platform qualifications. Custom per-feature Lab reenactments are no longer a remaining gate under the user's revised journey scope; unrun clauses are superseded, not passed. This comment is a dependency/review disposition, not a merge claim. |
|
Merged via squash.
|
…penclaw#139683) * fix(doctor): bind migration authority and ordered receipts Keep live caller authority separate from artifact-preserving copied-state planning. Carry planned endpoints and requiredness through ordered receipts, close required refusals, and settle deferred plugin work after its writer. Continue the migration work from openclaw#136529 by Jason (Json), @fuller-stack-dev, without replacing the original public branch or history. * fix(doctor): preserve caller locks during snapshot hashing Isolate snapshot file descriptors from caller-held SQLite transactions. Keep framed worker input and ordered refusal semantics, classify deliberate foreign-store omissions at their owner, and retain exact CLI controls. * fix(doctor): preserve uncached caller locks during planning * test(doctor): bind final traversal refusal diagnostics * fix(sqlite): preserve publisher cleanup ownership
…177761) ## What Problem This Solves Removes redundant snapshot recertification and a second command-line parser while keeping the existing config-capture and Commander owners. ## User Impact No public flags, config fields, stored data, or features change. Backup archives continue using hash-checked staged config bytes; read-only migration planning retains before/after identity comparisons, file-open checks, and hard-link confinement. Concurrent edits between separate observations are best effort. ## Why This Change Was Made The migration snapshot worker retained every observed entry and synchronously walked the entire tree again after hashing. The planner already compares independent captures around planning, and the worker still verifies files while reading them. Archive config staging also replayed the resolver and reread every original after writing validated bytes into private staging. That cannot change the staged payload. The update-recovery caller uses a different copy path, so its resolver revalidation remains. Plugin-install pre-action handling now consumes Commander's parsed arguments/options directly instead of reparsing raw argv as a fallback. Commander processes arguments before pre-action hooks. All source ownership and invalid-config recovery policy checks remain. ### Best-effort tradeoffs accepted - Editing an already-hashed entry while later entries are being hashed is no longer caught by a final synchronous census. The introducing [#139683](#139683) supplies no human-filed incident for that census; its real safe-open, external-hardlink, and caller-lock protections remain. A later observation detects ordinary changes; pathological interleavings during this read-only planning operation are accepted. - Changing live config after its validated bytes have entered archive staging no longer rejects the archive through a second resolver/file-read pass. The include-completeness repair from [#143693](#143693) remains: each staged file must match the captured graph's initial hash and identity. No human report establishes a need to certify the originals again after staging. The archive contains the already captured bytes; root-alias publication checks stay. - No extra fallback is retained for a pre-action hook running before Commander has parsed its arguments: the installed Commander dispatch order rules that out. Public arguments/options and plugin recovery decisions are unchanged. This is a residue-waiver cleanup, not a LARGE PR: **106 net production lines removed**, plus 80 test lines removed. Only the synthetic late-mutation table tied exclusively to the removed final census is deleted; ordinary safety and recovery coverage is retained. ## Evidence Focused proof: 113 distinct tests across seven files pass, covering real Commander recovery policy, archive/restore with include graphs, read-only snapshot identities, caller SQLite locks, external hard links and lint-suppression policy. The first run exposed one test invoking pre-action before parsing; it now uses its existing real-Commander parse helper with every recovery input/assertion unchanged, and all24 pre-action tests pass on replay. No production fallback was restored. Four-root production typecheck, eight-file lint/format and runtime import cycles pass (zero cycles). Check-changed classification was inspected in dry-run mode; broad local gates were deliberately not run. Shared-host wall time: three infra files519.47s (67% transform), final pre-action file141.34s (70% transform). Existing process/filesystem safety cases remain; no timeout, retry, skip or baseline was weakened. This is correctness proof, not a wall-time speedup claim. Type-inclusive cycles also pass (zero), and independent final eight-file review is scoped-clean through P2. Exact-head PR CI is the broad gate. All local commands used isolated HOME/state/config/XDG paths; no live state, external channel, schema, dependency, permission, retention or durability change.
…penclaw#177761) ## What Problem This Solves Removes redundant snapshot recertification and a second command-line parser while keeping the existing config-capture and Commander owners. ## User Impact No public flags, config fields, stored data, or features change. Backup archives continue using hash-checked staged config bytes; read-only migration planning retains before/after identity comparisons, file-open checks, and hard-link confinement. Concurrent edits between separate observations are best effort. ## Why This Change Was Made The migration snapshot worker retained every observed entry and synchronously walked the entire tree again after hashing. The planner already compares independent captures around planning, and the worker still verifies files while reading them. Archive config staging also replayed the resolver and reread every original after writing validated bytes into private staging. That cannot change the staged payload. The update-recovery caller uses a different copy path, so its resolver revalidation remains. Plugin-install pre-action handling now consumes Commander's parsed arguments/options directly instead of reparsing raw argv as a fallback. Commander processes arguments before pre-action hooks. All source ownership and invalid-config recovery policy checks remain. ### Best-effort tradeoffs accepted - Editing an already-hashed entry while later entries are being hashed is no longer caught by a final synchronous census. The introducing [openclaw#139683](openclaw#139683) supplies no human-filed incident for that census; its real safe-open, external-hardlink, and caller-lock protections remain. A later observation detects ordinary changes; pathological interleavings during this read-only planning operation are accepted. - Changing live config after its validated bytes have entered archive staging no longer rejects the archive through a second resolver/file-read pass. The include-completeness repair from [openclaw#143693](openclaw#143693) remains: each staged file must match the captured graph's initial hash and identity. No human report establishes a need to certify the originals again after staging. The archive contains the already captured bytes; root-alias publication checks stay. - No extra fallback is retained for a pre-action hook running before Commander has parsed its arguments: the installed Commander dispatch order rules that out. Public arguments/options and plugin recovery decisions are unchanged. This is a residue-waiver cleanup, not a LARGE PR: **106 net production lines removed**, plus 80 test lines removed. Only the synthetic late-mutation table tied exclusively to the removed final census is deleted; ordinary safety and recovery coverage is retained. ## Evidence Focused proof: 113 distinct tests across seven files pass, covering real Commander recovery policy, archive/restore with include graphs, read-only snapshot identities, caller SQLite locks, external hard links and lint-suppression policy. The first run exposed one test invoking pre-action before parsing; it now uses its existing real-Commander parse helper with every recovery input/assertion unchanged, and all24 pre-action tests pass on replay. No production fallback was restored. Four-root production typecheck, eight-file lint/format and runtime import cycles pass (zero cycles). Check-changed classification was inspected in dry-run mode; broad local gates were deliberately not run. Shared-host wall time: three infra files519.47s (67% transform), final pre-action file141.34s (70% transform). Existing process/filesystem safety cases remain; no timeout, retry, skip or baseline was weakened. This is correctness proof, not a wall-time speedup claim. Type-inclusive cycles also pass (zero), and independent final eight-file review is scoped-clean through P2. Exact-head PR CI is the broad gate. All local commands used isolated HOME/state/config/XDG paths; no live state, external channel, schema, dependency, permission, retention or durability change.
Related: #124396
Continues #136529 by Jason (Json), @fuller-stack-dev, as the approved credited replacement. The original public branch and its history remain intact. This PR carries the reviewed Doctor changes onto current canonical code without rewriting that branch.
Additional instructions
Keep Allow edits from maintainers enabled.
What Problem This Solves
Fixes an issue where users running Doctor through update or repair callers could leave required legacy state unmigrated, or continue later repairs after a required migration refused. The public CLI also imported and removed exec approvals before reporting malformed TUI state.
Copied-state migration inspection had a separate authority problem: discovery could reach external configured stores or change SQLite sidecars and existing process locks while describing the operation as read-only.
Why This Change Was Made
Use the migration owner for ordered detection, execution and recorded outcomes. Preserve the same action, owner endpoints and requiredness through live preparation and receipts, including deferred post-session plugin work. A required refusal closes later work and reaches the real Doctor caller instead of ending as a successful repair.
Copied inspection uses explicit snapshot roots and artifact-preserving SQLite readers. It does not load plugin code, create live profile state or reuse copied-plan authority for ordinary live Doctor execution. The diagnostic
update migration-plancommand cannot bind a candidate artifact, so it reportscandidate-artifact-digest-requiredrather than granting execution authority.Plugin declarations provide metadata-only planning. Live plugin selection retains disabled-owner and external-shadow boundaries. Existing state-schema, auth, worktree and session owners perform their own repairs; no new SQLite schema version, update transaction, activation, rollback or worker-cleanup owner is introduced.
The current-base integration preserves retired-model context, plugin SDK diagnostics, browser skipped status and unrelated baseline reductions. The optional-skill update-preference fix already landed separately in #138730 and is not duplicated here.
Production: +4,859/-757 lines, net +4,102. Tests and test support: +7,557/-925, including the test-runtime prerequisite. Docs: +36/-3. Assertion baseline: +1/-3. The production growth implements closed plan/receipt descriptions and copied-state authority for the existing migration graph; it is not a new storage framework. Tests moved between split files are included in the raw test totals.
User Impact
Doctor-owned migrations stay selected when invoked through the automatic helper. Required failures stop subsequent repairs and return failure to the operator. Partially invalid configuration still permits the existing config-independent recovery path. Ordinary automatic migrations and explicit live Doctor repair retain their distinct authority.
Copied planning preserves protected configuration, state, DB/WAL/SHM inputs and existing Linux auth locks. It records unresolved or deferred work honestly instead of guessing endpoints or loading plugins. This diagnostic plan is not candidate containment or permission to execute it.
Evidence
The original red observations and earlier failed private-package result remain at the original PR and the packaged CLI failure receipt. No historical failure has been regraded.
Packaged Linux and independent observations
Evidence summary · Exact artifact manifest · Raw terminal video
The published records bind real source base
561d6556d3c5081eb64f8f184a5b8fe92917c060, authored tree8d9beb66dd4c3a5b8f48de8662deff83302ff53cand package SHA256f7bd2b2926e3c51cc61a7848a41fa0a5d8aa7a6c384e1913b6f6cf9053133465. Native build metadata names the real base; the authored tree is recorded separately. These are not claims of execution on a later integrated head.The manifest includes all three independent evidence notes and the original prospective contracts. Its SHA256 is
0b68e7742121edfbcb903ca356a428feb4734fcec4682213c3651a54dbc827e4. The video hashes to04f36876180220237d3d6c1d1772df63c543e3a52974f074538eef810fa1d43a; seven frames were inspected. Right-edge clipping is retained; complete CLI text is authoritative. Links expire September 13, 2026.The recorded live fixture permits ordinary config repair and selected-package generated skill links. It does not prove strict update config preservation, command-free recovery, continuous custody, hidden descriptor parity, expiry soak or a complete atomic update. The pre-run producer seal binds the package; the diff measurement is post-run, not reproducible-build proof. All three leases have recorded release and native settlement; remote erasure is not inferred.
Current integration
The reviewed task delta is integrated on canonical
23fda78a3436de81c399a6b4de28bd147fef94a9, authored treea070c64c9c5920ceb47ea0908a2b8bc227228084. The intervening owners and dependency/tool inputs were assessed once. All 102 non-baseline authored blobs and modes match the completed prior candidate; the baseline also retains upstream reductions. Unchanged proof is retained with that qualification.All 18 selected retirement, refusal, plugin, session-reclamation and browser files ran: 312 passed. Three additional cron/config-write ordering cases passed. The four retained real plugin-import/caller controls preserved the live writer and matching bound receipt, with disabled-owner and partially invalid configuration controls. These local controls are source-aware, not another source-blind or packaged run.
One scoped max-P2 integration review found no actionable findings at
bd8d6146. Prior whole-candidate reviews and resolved dispositions remain retained. The only subsequent correction reduces config flow from 704 to 700 counted lines by naming returned migration facts locally and inlining a single-use boolean alias. The original lint failure remains recorded. Targeted lint, core/core-test types and two write/no-write controls passed. Repeated real bound/disabled callers preserve property presence, all 44 ordered receipt values, the one selected writer call and disabled-owner non-execution. This mechanical correction does not change the reviewed contract. All eleven previously unreached native phases then passed, completing the selected plan with the prior 29 passed phases and corrected-file lint. This is qualified phase reuse, not a relabeled uninterrupted run.The final canonical range adds login-shell process isolation and uses the existing session-list projection in Gateway lookup. Their four affected test files passed: 45 tests, with one Linux-only session-ID test explicitly skipped on macOS. The native assertion ratchet and final diff/ancestry checks passed. All 193 policy/dependency inputs match the completed setup. The packaging helper extraction is byte-equivalent logic; its new caller is Docker-image pruning, not the retained self-contained tarball path. No final-head hosted CI or landed state is claimed by the artifact proof above.