Skip to content

perf(sqlite): prepare NOCOW stores and add offline btrfs repair - #160877

Merged
steipete merged 3 commits into
mainfrom
steipete/perf-micro-btrfs-nocow-sqlite-stores-20260919
Sep 29, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/perf-micro-btrfs-nocow-sqlite-stores-20260919

Conversation

@steipete

@steipete steipete commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Large SQLite stores on btrfs accumulate copy-on-write fragmentation, making page rewrites, checkpoints, and fsync expensive. The reported example was a 32.5 GB store with about 3.29 million extents and commit steps lasting 1.5–41 seconds.

User Impact

New agent and shared-state stores on Linux btrfs request chattr +C on their directory before SQLite creates the database, WAL, or SHM files. NOCOW trades btrfs data checksums and compression for in-place writes; SQLite integrity checks remain enabled. Missing tools or denied attributes are nonfatal.

Existing stores are repaired only in Doctor repair mode (--fix / --repair, including managed updater invocations that request repair). Doctor requires exclusive maintenance ownership, closed store handles, sufficient space, and verified copies; it preserves ownership, modes, access/default ACLs, sibling files, WAL contents, and the original directory. Unsupported tools and pre-publication failures leave the previous store in place with a warning. An uncertain exchange keeps activation stopped for inspection. Rewritten files have a new physical identity, so canonical validation runs again on next boot.

Why This Change Was Made

One filesystem-policy owner serves both open paths. Its extraction from sqlite-wal.ts preserves existing network-filesystem journaling decisions and keeps the file within its enforced line cap. The offline repair reuses Doctor maintenance custody, WAL-aware snapshot verification, update write receipts, and owned filesystem cleanup. Publication uses capability-checked GNU mv --exchange --no-copy; it never applies chattr to data files.

There are no SQL migrations, schema bumps, configuration options, or package dependencies. The offline path exceeds the micro-lane LOC guideline because the requested rewrite requires backup, permission preservation, source freshness checks, atomic-publication reconciliation, and recovery handling; the runtime addition is small.

Evidence

Measurement Before After
New agent/shared-store directory preparations 0 of 2 2 of 2, before database creation
Existing-store reopen No attribute changes 0 chattr calls
Physical btrfs I/O latency Operator observation above Unmeasured: Testbox kernel has no btrfs support

All heavy proof used provider blacksmith-testbox, profile openclaw-check.

Source proof passed: 162 focused and sibling test cases across the retained runs, the core typecheck and all 27 canonical test graphs, targeted lint, formatting, storage/schema guards, unused-export checks, and runtime import-cycle checks (0 cycles).

The baseline real-open regression failed on tbx_01m3n4hbg5e7trv1hfzx9gvh7c (0 preparations). The final repair suite and native unprivileged-reader proof passed on tbx_01m3n9zh7yvektznmv626e46hw. Missing maintenance methods in CLI test fixtures were fixed; the remaining seven type graphs and new-store tests passed on tbx_01m3nbp0g16gq31thf4q27p6hp, followed by the remaining gates selected by node scripts/check-changed.mjs --dry-run --base HEAD. Valid passing results for unchanged inputs were reused.

The complete candidate build and tarball integrity check passed. The published [email protected] → candidate base upgrade-survivor cell passed on tbx_01m3nd63g6v43n28ka2x9dgxzn, pinned to commit 4a64a2f06943a10544aaedbb8f6ab12aae66e9f5. Command: bash scripts/e2e/upgrade-survivor-docker.sh, with published baseline enabled, baseline [email protected], candidate current, scenario base, manual restart, and live models disabled. The run completed in 12m 29s; Gateway startup was 24s and health, readiness, and status probes were 1s each. It preserved state/config and completed Doctor while tolerating the intentionally unavailable plugin fixture. This is ordinary-filesystem upgrade proof, not a real btrfs rewrite. Testbox provisioning run. The initial dirty-tree attempt was correctly refused by the artifact identity guard and was replaced with this committed-candidate run.

