Skip to content

refactor(diffs): move ephemeral artifacts to SQLite - #109328

Merged
steipete merged 12 commits into
mainfrom
codex/sqlite-diffs-viewer-blobs
Jul 16, 2026
Merged

steipete merged 12 commits into
mainfrom
codex/sqlite-diffs-viewer-blobs

Conversation

@steipete

@steipete steipete commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Diffs viewer HTML, access metadata, and rendered-file TTL metadata still used JSON/HTML temp sidecars even though OpenClaw-owned runtime state is SQLite-first. Those files split authorization and payload reads, escaped shared storage limits, and made backup/privacy handling inconsistent.

Why This Change Was Made

Adds a bounded trusted-plugin BLOB store on the shared SQLite database, then moves Diffs viewer artifacts onto it. Viewer HTML is gzip-compressed, only the bearer token hash is persisted, and authorization plus payload retrieval use one row snapshot. PNG/PDF outputs remain named temporary artifacts because channel delivery needs a file path, while their lifecycle metadata moves to SQLite. The privileged runtime stays limited to bundled and catalog-backed official plugins; local npm-pack and linked-path installs cannot inherit official trust from a matching package name. Completed installs replace stale provenance, so a later registry reinstall can regain official trust without weakening that fail-closed boundary.

Legacy Diffs JSON/HTML caches are intentionally discarded rather than imported because they are ephemeral (30-minute default, 6-hour maximum). TTL BLOB rows are excluded from restorable backups; durable no-TTL plugin BLOBs remain restorable.

User Impact

Diffs view, file, and both modes retain their existing output contract without writing meta.json, file-meta.json, or viewer.html. Old ephemeral viewer URLs do not survive the upgrade. Expired viewer bytes are reclaimed on access or owner cleanup, and rendered files are deleted from owner-claimed expiry metadata.

Evidence

  • Focused tests: 870 passed, 1 skipped across plugin BLOB state, plugin trust, Diffs, backup/snapshot, and database-first guard shards.
  • Full Diffs shard: 13 files, 142 tests passed.
  • Current exact-head focused matrix after the latest-main merge: 181 tests passed across plugin BLOB state, Diffs store/tool behavior, install-record transitions, and plugin trust.
  • Kysely, SQLite transaction-boundary, generated-type, database-first, formatting, and diff checks passed.
  • Plugin SDK API baseline and the 8,001-symbol public surface cap passed.
  • Independent focused code audits plus final whole-branch Codex autoreview found no remaining actionable defects; the final review was clean at 0.84 confidence.
  • Blacksmith Testbox built the dirty checkout and loaded checkout-bundled Diffs with toolNames=["diffs"] and one HTTP route. The real mode=both agent scenario reached model dispatch, then stopped at the credential boundary because the isolated box had no provider API key.
  • Exact-head hosted CI: https://github.com/openclaw/openclaw/actions/runs/29542655254

AI-assisted: yes. I reviewed the implementation and validation results. No session transcript is attached.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: voice-call Channel integration: voice-call scripts Repository scripts plugin: file-transfer extensions: diffs size: XL maintainer Maintainer-authored PR labels Jul 16, 2026
@steipete
steipete marked this pull request as draft July 16, 2026 20:24
@steipete steipete self-assigned this Jul 16, 2026
@steipete
steipete marked this pull request as ready for review July 16, 2026 20:46

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a4c702cb8a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread extensions/diffs/src/store.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 77b396277f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/plugins/manifest-registry.ts Resolved
@steipete
steipete merged commit 334c182 into main Jul 16, 2026
121 of 126 checks passed
@steipete
steipete deleted the codex/sqlite-diffs-viewer-blobs branch July 16, 2026 23:47

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 349bce6307

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 865 to +867
installRecord.source === "npm" &&
installRecord.artifactKind === undefined &&
installRecord.sourcePath === undefined &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Migrate stale install provenance before rejecting trust

For users who already reinstalled an official plugin from a registry after a local npm-pack/path install under the previous merge-on-write recordPluginInstall, the persisted record can still contain sourcePath/artifactKind even though installPath, spec, and resolvedName now point at the registry package. Fresh evidence beyond the earlier fix: recordPluginInstall only replaces future writes, while the registry load path reads existing plugins.installs unchanged, so this new gate keeps trustedOfficialInstall false on upgrade and external official Diffs throws when it opens openBlobStore; add a doctor/load migration or normalize stale local-artifact fields before this trust check.

Useful? React with 👍 / 👎.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 17, 2026
* refactor(diffs): move ephemeral artifacts to SQLite

* fix(plugin-state): satisfy SDK validation gates

* test(diffs): satisfy lint contracts

* fix(plugin-state): count expired blobs toward quotas

* fix(plugin-state): harden blob storage boundaries

* fix(plugins): replace stale install provenance
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
* refactor(diffs): move ephemeral artifacts to SQLite

* fix(plugin-state): satisfy SDK validation gates

* test(diffs): satisfy lint contracts

* fix(plugin-state): count expired blobs toward quotas

* fix(plugin-state): harden blob storage boundaries

* fix(plugins): replace stale install provenance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: voice-call Channel integration: voice-call docs Improvements or additions to documentation extensions: diffs maintainer Maintainer-authored PR plugin: file-transfer scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant