Repository navigation
fix(diffs): stop lightweight CLI registration from crashing when runtime.state is unavailable - #128360
Conversation
The diffs plugin has no cli-metadata.ts, so the lightweight CLI metadata loader fell back to plugin.ts and called register() with an empty runtime, crashing on api.runtime.state.openBlobStore for any non-bundled install (e.g. the published @openclaw/diffs npm package). Add a no-op cli-metadata.ts, matching every other bundled plugin's convention, so CLI metadata capture stops there instead of loading the full runtime. Fixes openclaw#128330
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 5:33 PM ET / 21:33 UTC. ClawSweeper reviewWhat this changesAdds a lightweight diffs plugin metadata entry and a regression test so CLI metadata discovery does not initialize the runtime-dependent diffs plugin. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep open: this is a focused, correct repair for the linked CLI-registration bug, and current main still lacks it. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherCLI metadata discovery loads installed plugin metadata before a Gateway runtime exists. The normal diffs plugin entry later registers blob-backed tools and viewer routes when that runtime is available. flowchart LR
A[CLI help command] --> B[Plugin discovery]
B --> C[CLI metadata entry]
C --> D[Command registry]
B --> E[Full diffs entry]
E --> F[Gateway runtime]
F --> G[Diff tools and viewer]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +13, Tests +33. Total +46 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the dedicated metadata entry and boundary-level regression test; there is no net-neutral alternative that prevents discovery from importing the runtime entry. Do we have a high-confidence way to reproduce the issue? Yes—current source shows CLI metadata loading supplies an empty runtime while the full diffs entry immediately uses runtime.state; the PR body also provides before/after command output. Is this the best way to solve the issue? Yes—the dedicated metadata entry is the established loader boundary and avoids importing or conditionally weakening the full runtime registration path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0d727c3a3bd5. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review — the contributor patch now fixes the plugin registration owner directly, removes the unused metadata shim and invalid cross-boundary test, and includes an exact-head owner regression with the built-CLI proof gap documented. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…ime.state is unavailable (openclaw#128360) * fix(diffs): stop lightweight CLI registration from crashing The diffs plugin has no cli-metadata.ts, so the lightweight CLI metadata loader fell back to plugin.ts and called register() with an empty runtime, crashing on api.runtime.state.openBlobStore for any non-bundled install (e.g. the published @openclaw/diffs npm package). Add a no-op cli-metadata.ts, matching every other bundled plugin's convention, so CLI metadata capture stops there instead of loading the full runtime. Fixes openclaw#128330 * fix(diffs): skip runtime setup while collecting CLI metadata --------- Co-authored-by: Peter Steinberger <[email protected]>
Closes #128330
AI-assisted PR: this change was written and validated by an autonomous coding agent (Claude).
What Problem This Solves
@openclaw/diffsthrows during registration in a lightweight CLI runtime becauseextensions/diffs/src/plugin.tsunconditionally callsapi.runtime.state.openBlobStore(...). When the plugin is discovered as a non-bundled (e.g. npm-installed) plugin with no dedicatedcli-metadata.tsentry, the lightweight CLI metadata loader (src/plugins/loader-cli-registry.ts) falls back to loading the fullplugin.ts/index.tsentry and callsregister(api)with an emptyruntime: {}, since CLI metadata capture never needs a live gateway runtime.plugin.tsdereferencesapi.runtime.state.openBlobStoreimmediately, before registering anything else, so the plugin fails to register and logs a confusing error even though the command itself still completes:Why This Change Was Made
The public Plugin SDK already identifies lightweight command discovery with
api.registrationMode === "cli-metadata". The diffs plugin exposes no CLI commands, so its existing registration owner should return immediately for that exact mode, before readingapi.runtime.state.openBlobStore.The corrected head implements that guard directly in
extensions/diffs/src/plugin.tsand adds its regression to the existingextensions/diffs/src/plugin.test.tsowner suite. Full, discovery, and tool-discovery registration still follow their existing paths.An earlier version introduced a no-op top-level metadata entry and a test that imported core loader internals from a plugin. Both have been removed: the owner-local guard needs no extra module, manifest entry, loader change, Plugin SDK change, or cross-boundary test.
User Impact
Users who install
@openclaw/diffsas a standalone npm plugin (its documented default install mode:openclaw.install.defaultChoice: "npm") no longer see a spurious[plugins] diffs failed during register ...error on ordinary lightweight CLI commands likeopenclaw nodes --help. No behavior changes for diffs running under the full Gateway runtime.Evidence
a5645b47281b235919b948a370f235c652b769da.createTestPluginApiwithregistrationMode: "cli-metadata"and its default empty runtime, then asserts registration does not throw and registers no tool, HTTP route, or hook.Exact-head built CLI proof gap: the contributor fork is untrusted and cannot be executed on a credential-hydrated maintainer host; no already-provisioned, approved free isolated runner is available for this task. The earlier built CLI transcript predates the rewrite and must not be treated as exact-head proof. Exact-head verification therefore relies on the owner-boundary regression, existing full-mode coverage, independent source review, and required hosted CI/build unless an exact-head hosted CLI artifact becomes available.