Native Linux probes verified fuser closed/open-handle behavior, ACL and default-ACL preservation/removal, special modes, and the permission transition using an unprivileged reader. The old ordering exposed the copy; the corrected ordering kept it private and retained the source denial.

Independent review is clean through P2 after resolving ACL preservation and transient-access findings. Full btrfs inheritance, a real atomic directory exchange, and a latency comparison remain gaps: the lease lacks the btrfs kernel module and its GNU mv lacks exchange support. The repair reports unsupported tooling instead of using a non-atomic fallback.

Measured focused-test cost

Each command was pnpm test <file> --maxWorkers=1 on Testbox.

File Wall time
src/infra/sqlite-wal.nocow.test.ts 3.53 s
src/state/sqlite-nocow.test.ts 44.19 s
src/commands/doctor-sqlite-nocow.test.ts 27.16 s runner wall (final 18 cases)
src/commands/doctor-maintenance.settlement.test.ts 20.36 s
src/flows/doctor-health.migration-refusal.test.ts 24.73 s

Cold compilation dominates the store-open and repair runs; the real open-boundary test itself took about 0.13 s and the final repair cases about 0.21 s total. The real owner test is needed to catch preparation occurring after native creation; a helper-only test would miss that regression. Final CI completed in 19m 32s (1172 s) across the selected jobs; this is total run wall time, not additive test cost.

CI follow-up

Initial CI on 4a64a2f identified three integration omissions: the extracted filesystem module was absent from the PR wrapper source inventory, lsattr needed registration as an OS utility, and Doctor duplicated a raw integrity pragma. The follow-up completes the wrapper inventory and reuses assertSqliteIntegrity for quick-check and referential consistency.

The same CI merge used main 5ff5fb2783 and inherited two failures subsequently fixed upstream: plugin runtime API inventory (5b76930a9b6f) and shared-auth fixture ownership (70d7e7abf6e4). Those source owners are unchanged by this PR.

Follow-up validation used blacksmith-testbox lease tbx_01m3nfwpmbj690fk44kvtggdyv (provisioning run). After one frozen dependency installation, these passed:

  • node --import ./scripts/tsx.mjs scripts/check-kysely-guardrails.mts
  • pnpm deadcode:full (production dependency and full export scans)
  • node scripts/run-vitest.mjs src/commands/doctor-sqlite-nocow.test.ts test/scripts/eager-import-closure.test.ts test/scripts/pr-worktree-provision.test.ts src/plugins/contracts/plugin-sdk-runtime-api-guardrails.test.ts (99.76 s runner wall; all selected files pass; one pre-existing platform-specific provisioning case skipped)

node scripts/run-oxlint.mjs --tsconfig tsconfig.json src/commands/doctor-sqlite-nocow.ts config/knip.config.ts also passed with 0 warnings and 0 errors (11.8 s lint; 136.13 s including SDK type preparation). The follow-up lease is stopped.

Fresh independent review of the follow-up is clean through P2. The physical-btrfs gaps above remain unchanged.

Gateway fixture follow-up

CI on ce124b0795c3 passed all checks except checks-node-changed-compact-large-13 and its aggregate gate. The archive-terminal fixture's incognito-reset case encountered shared-state offline-maintenance admission after its archive case. This fixture duplicated the harness's read-context disposal and synchronously closed process-global shared SQLite, bypassing the existing suite's awaited, per-home lifecycle. The follow-up removes that redundant cleanup; all terminal ownership assertions remain intact. This is a test-fixture change, with no production lifecycle change.

