Skip to content

fix(matrix): preserve unrelated files when migration fails - #144883

Merged
steipete merged 1 commit into
mainfrom
codex/matrix-storage-rollback-proof-bc21739e
Sep 11, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/matrix-storage-rollback-proof-bc21739e

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #144882

What Problem This Solves

Fixes an issue where a failed Matrix sidecar migration could move an unrelated sibling file into recovery-key.json when its name matched a human-readable SQLite destination label. Retrying left the file misplaced.

Why This Change Was Made

Remove filesystem compensation over those display labels and name the remaining records as migration descriptions. Preserve the actual SQLite owners, import and archive order, canonical-value precedence, successful logs, and original error prefix/cause. Correct the stale documentation to describe the already-shipped per-file import and retry behavior.

User Impact

A failed import preserves unrelated files, committed SQLite state, actual archives, and remaining inputs for retry. No schema, transaction, retention, account, or lease behavior changes.

Evidence

A real SQLite/temp-file regression passed without the sentinel and failed on original code by moving its exact bytes into the legacy recovery filename, both before and after closed-handle retry. After the repair, all 66 tests across storage, sync-cache, recovery-key, and Doctor migration suites passed. The changed-code gate and fresh review also passed; five underlying persistence/client owners remain byte-identical.

Complete change: −17 production code lines, +100 test code lines, and unchanged documentation line count, for +83 code lines overall. This is a correctness fix, with no net-reduction claim. No live Matrix service or real credentials were used.

@clawsweeper

clawsweeper Bot commented Sep 11, 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 channel: matrix Channel integration: matrix size: S maintainer Maintainer-authored PR labels Sep 11, 2026
@steipete
steipete marked this pull request as ready for review September 11, 2026 11:33
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 7:39 AM ET / 11:39 UTC.

ClawSweeper review

What this changes

The PR removes invalid filesystem rollback during Matrix migration failures, adds preservation-and-retry regression coverage, and corrects recovery guidance.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: current main and v2026.9.4 retain the reported failure path. No introduced correctness or security defect was found.

Priority: P2
Reviewed head: ced2c4fec124dd138d5b7020ddfad64ccbe9a4d5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-preserving repair with meaningful regression coverage and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the external proof gate; its reported SQLite/temp-file regression exercises the changed startup migration owner through failure and closed-handle retry, without claiming live Matrix coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external proof gate; its reported SQLite/temp-file regression exercises the changed startup migration owner through failure and closed-handle retry, without claiming live Matrix coverage.
Evidence reviewed 8 items Verified introduced repair: The pinned merge-base-to-head diff removes rollbackLegacyMoves and changes destination records into display descriptions; import order and normal archival remain intact.
Current main still needs the fix: Fetched main still records a human-readable SQLite destination as targetPath and passes it to filesystem rollback after a later migration error.
Latest release retains the mechanism: The v2026.9.4 source contains the same display-label destination and rollback rename; the requested repair is not present in the supplied latest release.
Findings None None.
Security None None.

How this fits together

Matrix client startup imports legacy sync and recovery files into plugin-owned SQLite stores. Each store preserves committed data and archives imported files so startup can retry unfinished migration work.

flowchart TD
  A[Matrix client startup] --> B[Legacy files present]
  B --> C[Import into SQLite stores]
  C --> D[Archive imported files]
  D --> E[Continue startup]
  C --> F[Migration failure]
  D --> F
  F --> G[Preserve completed work and retry]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -18, Tests +105, Docs 0. Total +87 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 17 35 -18
Tests 1 105 0 +105
Docs 1 2 2 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 124 37 +87

Review metrics

None.

Stored data model

Persistent data-model change detected: durable storage schema: extensions/matrix/src/matrix/client/storage.ts, migration/backfill/repair: extensions/matrix/src/matrix/client/storage.ts, unknown-data-model-change: extensions/matrix/src/matrix/client/storage.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #144882
Summary: This PR is the candidate repair for the linked report's exact migration failure.

Members:

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

Technical review

Best possible solution:

Keep import and archive recovery with the existing SQLite owners, and never interpret migration display descriptions as filesystem destinations.

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

Yes: current-main source supports the reported sequence of successful recovery-key archival, later archive failure, and rollback moving a matching sibling file. The linked report records the failing regression; this review did not execute it.

Is this the best way to solve the issue?

Yes: removing the invalid compensation is the narrowest repair because it cannot undo SQLite writes or actual archives, while the existing owners already preserve canonical values for retry.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The fix prevents unrelated-file displacement under a specific legacy migration failure and filename collision.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external proof gate; its reported SQLite/temp-file regression exercises the changed startup migration owner through failure and closed-handle retry, without claiming live Matrix coverage.

Label justifications:

  • P2: The fix prevents unrelated-file displacement under a specific legacy migration failure and filename collision.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external proof gate; its reported SQLite/temp-file regression exercises the changed startup migration owner through failure and closed-handle retry, without claiming live Matrix coverage.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • shad0wca7: 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.

@steipete
steipete merged commit 76e718f into main Sep 11, 2026
215 checks passed
@steipete
steipete deleted the codex/matrix-storage-rollback-proof-bc21739e branch September 11, 2026 13:30
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 11, 2026
* commit 'f2ce199238e974b1d4caff8f11112aa51eb00d9e': (310 commits)
  refactor(copilot): deduplicate transcript user text (#144888)
  refactor(sessions): await discovery and config readiness (#144854)
  refactor(e2e): deduplicate release file assertions (#144904)
  ci: keep growing hosted test plans within the job cap (#144965)
  fix(macos): avoid stale dashboard command assertions (#144710)
  refactor(memory): await standing intent operations (#144832)
  refactor(ui): derive native device settings types from schemas (#144705)
  refactor(memory): await journal operations and allocate sequences atomically (#144824)
  refactor(tests): share command field assertions (#144955)
  refactor(matrix): share bounded context cache insertion (#144939)
  refactor(i18n): share Apple catalog reader (#144848)
  fix(doctor): preserve legacy registry files when quarantine fails (#144787)
  refactor(tests): reuse PixVerse auth fixtures (#144926)
  fix(bonjour): silence transient ENODEV socket warnings (#144870)
  fix(matrix): preserve unrelated files when migration fails (#144883)
  feat(sqlite): run Team Reports storage in owned workers (#144871)
  fix(update): install explicit same-version artifacts (#144894)
  refactor(ui): share cached message extraction (#144244)
  refactor: normalize Claude usage responses at one boundary (#144707)
  refactor: simplify CLI child listener registration (#144929)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: matrix Channel integration: matrix docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Matrix migration failure can move an unrelated sibling file

1 participant