fix(tests): pin plugin temp-dir assertions to resolvePreferredOpenClawTmpDir() (#101876)#101884
fix(tests): pin plugin temp-dir assertions to resolvePreferredOpenClawTmpDir() (#101876)#101884SymbolStar wants to merge 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 7, 2026, 5:42 PM ET / 21:42 UTC. Summary PR surface: Tests +3. Total +3 across 1 file. Reproducibility: yes. source-reproducible: current main’s test asserts 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. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow test-only assertion fix for the git-install temp-root case, then track the two other failures from the linked report separately. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main’s test asserts Is this the best way to solve the issue? Yes. Matching the assertion to the production resolver is the narrowest maintainable test-only fix; changing runtime temp-root selection or hardcoding a host-specific path would be the wrong layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 91a0ebbce63f. Label changesLabel justifications:
Evidence reviewedPR surface: Tests +3. Total +3 across 1 file. 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)
|
|
This is already fixed on That canonical fix contains the same |
Refs #101876
Scope
The issue lumps three separate test failures together, but only one of them is actually the
os.tmpdir()assertion mismatch described in the title. This PR fixes that one. The other two failures have unrelated root causes (details below) and I recommend splitting them into their own issues.What this PR fixes
src/plugins/git-install.test.ts > installPluginFromGitSpec > falls back to OS temp when target workspace creation failshard-codedos.tmpdir()in its assertion:withTempDir(src/infra/install-source-utils.ts) actually defaults its root toresolvePreferredOpenClawTmpDir()(src/infra/tmp-openclaw-dir.ts), which on POSIX prefers/tmp/openclawwhenever ownership/permissions are safe and only falls back toos.tmpdir()when unsafe. The assertion therefore only holds on hosts where/tmp/openclawresolves unsafe, i.e. it encodes the environment rather than the contract.Fix: pin the assertion (and add the import) to the same resolver the production code uses:
Verification
Repro'd the original failure on macOS with
/tmp/openclawpresent, applied the fix, all 23 tests pass.What this PR does NOT fix (please split into separate issues)
Both of these fail on the same host but are not
os.tmpdir()assertion errors — they surface only because vitest keeps running past the git-install failure:1.
src/plugins/manifest-model-id-normalization.test.ts > manifest model id normalization > reuses manifest metadata while file fingerprints are unchangedRoot cause: the test seeds a per-test
OPENCLAW_STATE_DIRand disables bundled plugins, butlistOpenClawPluginManifestMetadataalso callslistSourceCheckoutPluginDirs, which usesimport.meta.url/process.argv[1]to find the OpenClaw package root and enumerates every child of itsextensions/dir (140 on a source checkout). Nothing to do with/tmp/openclaw. Fix would need to either mockresolvePackageRootsForSourceManifestMetadata(or the fs ofopenclaw-root) or add an env/option to opt out of source-checkout scanning during tests.2.
src/plugins/tools.optional.test.ts > resolvePluginTools optional tools > reloads when gateway binding would otherwise reuse a default-mode active registry(line 2863)Root cause: the test's mock registry is
{ plugins: [], tools: [], diagnostics: [] }— the retirement/cleanup path inruntime.tsreadssessionExtensions.length,runtimeLifecycles.length, etc. without null-guarding. Either the test should provide those arrays, or the production predicate should tolerate missing fields (arguably both). Also nothing to do with/tmp/openclaw.Suggestion
Once this PR lands, please close the
os.tmpdirpart of #101876 and open two separate issues for the two failures above so they can be triaged independently.