The failure was not reproduced on blacksmith-testbox lease tbx_01m3nh3bvhk6kfzpseaadnzrpc (provisioning run): the unmodified two-case file and the original 18-file selection passed. This is not claimed as a deterministic regression fix. After removing the competing cleanup, the same 18-file selection passes all 167 cases in 128.99 s runner wall, using node --import ./scripts/tsx.mjs scripts/ci-run-node-test-shard.mts with the CI group and worker settings. The affected file also passes pnpm test src/gateway/server.sessions.archive-terminal.test.ts --maxWorkers=1 in 13.76 s wall. The lease is stopped.

Fresh independent review of the fixture cleanup is clean through P2; it confirms retained cleanup ownership and the stated reproduction gap. Follow-up commit: e5a6a969fa2f.

Final verification

Both parts merged as fb5f1954a293f18e12f4632db84a87bcfc78b74a. CI run 36515580255 on exact head e5a6a969fa2f3b3f2bd6d30bfc8f6d7ef92aac63 completed successfully in 19m 32s, with no failed jobs, including the Docker seed test and openclaw/ci-gate. The lead watcher performed the squash merge. All task-owned Testbox leases are stopped. No production Gateway was modified or restarted; physical btrfs latency and native directory-exchange proof remain the disclosed gaps.

@clawsweeper

clawsweeper Bot commented Sep 29, 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 commands Command implementations size: XL labels Sep 29, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 29, 2026
@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 28, 2026, 11:13 PM ET / September 29, 2026, 03:13 UTC (Revision 4).

ClawSweeper review

What this changes

On Linux btrfs, the branch requests NOCOW for new shared and agent SQLite stores and adds an offline Doctor rewrite for existing stores, with tests and storage documentation.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 13 items remain

Keep open: this is a useful storage change absent from current main, but the durability choice lacks the required maintainer acceptance and the replacement path has unresolved safety gaps.

Priority: P2
Reviewed head: e5a6a969fa2f3b3f2bd6d30bfc8f6d7ef92aac63
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The branch has substantial focused validation, but two blocking storage defects and missing real btrfs cutover proof limit merge confidence.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied Linux probe checks POSIX ACL access, but does not show that a nearest forbidden reader remains denied after a real btrfs exchange when security xattrs are present. The published-version upgrade run used an ordinary filesystem, so it also does not establish existing-state btrfs rewrite compatibility; redacted terminal traces of the affected final I/O path would address the proof gap. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied Linux probe checks POSIX ACL access, but does not show that a nearest forbidden reader remains denied after a real btrfs exchange when security xattrs are present. The published-version upgrade run used an ordinary filesystem, so it also does not establish existing-state btrfs rewrite compatibility; redacted terminal traces of the affected final I/O path would address the proof gap. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 10 items Introduced repair trigger: Doctor invokes the new offline rewrite whenever repair is true and it found a btrfs store without NOCOW.
Updater reaches repair: Current main passes repair: true to candidate Doctor during managed update, making the new rewrite reachable without a distinct NOCOW request.
Metadata copied before replacement: The new copy restores ownership, mode, and POSIX ACLs, but does not copy or verify other extended attributes before directory exchange.
Findings 2 actionable findings [P1] Keep NOCOW conversion out of implicit updater repair
[P1] Preserve extended attributes before exchanging directories
Security Needs attention Security labels can be lost on replacement: Only POSIX ACLs and basic stat metadata are restored before the new directory is installed; other xattrs, including possible security labels, are neither copied nor verified.

How this fits together

OpenClaw keeps shared and per-agent state in SQLite, and its store-opening paths prepare directories before creating database files. Doctor can replace existing stores under maintenance ownership, while managed updates invoke Doctor repair.

flowchart LR
  A[New or existing SQLite store] --> B{Store exists?}
  B -->|New| C[btrfs directory preparation]
  B -->|Existing| D[Doctor inspection]
  E[Managed update repair] --> D
  D --> F[Offline directory rewrite]
  C --> G[SQLite open]
  F --> G
  G --> H[Shared and agent state]
Loading

Decision needed

