Repository navigation
fix(plugins): hash loader cache keys so plugin config never leaks into diagnostics - #117237
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 1:38 AM ET / 05:38 UTC. ClawSweeper reviewWhat this changesThe PR hashes plugin-loader cache identities so configuration values are no longer emitted in reentry errors or plugin status diagnostics. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain The proposed SHA-256 identity preserves equality-based cache matching while removing direct configuration text from the reentry diagnostic path. The patch appears correct, but this protected Priority: P1 Review scores
Verification
How this fits togetherThe plugin loader combines normalized configuration, discovery state, and activation options into a cache identity used to reuse registries and detect recursive loads. Registry failures are recorded on plugin entries and displayed by diagnostics and status callers. flowchart LR
A[Plugin configuration] --> B[Plugin loader]
C[Discovery and install state] --> B
B --> D[Cache identity]
D --> E[Cache and reentry guard]
E --> F[Plugin registry]
F --> G[Status diagnostics]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +8. Total +8 across 2 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the full cache-identity inputs but expose only a deterministic SHA-256 digest, then attach a redacted real loader/status run showing a configured sentinel is absent from the emitted diagnostic. Do we have a high-confidence way to reproduce the issue? Yes. Source establishes a focused path: configure a plugin entry with a sentinel value, trigger same-key loader reentry, and inspect the registry error/status output; the PR adds that fixture, but this read-only review did not run it. Is this the best way to solve the issue? Yes. A deterministic digest preserves the existing equality contract while removing configuration bytes from all cache-key consumers, which is safer than retaining a path-specific partial-redaction helper. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0892684551fd. LabelsLabel changes:
Label 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
|
Runtime proof: reentry diagnostic emits digest only (redacted transcript)Real-behavior proof per review: the built dist loader from this PR ( Terminal transcript (paths shortened): The emitted diagnostic — the exact surface that previously interpolated serialized plugin config — now carries only the 64-char SHA-256 digest. The sentinel appears nowhere in the plugin record error nor anywhere in the full serialized registry. Additional live-runtime evidence from the same integration build: ephemeral gateway (isolated state dir, loopback, port 39179) boots clean through the hashed-key loader — 3 plugins loaded in 1.0s, 🤖 Generated with Claude Code |
|
Merged via squash.
|
What Problem This Solves
Plugin-registry cache keys embed the full JSON-serialized normalized plugins config — including arbitrary per-plugin
entries[<id>].configvalues — viabuildCacheKeyinsrc/plugins/loader-load-context.ts. That key is interpolated verbatim intoPluginLoadReentryError("plugin load reentry detected for cache key: …"), which lands inregistry.plugins[].errorand is therefore reachable from plugin status/diagnostics output. Anything an operator put in plugin config (tokens, URLs, internal names) could surface in diagnostics.A partial redaction helper existed but only applied on the
resolveRawConfigEnvVarspath — every other load path serialized config into the key unredacted.Why This Change Was Made
The key's only consumers compare it for equality (cache lookup, active-registry compatibility matching re-derives keys through the same builder). Nothing parses its structure. So the complete cache identity is now SHA-256 hashed: identical inputs produce identical keys, and no configuration bytes can appear in any key, error message, or status output. The now-redundant partial redaction helper is deleted rather than kept "just in case" — hashing supersedes it, and the raw-env path it guarded already had registry caching disabled.
User Impact
Plugin configuration values can no longer leak into error messages, logs, or
openclaw pluginsstatus output via loader cache keys. No behavior change to caching: hit/miss semantics are identical for identical inputs.Evidence
node scripts/run-vitest.mjs src/plugins/loader.test.ts— 179/179 pass (verified independently by reviewer session); full loader family run by implementation session: 8 files, 221 tests.hunter2-sentinel) is asserted absent from the cache key, the reentry error message, and the plugin status error; the key is asserted to be a 64-char hex digest; the reentry assertion upgraded from substring to exact-message equality.🤖 Generated with Claude Code
Runtime proof (added post-review)
Redacted terminal transcript triggering the real reentry path through the built dist loader, with a sentinel in plugin config: the emitted
PluginLoadReentryErrorandregistry.plugins[].errorcontain only the 64-char SHA-256 digest; the sentinel is absent from the error and from the entire serialized registry. Full transcript: #117237 (comment)Live gateway on an integration build including this change: 3 plugins load in 1.0s,
/readyzreports ready, clean 44ms shutdown — no caching behavior change.