Skip to content

fix(doctor): retain interrupted capture publication evidence - #166495

Merged
steipete merged 2 commits into
mainfrom
codex/fs-safe-0.24.2-recovery-20261007
Oct 7, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/fs-safe-0.24.2-recovery-20261007

Conversation

@steipete

@steipete steipete commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes recovery discovery hiding healthy captures, and standalone Doctor retirement deleting interrupted captures, when publication stops after creating the destination but before removing the source name.

Closes #166246. Closes #166466.

Why This Change Was Made

Main already received fs-safe 0.24.2 through #166457. Both pre-repair publication sites now call fs-safe directly, removing the duplicate unsupported-rename adapter introduced by #166425. Native auto owns the exclusive link/unlink fallback; require remains fail-closed.

A remaining manifest.json.partial means publication is incomplete. Discovery lists it beside healthy captures without granting a sealed manifest reference; baseline reuse and forward-resolution validation refuse it; automatic retirement retains it. This applies equally to exact hard-link pairs, copied finals from the earlier adapter, and contradictory names. No name is removed and no pair is accepted as a restore point. Snapshot/payload pairs without a manifest remain incomplete evidence. Existing manifest digests, scope, directory identity, outcome binding, payload integrity, and hard-link rejection remain in force.

User Impact

Doctor can retain pre-repair captures on Linux filesystems that reject RENAME_NOREPLACE, using the upstream fallback. Interrupted captures remain available for manual inspection instead of disappearing from discovery or being deleted after 30 days. Ordinary expired sealed standalone captures keep their existing retirement policy. No configuration, database schema, or capture format changes are needed.

Thanks @MertBasar0 for the reproduction and recovery-window analysis.

Evidence

  • Verified all eight fs-safe 0.24.2 packages on npm; current main has all 13 direct pins and seven native platform locks at that version. All 104 generated npm lock mirrors pass, preserving platform constraints.
  • Before the repair, the retirement regression deleted all three interrupted manifest fixtures; discovery/reuse/forward-binding regressions produced six failures.
  • After the repair, pnpm test src/infra/update-database-backup.test.ts src/cli/update-cli/status.recovery.test.ts --maxWorkers=1 passed all 52 tests (366.45 seconds including compiled-worker preparation). The regression states cover both manifest and snapshot/payload link windows, copied finals, and mismatched names. Existing symlink, external-hardlink, scope, and binding refusals remain covered.
  • Independent Codex review: no actionable P0–P2 findings.
  • pnpm changed:lanes --json: core, core tests, documentation. pnpm check:changed passed, including core typechecking, all 27 test typecheck groups, full core lint, dead-export scans, runtime import cycles, and the applicable guards.
  • The first CI attempt found missing braces in the new branches. The behavior-preserving follow-up passed targeted lint and independent review. Exact-head CI run 37586605131 is fully green at 0e6d3975d38084f1850588f3f950a56919f89215; no admin exception is needed.
  • Linux proof passed on a task-owned Colima VM (Ubuntu 24.04.4, Linux 6.8.0-117 aarch64, Node 24.21.0, pnpm 12.5.1) after AWS admission was unavailable. The syscall probe confirmed renameat2(RENAME_NOREPLACE) returns EINVAL, while plain renameat2, rename, and link succeed.
  • Actual pnpm openclaw doctor --fix --non-interactive exited 0 and printed Pre-repair state retained for manual recovery at …/manifest.json in every case below. Every payload SHA-256 and size matched the manifest; successful publication left one link and no partial manifest.
Doctor state Control Selective seccomp EINVAL
Fresh state pass, 19.16 s pass, 19.82 s
Existing shared SQLite database pass, 17.12 s pass, 19.37 s
  • Real post-link/pre-unlink filesystem states were reconstructed from a Doctor capture: an exact manifest pair aged beyond 30 days, a SQLite snapshot/payload pair without a manifest, and a distinct-inode manifest pair. Running Doctor retirement and openclaw update status --json retained all bytes, inodes, and link counts; all three appeared as incomplete without recovery references, while two healthy sealed captures stayed visible.
  • On an XFS loop mount, real copyPluginSourceFile captured and hashed 64 MiB through the copied descriptor in 3.55 s. strace recorded successful FICLONE; inodes differed (131/132), free space was unchanged at cloning, and destination mutation left source bytes unchanged while the remaining extents stayed shared. The mount was released.
  • Exact-head CI also passed Doctor rehearsal (2 tests), fleet preflight (6), update/schema admission (18), and post-update recovery (40). The three additional manifest-parser, recovery-guidance, and directory-durability suites passed locally after a combined runtime importer invocation was refused before tests by the managed-Gateway artifact fence. That refusal was not bypassed.
  • The canonical published-driver Docker cell passed: published 2026.9.8 → exact candidate head 0e6d3975d380, update exit 0 in 650.837 s, finished state, readiness HTTP 200, running version verified, and durable/incognito session postchecks passed. The original 1125-second envelope was retained. The informational publication-recovery command did not indicate a failure. The released driver lacks modern original-capture lineage, so its documented missing-lineage notice remains; the standalone Doctor capture cases above all succeeded. Candidate tarball integrity/import-graph checks passed; SHA-256 b0e1cdb3109c1151e147f3f119ca8eae01869301761016d6543eaa38b06f42e9.
  • Total selected consumer coverage: 170 passing tests across nine capture, recovery, Doctor, manifest, and durability files. Docker workload cleanup and XFS unmount completed. The task-owned VM and its container data were removed. No AWS lease was allocated.
  • Production LOC: +55/−58 (net −3); tests +105/−96 (net +9). The 43-line retry adapter and its 77-line implementation-specific suite are removed.