Question Recommendation
Should OpenClaw enable NOCOW by default for new btrfs SQLite stores and let ordinary managed updates convert existing stores despite losing btrfs checksums and compression? Require explicit NOCOW opt-in: Keep btrfs defaults for new and existing stores until the operator selects NOCOW through a documented setting or command.

Why: This changes the storage durability and upgrade contract, which repository policy reserves for an accepted maintainer design.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied Linux probe checks POSIX ACL access, but does not show that a nearest forbidden reader remains denied after a real btrfs exchange when security xattrs are present. The published-version upgrade run used an ordinary filesystem, so it also does not establish existing-state btrfs rewrite compatibility; redacted terminal traces of the affected final I/O path would address the proof gap. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Keep NOCOW conversion out of implicit updater repair (P1) - Managed update already invokes candidate Doctor with repair: true. This new condition therefore converts detected existing btrfs stores during an ordinary update, dropping filesystem checksums and compression and requiring a large offline copy without a distinct NOCOW choice. Keep the updater path diagnostic until an explicit operator action or accepted durability contract authorizes conversion.
  • Preserve extended attributes before exchanging directories (P1) - The replacement restores uid, gid, mode, and POSIX ACLs, but never copies or checks other extended attributes on the directory and its files. A successful exchange can therefore discard security labels or other stored metadata and change access behavior. Preserve and verify those attributes, or refuse the rewrite when they cannot be retained.
  • Resolve security concern: Security labels can be lost on replacement - Only POSIX ACLs and basic stat metadata are restored before the new directory is installed; other xattrs, including possible security labels, are neither copied nor verified.
  • Resolve merge risk (P1) - A normal managed update can rewrite existing btrfs stores, remove filesystem checksums and compression, require a large offline copy, and delay activation without a distinct operator choice.
  • Resolve merge risk (P1) - The replacement drops non-ACL extended attributes, including possible security labels, so an installed store or sibling file can have different access behavior.
  • Resolve merge risk (P1) - The published-version upgrade run did not exercise btrfs inheritance or a real directory exchange; existing-state rewrite and rollback compatibility remain unverified on the affected filesystem.
  • Complete next step (P2) - Decide the NOCOW durability contract, prevent unapproved updater conversion, preserve extended attributes, and provide real-btrfs upgrade and access proof before merge.
  • Improve patch quality - Record maintainer acceptance of the NOCOW durability default and keep ordinary updater repair from implicitly converting existing stores unless that behavior is explicitly approved.
  • Improve patch quality - Preserve and verify non-ACL extended attributes, including security labels, before directory exchange.
  • Improve patch quality - Add redacted real-btrfs final-effect and published-version upgrade proof covering the nearest forbidden reader and recovery outcome; updating the PR body triggers re-review, or a maintainer can request @clawsweeper re-review.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.

Findings

  • [P1] Keep NOCOW conversion out of implicit updater repair — src/flows/doctor-health.ts:386-387
  • [P1] Preserve extended attributes before exchanging directories — src/commands/doctor-sqlite-nocow.ts:96-109
  • [medium] Security labels can be lost on replacement — src/commands/doctor-sqlite-nocow.ts:96
Agent review details

Security

Needs attention: The offline replacement can discard security-relevant extended attributes; the diff adds no package dependency or unrelated supply-chain change.

PR surface

Source +555, Tests +612, Docs +27, Other +10. Total +1204 across 22 files.

View PR surface stats
Area Files Added Removed Net
Source 9 801 246 +555
Tests 10 620 8 +612
Docs 1 27 0 +27
Config 0 0 0 0
Generated 0 0 0 0
Other 2 11 1 +10
Total 22 1459 255 +1204

Review metrics

Metric Value Why it matters
Production and test growth production +555 net lines, tests +612 net lines The PR body explains the offline repair's size, but the large replacement path still needs filesystem-specific proof.
Changed store defaults 2 SQLite store types Both shared-state and per-agent creation paths now request NOCOW on Linux btrfs.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-maintenance-state.ts, migration/backfill/repair: src/commands/doctor-maintenance.ts, migration/backfill/repair: src/commands/doctor-sqlite-nocow.ts, migration/backfill/repair: src/flows/doctor-health.ts, unknown-data-model-change: src/commands/doctor-sqlite-nocow.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Repair and prove the storage cutover (recommended)
    After the durability choice is accepted, preserve non-ACL extended attributes and verify the existing-store upgrade, exchange, and recovery path on real btrfs.
  2. Pause the existing-store rewrite
    If a safe btrfs replacement cannot be proved, narrow this branch to the accepted new-store behavior and leave existing stores unchanged.

Technical review

Best possible solution:

Keep existing btrfs durability defaults until an operator chooses NOCOW, preserve and verify all security-relevant metadata during replacement, and prove the upgrade and recovery path on real btrfs.

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

Yes for the introduced updater path: current main passes repair: true, and the branch then calls the NOCOW rewrite for detected stores. Real btrfs replacement was not exercised in the supplied proof.

Is this the best way to solve the issue?

No. The offline maintenance owner is an appropriate boundary, but an explicit durability choice, complete metadata preservation, and real btrfs upgrade proof are needed before this implementation is safe to merge.

Full review comments:

  • [P1] Keep NOCOW conversion out of implicit updater repair — src/flows/doctor-health.ts:386-387
    Managed update already invokes candidate Doctor with repair: true. This new condition therefore converts detected existing btrfs stores during an ordinary update, dropping filesystem checksums and compression and requiring a large offline copy without a distinct NOCOW choice. Keep the updater path diagnostic until an explicit operator action or accepted durability contract authorizes conversion.
    Confidence: 0.97
  • [P1] Preserve extended attributes before exchanging directories — src/commands/doctor-sqlite-nocow.ts:96-109
    The replacement restores uid, gid, mode, and POSIX ACLs, but never copies or checks other extended attributes on the directory and its files. A successful exchange can therefore discard security labels or other stored metadata and change access behavior. Preserve and verify those attributes, or refuse the rewrite when they cannot be retained.
    Confidence: 0.93

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 842697352d23.

Labels

Label changes:

  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied Linux probe checks POSIX ACL access, but does not show that a nearest forbidden reader remains denied after a real btrfs exchange when security xattrs are present. The published-version upgrade run used an ordinary filesystem, so it also does not establish existing-state btrfs rewrite compatibility; redacted terminal traces of the affected final I/O path would address the proof gap. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • remove status: ⏳ waiting on author: Current PR status label is status: 📣 needs proof.

Label justifications:

  • P2: This is a bounded storage-performance improvement with material merge questions, not an observed emergency.
  • merge-risk: 🚨 compatibility: Existing btrfs stores can be converted during routine update, changing checksum and compression behavior.
  • merge-risk: 🚨 security-boundary: The active replacement can lose non-ACL extended attributes that carry access-control labels.
  • merge-risk: 🚨 availability: A large offline rewrite and uncertain exchange can delay or stop Gateway activation.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Authority-chain proof required: the supplied Linux probe checks POSIX ACL access, but does not show that a nearest forbidden reader remains denied after a real btrfs exchange when security xattrs are present. The published-version upgrade run used an ordinary filesystem, so it also does not establish existing-state btrfs rewrite compatibility; redacted terminal traces of the affected final I/O path would address the proof gap. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Security concerns:

  • [medium] Security labels can be lost on replacement — src/commands/doctor-sqlite-nocow.ts:96
    Only POSIX ACLs and basic stat metadata are restored before the new directory is installed; other xattrs, including possible security labels, are neither copied nor verified.
    Confidence: 0.91

What I checked:

Likely related people:

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

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-09-29T01:53:22.112Z sha 4a64a2f :: blocked before merge. :: [P1] Keep existing-store NOCOW conversion out of implicit updater repair | [P1] Preserve extended attributes during directory replacement
  • reviewed 2026-09-29T02:10:24.648Z sha 4a64a2f :: blocked before merge. :: [P1] Keep NOCOW conversion out of implicit updater repair | [P1] Preserve extended attributes during directory replacement
  • reviewed 2026-09-29T02:46:38.765Z sha ce124b0 :: blocked before merge. :: [P1] Keep NOCOW conversion out of implicit updater repair | [P1] Preserve extended attributes before replacing store directories

@steipete
steipete marked this pull request as ready for review September 29, 2026 02:03
@steipete
steipete enabled auto-merge (squash) September 29, 2026 02:06
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Sep 29, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Sep 29, 2026
@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 29, 2026
@steipete
steipete merged commit fb5f195 into main Sep 29, 2026
218 checks passed
@steipete
steipete deleted the steipete/perf-micro-btrfs-nocow-sqlite-stores-20260919 branch September 29, 2026 03:25
steipete added a commit that referenced this pull request Sep 29, 2026
The database write receipt has carried `fromGenerations` since #160671; the
NOCOW attribution case added in #160877 still asserted the two-field shape, so
src/commands/doctor-maintenance.settlement.test.ts was red on main and on every
PR merge ref. Assert the admitted baseline like the sibling cases do.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
…claw#160877)

* perf(sqlite): prepare NOCOW stores and add offline btrfs repair

* fix(sqlite): complete NOCOW integrity and tooling integration

* test(gateway): leave terminal fixture cleanup with its suite owner
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
The database write receipt has carried `fromGenerations` since openclaw#160671; the
NOCOW attribution case added in openclaw#160877 still asserted the two-field shape, so
src/commands/doctor-maintenance.settlement.test.ts was red on main and on every
PR merge ref. Assert the admitted baseline like the sibling cases do.
steipete added a commit that referenced this pull request Oct 1, 2026
… restore

Rebasing onto main surfaced two receipts that relied on interval-wide
attribution: the NOCOW physical replacement (#160877) and Doctor's own
schema upgrade during legacy-root relocation. Under the conservative
policy neither is attributable, so both receipts are ineligible for
automatic restoration.
steipete added a commit that referenced this pull request Oct 1, 2026
…database writes (#160167)

* fix(update): reject unattributed database writes during Doctor

Keep the captured fingerprint baseline through Doctor settlement. Maintenance ownership does not exclude independent SQLite writers, so any observed change, including a new database, must refuse automatic restoration through the existing receipt contract. Preserve current databases and the existing actionable recovery guidance without adding schema or transaction receipt infrastructure.

Forward-port the conservative safety correction from c3c20e0 onto the current capture owner.

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vyctorbrzezowski <[email protected]>
Co-authored-by: steipete <[email protected]>
Co-authored-by: jalehman <[email protected]>

* test(update): expect Doctor-time writes to disable automatic database restore

Rebasing onto main surfaced two receipts that relied on interval-wide
attribution: the NOCOW physical replacement (#160877) and Doctor's own
schema upgrade during legacy-root relocation. Under the conservative
policy neither is attributable, so both receipts are ineligible for
automatic restoration.

---------

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vyctorbrzezowski <[email protected]>
Co-authored-by: steipete <[email protected]>
Co-authored-by: jalehman <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 1, 2026
…database writes (openclaw#160167)

* fix(update): reject unattributed database writes during Doctor

Keep the captured fingerprint baseline through Doctor settlement. Maintenance ownership does not exclude independent SQLite writers, so any observed change, including a new database, must refuse automatic restoration through the existing receipt contract. Preserve current databases and the existing actionable recovery guidance without adding schema or transaction receipt infrastructure.

Forward-port the conservative safety correction from c3c20e0 onto the current capture owner.

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vyctorbrzezowski <[email protected]>
Co-authored-by: steipete <[email protected]>
Co-authored-by: jalehman <[email protected]>

* test(update): expect Doctor-time writes to disable automatic database restore

Rebasing onto main surfaced two receipts that relied on interval-wide
attribution: the NOCOW physical replacement (openclaw#160877) and Doctor's own
schema upgrade during legacy-root relocation. Under the conservative
policy neither is attributable, so both receipts are ineligible for
automatic restoration.

---------

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vyctorbrzezowski <[email protected]>
Co-authored-by: steipete <[email protected]>
Co-authored-by: jalehman <[email protected]>
steipete added a commit that referenced this pull request Oct 12, 2026
Keep one path for channel configuration forwarding, Google thinking
preparation, status projections and rendering, and voice digest settlement.
Remove speculative catalog, transport, and lifecycle coordination while
preserving security-effect authority and ordinary durable settlement.

Best-effort tradeoffs accepted:
- Replacing the process-default AI host mid-session leaves old runtime-local
  caches for global cleanup or bounded expiry. #158901 tested replacement
  synthetically; explicit runtime owners and stream authority remain.
- A throwing synchronous custom-API registrar fails setup instead of requeuing
  a partial drain. #111669 supports initialization ordering, not recovery from
  an arbitrary throwing registrar; restart after repairing it.
- Reentrant toJSON cleanup can replace a continuation claim during serialization.
  #128848's synthetic callback is unlike provider JSON; the next turn can replay
  full history. Credential isolation and cache limits remain.
- A concurrent channel rebind may miss its activity touch. #154672's forced
  incarnation swaps no longer trigger a retry protocol; routing still rereads.
- An admitted CLI registry load may finish during shutdown. The work scope
  joins and disposes it; new command admission remains closed (#142388/#142838).
- Unsupported writers during offline NOCOW copying are no longer detected by
  a second inventory/fuser/fingerprint scan. #160877/#161501 used synthetic
  interleavings; initial exclusivity, integrity, atomic exchange, and retained
  originals still protect normal maintenance and recovery.
- Remote keyword listings changing between pages may repeat or skip entries,
  rather than reject the cursor (#163459). Request binding and limits remain.
- A missing subscription acknowledgment can leave stale observation until
  a fresh subscription or reconnect, without compensating requests. #126760
  and #159564 forced ACK loss; server authorization and acknowledged leases remain.
- A retained thinking callback may reject during plugin reload until the
  catalog refreshes or the caller retries. #162470 used forced retirement;
  the plugin instance continues to reject revoked execution.

Use the existing compiled CLI fixture for native-resource lifetime proof so
cold source transformation occurs before its unchanged runtime deadline.
No schema, dependency, protocol shape, or permission change.
steipete added a commit that referenced this pull request Oct 12, 2026
* refactor(ui): consolidate page state and refresh bookkeeping

* refactor: simplify transient plugin and client bookkeeping

Keep one path for channel configuration forwarding, Google thinking
preparation, status projections and rendering, and voice digest settlement.
Remove speculative catalog, transport, and lifecycle coordination while
preserving security-effect authority and ordinary durable settlement.

Best-effort tradeoffs accepted:
- Replacing the process-default AI host mid-session leaves old runtime-local
  caches for global cleanup or bounded expiry. #158901 tested replacement
  synthetically; explicit runtime owners and stream authority remain.
- A throwing synchronous custom-API registrar fails setup instead of requeuing
  a partial drain. #111669 supports initialization ordering, not recovery from
  an arbitrary throwing registrar; restart after repairing it.
- Reentrant toJSON cleanup can replace a continuation claim during serialization.
  #128848's synthetic callback is unlike provider JSON; the next turn can replay
  full history. Credential isolation and cache limits remain.
- A concurrent channel rebind may miss its activity touch. #154672's forced
  incarnation swaps no longer trigger a retry protocol; routing still rereads.
- An admitted CLI registry load may finish during shutdown. The work scope
  joins and disposes it; new command admission remains closed (#142388/#142838).
- Unsupported writers during offline NOCOW copying are no longer detected by
  a second inventory/fuser/fingerprint scan. #160877/#161501 used synthetic
  interleavings; initial exclusivity, integrity, atomic exchange, and retained
  originals still protect normal maintenance and recovery.
- Remote keyword listings changing between pages may repeat or skip entries,
  rather than reject the cursor (#163459). Request binding and limits remain.
- A missing subscription acknowledgment can leave stale observation until
  a fresh subscription or reconnect, without compensating requests. #126760
  and #159564 forced ACK loss; server authorization and acknowledged leases remain.
- A retained thinking callback may reject during plugin reload until the
  catalog refreshes or the caller retries. #162470 used forced retirement;
  the plugin instance continues to reject revoked execution.

Use the existing compiled CLI fixture for native-resource lifetime proof so
cold source transformation occurs before its unchanged runtime deadline.
No schema, dependency, protocol shape, or permission change.

* fix: preserve runtime cleanup error cause

Keep the existing aggregate errors and message while attaching the caught error as the standard cause. No signature or import graph changes.

* refactor(ui): finish subscription compensation cutover

* test: retire obsolete subscription recovery expectations

* fix(ui): guard legacy group import at the write boundary
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…169375)

* refactor(ui): consolidate page state and refresh bookkeeping

* refactor: simplify transient plugin and client bookkeeping

Keep one path for channel configuration forwarding, Google thinking
preparation, status projections and rendering, and voice digest settlement.
Remove speculative catalog, transport, and lifecycle coordination while
preserving security-effect authority and ordinary durable settlement.

Best-effort tradeoffs accepted:
- Replacing the process-default AI host mid-session leaves old runtime-local
  caches for global cleanup or bounded expiry. openclaw#158901 tested replacement
  synthetically; explicit runtime owners and stream authority remain.
- A throwing synchronous custom-API registrar fails setup instead of requeuing
  a partial drain. openclaw#111669 supports initialization ordering, not recovery from
  an arbitrary throwing registrar; restart after repairing it.
- Reentrant toJSON cleanup can replace a continuation claim during serialization.
  openclaw#128848's synthetic callback is unlike provider JSON; the next turn can replay
  full history. Credential isolation and cache limits remain.
- A concurrent channel rebind may miss its activity touch. openclaw#154672's forced
  incarnation swaps no longer trigger a retry protocol; routing still rereads.
- An admitted CLI registry load may finish during shutdown. The work scope
  joins and disposes it; new command admission remains closed (openclaw#142388/openclaw#142838).
- Unsupported writers during offline NOCOW copying are no longer detected by
  a second inventory/fuser/fingerprint scan. openclaw#160877/openclaw#161501 used synthetic
  interleavings; initial exclusivity, integrity, atomic exchange, and retained
  originals still protect normal maintenance and recovery.
- Remote keyword listings changing between pages may repeat or skip entries,
  rather than reject the cursor (openclaw#163459). Request binding and limits remain.
- A missing subscription acknowledgment can leave stale observation until
  a fresh subscription or reconnect, without compensating requests. openclaw#126760
  and openclaw#159564 forced ACK loss; server authorization and acknowledged leases remain.
- A retained thinking callback may reject during plugin reload until the
  catalog refreshes or the caller retries. openclaw#162470 used forced retirement;
  the plugin instance continues to reject revoked execution.

Use the existing compiled CLI fixture for native-resource lifetime proof so
cold source transformation occurs before its unchanged runtime deadline.
No schema, dependency, protocol shape, or permission change.

* fix: preserve runtime cleanup error cause

Keep the existing aggregate errors and message while attaching the caught error as the standard cause. No signature or import graph changes.

* refactor(ui): finish subscription compensation cutover

* test: retire obsolete subscription recovery expectations

* fix(ui): guard legacy group import at the write boundary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant