Skip to content

fix(matrix): warn on accumulated token storage roots#97353

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
outdog-hwh:codex/matrix-storage-sibling-observability-76613
Jun 28, 2026
Merged

fix(matrix): warn on accumulated token storage roots#97353
vincentkoc merged 1 commit into
openclaw:mainfrom
outdog-hwh:codex/matrix-storage-sibling-observability-76613

Conversation

@outdog-hwh

Copy link
Copy Markdown
Contributor

Closes #76613

What Problem This Solves

Matrix token rotation can leave multiple populated token-hash storage roots under the same account directory. Current storage-root resolution can still choose the correct active root, but operators get no signal that stale compatible roots have accumulated, which makes crypto-store debugging and cleanup harder.

The previous candidate PR #94644 was closed unmerged after review because it warned for a single legitimate reusable token-rotation sibling and did not expose parseable warning metadata or docs guidance.

Why This Change Was Made

This change keeps Matrix storage selection semantics unchanged and adds observability only when true multi-root accumulation exists: more than one compatible populated token-hash root is present. The warning includes structured metadata for parentDir, canonicalTokenHash, selectedTokenHash, populated root hashes, sibling hashes, and count.

It also documents the operational distinction between one normal older token-hash root and multiple populated roots that should be inspected and archived carefully.

AI-assisted: prepared with Codex and verified locally.

User Impact

Matrix operators get a clear warning when stale populated storage roots accumulate after token rotations, without being told to clean up the normal single-root continuity case. The warning is machine-parseable and the docs explain safe manual cleanup.

Evidence

  • node scripts/run-vitest.mjs extensions/matrix/src/matrix/client/storage.test.ts
  • node_modules\.bin\oxfmt.cmd --check --threads=1 extensions/matrix/src/matrix/client/storage.ts extensions/matrix/src/matrix/client/storage.test.ts docs/channels/matrix.md
  • git diff --check
  • node scripts/run-oxlint.mjs extensions/matrix/src/matrix/client/storage.ts extensions/matrix/src/matrix/client/storage.test.ts
  • Redacted emitted-warning diagnostic via node_modules\.bin\tsx.cmd --input-type=module -:
{
  "resolvedTokenHash": "348e9df2a42bd6e3",
  "warningCount": 1,
  "warnings": [
    {
      "message": "matrix: multiple populated token-hash storage roots detected",
      "meta": {
        "parentDir": "<stateDir>/matrix/accounts/default/matrix.example.org__bot_example.org",
        "canonicalTokenHash": "348e9df2a42bd6e3",
        "selectedTokenHash": "348e9df2a42bd6e3",
        "populatedTokenHashes": [
          "348e9df2a42bd6e3",
          "9bdf10a691a1cfda"
        ],
        "populatedSiblingTokenHashes": [
          "9bdf10a691a1cfda"
        ],
        "populatedRootCount": 2
      }
    }
  ]
}

Attempted pnpm docs:list, but this Codex checkout triggered a pnpm install/module purge prompt and failed in non-interactive mode with ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY; the relevant Matrix docs section was read directly.

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: matrix Channel integration: matrix size: S labels Jun 28, 2026
@clawsweeper

clawsweeper Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 27, 2026, 11:37 PM ET / 03:37 UTC.

Summary
Adds a Matrix storage warning with structured metadata when multiple compatible populated token-hash storage roots are present, extends storage tests, and documents manual cleanup guidance.

PR surface: Source +28, Tests +54, Docs +2. Total +84 across 3 files.

Reproducibility: yes. Source inspection shows current main scans/selects Matrix token-hash storage roots without an accumulated-root warning, and the PR body includes redacted after-fix warning output.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: durable storage schema: extensions/matrix/src/matrix/client/storage.test.ts, durable storage schema: extensions/matrix/src/matrix/client/storage.ts, unknown-data-model-change: extensions/matrix/src/matrix/client/storage.test.ts, unknown-data-model-change: extensions/matrix/src/matrix/client/storage.ts, vector/embedding metadata: extensions/matrix/src/matrix/client/storage.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #76613
Summary: This PR is the current candidate implementation for the open Matrix token-hash sibling observability request; the earlier candidate PR is closed and superseded as context only.

Members:

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

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Next step before merge

  • No ClawSweeper repair job is needed; the remaining action is normal maintainer review and required-check gating for an already-focused PR.

Security
Cleared: The diff touches Matrix storage logging, tests, and docs only; no dependency, workflow, lockfile, secret, or code-execution surface concern was found.

Review details

Best possible solution:

Land this focused Matrix plugin warning after maintainer review and required checks, leaving automatic cleanup, doctor commands, and strict failure modes to separate follow-ups.

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

Yes. Source inspection shows current main scans/selects Matrix token-hash storage roots without an accumulated-root warning, and the PR body includes redacted after-fix warning output.

Is this the best way to solve the issue?

Yes. A Matrix-plugin-local structured warning plus docs preserves storage selection semantics and is narrower than automatic archiving, a new doctor command, or fail-closed behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 830467bc9306.

Label changes

Label justifications:

  • P3: This is low-risk Matrix operator observability and docs hardening rather than an urgent runtime regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes redacted after-fix live output showing one emitted warning with structured metadata for the changed storage-root path.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes redacted after-fix live output showing one emitted warning with structured metadata for the changed storage-root path.
Evidence reviewed

PR surface:

Source +28, Tests +54, Docs +2. Total +84 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 55 27 +28
Tests 1 60 6 +54
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 117 33 +84

What I checked:

Likely related people:

  • gumadeiras: Matrix plugin rebuild and startup auth hardening history introduced and substantially shaped the Matrix storage, crypto restore, and docs surfaces involved here. (role: feature-history contributor; confidence: high; commits: 94693f7ff036, 8d88c27f19e4, 106a40426f55; files: extensions/matrix/src/matrix/client/storage.ts, extensions/matrix/src/matrix/client/storage.test.ts, extensions/matrix/src/matrix/monitor/legacy-crypto-restore.ts)
  • steipete: History shows repeated Matrix docs/test/storage-adjacent work, including the shared Matrix state file path helper used by callers of the storage resolver. (role: recent adjacent contributor; confidence: medium; commits: 4890656d9d1d, b9d5c1a58b8b, 725a6b71dc6a; files: extensions/matrix/src/matrix/client/storage.ts, extensions/matrix/src/matrix/client/storage.test.ts, docs/channels/matrix.md)
  • vincentkoc: Recent Matrix docs/test cleanup and import-churn work touched the same Matrix channel docs and storage test area, making this a useful routing signal for review. (role: recent docs and test contributor; confidence: medium; commits: 4cfebae118b9, 5c9408d3ca25, dfc124c7726b; files: extensions/matrix/src/matrix/client/storage.test.ts, docs/channels/matrix.md)
  • joshavant: Local blame attributes the current checkout copy of the storage resolver and adjacent tests to a recent bulk file-add commit, though the broader feature history points to earlier Matrix contributors. (role: current checkout line provenance; confidence: low; commits: 898ca9741cba; files: extensions/matrix/src/matrix/client/storage.ts, extensions/matrix/src/matrix/client/storage.test.ts, docs/channels/matrix.md)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jun 28, 2026
@outdog-hwh

Copy link
Copy Markdown
Contributor Author

CI note: checks-node-compact-small-7 failed on an unrelated gateway startup shard timeout:

  • Failed test in CI: src/gateway/server-startup-session-migration.test.ts > runStartupSessionMigration > discovers plugin-owned agents during direct gateway startup
  • CI failure mode: test timeout after 120000ms in test/vitest/vitest.gateway-server.config.ts
  • This PR only changes Matrix storage warning logic, Matrix storage tests, and Matrix docs.
  • Local targeted rerun on this branch passed: node scripts/run-vitest.mjs src/gateway/server-startup-session-migration.test.ts -> 2 files passed, 10 tests passed.

I tried to rerun failed jobs, but GitHub rejected it because this account does not have repository admin rights. Could a maintainer rerun the failed job when convenient?

@vincentkoc
vincentkoc merged commit f420157 into openclaw:main Jun 28, 2026
187 of 197 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 29, 2026
@outdog-hwh
outdog-hwh deleted the codex/matrix-storage-sibling-observability-76613 branch June 29, 2026 08:57
QiuYuang pushed a commit to QiuYuang/openclaw that referenced this pull request Jul 1, 2026
chenyangjun-xy pushed a commit to chenyangjun-xy/openclaw that referenced this pull request Jul 1, 2026
chenyangjun-xy pushed a commit to chenyangjun-xy/openclaw that referenced this pull request Jul 3, 2026
Rorqualx pushed a commit to Rorqualx/cortex that referenced this pull request Jul 4, 2026
Rorqualx pushed a commit to Rorqualx/cortex that referenced this pull request Jul 8, 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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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.

Matrix crypto-store: observability for accumulated populated token-hash sibling dirs (discussion)

2 participants