Release change Consumer audit
fs-safe#843 exclusive-publication fallback Direct use at both capture sites; duplicate fallback removed; interrupted evidence retained conservatively.
fs-safe#844 readable native clone descriptors Plugin capture already hashes copied.fd; no call-site change needed. Real XFS clone and copied-descriptor hashing proof passed.

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: M labels Oct 7, 2026
@steipete
steipete marked this pull request as ready for review October 7, 2026 07:02
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 7, 2026, 4:02 AM ET / 08:02 UTC (Revision 4).

ClawSweeper review

What this changes

Doctor and update recovery preserve interrupted capture publications as incomplete evidence and delegate exclusive file publication directly to fs-safe.

Merge readiness

⛔ Blocked before merge - 2 items remain

This PR still addresses a current-main recovery defect. No actionable code findings remain; the required published-updater compatibility result is still pending.

Priority: P2
Reviewed head: 0e6d3975d38084f1850588f3f950a56919f89215

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch has convincing runtime evidence and no actionable findings, but mandatory upgrade proof remains incomplete.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 9 items Introduced patch and ownership: Reviewed the pinned merge-base-to-head delta across all eight paths. The stale test merge was not used to infer removal of current-main behavior.
Conservative seal classification: Any retained partial manifest prevents sealed metadata access and automatic retirement. Discovery lists interrupted pairs without a recovery reference; strict manifest, scope, outcome and hard-link checks remain.
Current main still needs the consumer fix: Fetched main and the PR merge base have identical reader and capture-owner blobs. Main still uses the local publication adapter, lacks pending-seal discovery classification, and reads retirement manifests directly. The already-merged dependency update does not fix these consumers.
Findings None None.
Security None None.

How this fits together

Doctor and the updater capture original configuration and database state before repairs. Recovery discovery presents those captures for inspection, while retirement removes only eligible sealed standalone Doctor copies.

flowchart TD
  A[Original configuration and databases] --> B[Doctor and update capture]
  B --> C[Exclusive filesystem publication]
  C --> D{Partial manifest remains?}
  D -->|Yes| E[Retain incomplete evidence]
  D -->|No| F[Validate sealed capture]
  F --> G[Recovery inspection or eligible retirement]
Loading

Before merge

  • Resolve merge risk (P1) - The required published-updater compatibility cell has no completed result yet, leaving candidate installation identity, managed Gateway recovery and candidate Doctor validation unverified through the shipped driver.
  • Complete next step (P2) - Record the completed published v2026.9.8 updater × pinned candidate compatibility result, including payload identity, managed Gateway readiness and candidate Doctor validation.
Agent review details

Security

None.

PR surface

Source -3, Tests +9, Docs +5. Total +11 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 55 58 -3
Tests 3 105 96 +9
Docs 1 7 2 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 167 156 +11

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #166466
Summary: This PR is the candidate repair for the interrupted-seal discovery and retirement defects.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Complete the existing compatibility cell (recommended)
    Record the published v2026.9.8 updater installing the pinned candidate, verifying payload identity, restoring Gateway readiness and completing candidate Doctor validation.

Technical review

Best possible solution:

Keep one filesystem publication owner and conservatively retain interrupted captures without granting restoration authority, backed by successful fresh-state and published-upgrade evidence.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: on current main, a final-plus-partial manifest can fail inventory reading or qualify for expired standalone retirement. This review did not execute that path.

Is this the best way to solve the issue?

Yes. A shared conservative seal classifier and direct use of the dependency's publication owner address the violated invariant without accepting hard links as restore points.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 191ebcef6aa1.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded recovery-evidence repair for interrupted filesystem publication.
  • merge-risk: 🚨 compatibility: Doctor/update behavior changes require a published-driver compatibility result that is still in progress.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

  • Introduced patch and ownership: Reviewed the pinned merge-base-to-head delta across all eight paths. The stale test merge was not used to infer removal of current-main behavior. (0e6d3975d380)
  • Conservative seal classification: Any retained partial manifest prevents sealed metadata access and automatic retirement. Discovery lists interrupted pairs without a recovery reference; strict manifest, scope, outcome and hard-link checks remain. (src/infra/update-recovery-capture-seal.ts:6, 0e6d3975d380)
  • Current main still needs the consumer fix: Fetched main and the PR merge base have identical reader and capture-owner blobs. Main still uses the local publication adapter, lacks pending-seal discovery classification, and reads retirement manifests directly. The already-merged dependency update does not fix these consumers. (src/infra/update-recovery-backup-reader.ts:519, 191ebcef6aa1)
  • Verified dependency contract: The changed capture owner imports publication through OpenClaw's direct fs-safe re-export. At release v0.24.2, the dependency permits Linux link/unlink fallback only in native auto mode, preserves post-publication failures, and keeps require mode fail-closed. Its merged publication fix explicitly identifies the OpenClaw interrupted-seal consumer defects: fix(publish): fall back for rename-noreplace publication when RENAME_NOREPLACE is unsupported fs-safe#843. (src/publish-file-native.ts:8, 64b21b49a2c0)
  • After-fix production behavior: The captured body, sourceRevision 4ed61093909721b90ceb2d20c5349ec24198f8cc9daf2fadac691f25a980e5df, reports real Linux Doctor runs with selective RENAME_NOREPLACE denial on fresh and existing SQLite state. All four runs retained captures with matching payload hashes, one final link and no partial manifest. Reconstructed interrupted filesystem states survived retirement and status inspection while healthy captures remained visible. (src/infra/update-recovery-baseline-capture.ts:404, 0e6d3975d380)
  • Remaining upgrade proof: The captured body explicitly says the published-driver v2026.9.8 × candidate cell is in progress. Root policy requires this cell for Doctor/update changes. The discussion supports using the existing survivor harness and reusing upstream syscall proof: fix(doctor): retain interrupted capture publication evidence #166495 (comment). (AGENTS.md, 0e6d3975d380)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add the completed published-driver compatibility result with candidate payload identity, Gateway readiness and Doctor validation; redact private details before posting.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-07T07:07:30.918Z sha 02c3163 :: needs changes before merge. :: none
  • reviewed 2026-10-07T07:12:56.404Z sha 02c3163 :: needs changes before merge. :: none
  • reviewed 2026-10-07T07:46:38.809Z sha 0e6d397 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Oct 7, 2026

hippoley commented Oct 7, 2026

Copy link
Copy Markdown

The remaining Revision 2 ask looks narrower than re-proving the fs-safe syscall layer.

I wrote a bounded validation contract here:

https://github.com/hippoley/ClawManager/blob/main/docs/evidence/openclaw-166495-linux-doctor-published-driver-validation.md

The split is:

  1. Linux Doctor/seccomp entrypoint

    • reuse fs-safe Signal: add markdown formatting and chunked delivery #843 as the lower publication proof;
    • on Linux with the same selective rename-noreplace denial, run a real OpenClaw Doctor/update capture;
    • record that native auto fallback succeeds through the real OpenClaw owner;
    • successful seal ends with final present, partial absent, nlink=1;
    • keep linked/copied/conflicting interruption states in the deterministic focused regressions rather than trying to crash Doctor at an uncontrolled instant.
  2. Published-driver / candidate compatibility

    • reuse the repository's existing published-upgrade survivor harness;
    • e.g. exact published predecessor + source-pinned candidate via legacy-operator-state;
    • record published updater success, installed candidate payload identity, managed Gateway replacement/readiness, and Doctor/core validation.

That seems to match the review request without duplicating fs-safe's already-merged AWS/Linux seccomp proof or inventing another compatibility harness.

I also re-audited the current patch itself: the shared pending-seal classifier is conservative, metadata access checks seal completion before and after reads, and Doctor retirement re-checks pending seal immediately before assertCurrent() and recursive delete. No actionable patch defect found on my side.

Source-reviewed only; I did not execute the Linux/runtime lane.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 7, 2026
@steipete
steipete merged commit a86dd38 into main Oct 7, 2026
149 checks passed
@steipete
steipete deleted the codex/fs-safe-0.24.2-recovery-20261007 branch October 7, 2026 08:17
@steipete

steipete commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

2 participants