fix: plugin tests fail on hosts with a usable /tmp/openclaw or a source checkout#101896
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 7, 2026, 6:47 PM ET / 22:47 UTC. Summary PR surface: Tests +7. Total +7 across 3 files. Reproducibility: yes. source-reproducible: current main contains the stale os.tmpdir assertion, source-checkout one-record manifest assertion, and partial registry fixture while current production code supports the PR's expected contracts. I did not execute Vitest in this read-only review, but the PR body includes before/after terminal output. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land this broader test-only fix after maintainer review and refreshed exact-head CI, then use it as the canonical fix for #101876 and supersede the narrower overlapping #101884 if maintainers prefer this branch. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main contains the stale os.tmpdir assertion, source-checkout one-record manifest assertion, and partial registry fixture while current production code supports the PR's expected contracts. I did not execute Vitest in this read-only review, but the PR body includes before/after terminal output. Is this the best way to solve the issue? Yes. Updating only the tests to match current production contracts is the narrowest maintainable solution; changing temp-root selection, disabling source-checkout scanning, or weakening the initialized-registry invariant would be the wrong layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9dbb1ed3d246. Label changesLabel justifications:
Evidence reviewedPR surface: Tests +7. Total +7 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
Review history (1 earlier review cycle)
|
|
Merged via squash.
|
Closes #101876
What Problem This Solves
Fixes an issue where three plugin test cases fail on any POSIX host with a normal
/tmp/openclawstate or a source checkout (developer laptops, warm CI boxes), blocking green local runs of the plugins shard:src/plugins/git-install.test.ts > falls back to OS temp when target workspace creation failssrc/plugins/manifest-model-id-normalization.test.ts > reuses manifest metadata while file fingerprints are unchangedsrc/plugins/tools.optional.test.ts > reloads when gateway binding would otherwise reuse a default-mode active registryWhy This Change Was Made
The three failures have three distinct causes — recent prod changes landed with stale test expectations; this PR updates only the tests to the current prod contracts (no prod behavior changes):
withTempDirroot fallback staging atresolvePreferredOpenClawTmpDir()(prefers/tmp/openclaw, degrades to a uid-scopedos.tmpdir()path when unsafe), but the test still asserted bareos.tmpdir(). The test now recomputes the resolver output, so the assertion holds in every resolver state.listOpenClawPluginManifestMetadatalegitimately lists all repoextensions/manifests when tests run from a checkout (140 records, not 1). The test now pins exactly one record for the plugin under test and keeps the fingerprint-reuse assertion (manifest file read exactly once across two scans).registryHasPluginHostCleanupWorkno longer optional-chains), and updated most test registries but missed this hand-rolled{plugins, tools, diagnostics} as neverfake, which crashes when retired. The test now usescreateEmptyPluginRegistry(), which also drops theas nevercast.Note: the issue attributes all three failures to the temp-root mechanism; investigation showed only the git-install test is temp-root-coupled. The other two are stale expectations from the July 6–7 prod changes above.
User Impact
No user-visible behavior change. Developers and CI hosts get deterministic plugin-shard test results regardless of
/tmp/openclawstate (present, absent, or unsafe) and regardless of running from a source checkout.Evidence
node scripts/run-vitest.mjs src/plugins/git-install.test.ts src/plugins/manifest-model-id-normalization.test.ts src/plugins/tools.optional.test.ts(macOS, worktree of e7365d4):Tests 3 failed | 95 passed (98)— reproducing the issue exactly./tmp/openclawpresent and safe:Tests 98 passed (98)./tmp/openclawabsent (resolver creates it):Tests 98 passed (98)./tmp/openclawunsafe (symlink → uid-scopedos.tmpdir()fallback):git-install.test.ts 23 passed (23)(the only resolver-coupled file).node scripts/run-vitest.mjs src/plugins): pass (see CI for the hosted run).oxfmt --checkandscripts/run-oxlint.mjsclean on the three changed files.