fix: replace os.tmpdir() with resolvePreferredOpenClawTmpDir() across codebase#63902
fix: replace os.tmpdir() with resolvePreferredOpenClawTmpDir() across codebase#63902corbin-breton wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Greptile SummaryMechanical replacement of 14 Confidence Score: 5/5Safe to merge — mechanical substitution with no behavior change; all guarded call sites replaced correctly. All 14 flagged call sites are replaced correctly. Retained extensions/qqbot/src/utils/platform.ts — JSDoc comment on getHomeDir() still references os.tmpdir() after the replacement.
|
ba67f6c to
572d0d4
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 572d0d4fc4
ℹ️ 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".
| import path from "node:path"; | ||
| import { GoogleGenAI } from "@google/genai"; | ||
| import { isProviderApiKeyConfigured } from "openclaw/plugin-sdk/provider-auth"; | ||
| import { resolveApiKeyForProvider } from "openclaw/plugin-sdk/provider-auth-runtime"; | ||
| import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/sandbox"; |
There was a problem hiding this comment.
Use lightweight temp-path SDK import
Importing resolvePreferredOpenClawTmpDir from openclaw/plugin-sdk/sandbox pulls in the full sandbox barrel, which re-exports src/agents/sandbox.ts and triggers backend registration side effects (registerSandboxBackend(...) in src/agents/sandbox/backend.ts) at module load. In provider/plugin modules that only need a temp-directory helper, this adds unnecessary startup work and global sandbox initialization on every load path (even when sandboxing is never used). Switching this helper import to openclaw/plugin-sdk/temp-path avoids that regression while preserving behavior.
Useful? React with 👍 / 👎.
572d0d4 to
3029475
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3029475658
ℹ️ 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".
| @@ -15,6 +14,7 @@ import { | |||
| type OpenClawConfig, | |||
| } from "openclaw/plugin-sdk/config-runtime"; | |||
| import { definePluginEntry, type OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-entry"; | |||
| import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/sandbox"; | |||
There was a problem hiding this comment.
Import temp-dir helper from temp-path instead of sandbox
resolvePreferredOpenClawTmpDir is imported from openclaw/plugin-sdk/sandbox, which eagerly re-exports src/agents/sandbox.ts; that path loads src/agents/sandbox/backend.ts and runs registerSandboxBackend(...) at module initialization. In this plugin, that means normal startup now pulls sandbox backend registration side effects even when no sandbox feature is used, adding avoidable global initialization and startup cost. Use openclaw/plugin-sdk/temp-path (or a local temp-path wrapper) for this helper-only use case.
Useful? React with 👍 / 👎.
|
CI on main is currently broken by two test regressions in |
… codebase Replace all 14 os.tmpdir() calls flagged by the no-random-messaging guard with resolvePreferredOpenClawTmpDir() from the plugin SDK. This ensures temp directories are created under OpenClaw's preferred location (/tmp/openclaw) rather than the host system default, which prevents cross-session data leakage and improves sandboxing. Files changed: - src/infra/outbound/delivery-queue.test-helpers.ts - extensions/browser/src/browser/chrome-mcp.ts - extensions/diffs/src/test-helpers.ts - extensions/google/video-generation-provider.ts - extensions/memory-core/src/cli.runtime.ts (2 sites) - extensions/memory-core/src/test-helpers.ts - extensions/memory-wiki/src/test-helpers.ts - extensions/openshell/src/backend.ts - extensions/qa-lab/src/gateway-child.ts - extensions/qa-lab/src/model-catalog.runtime.ts - extensions/qqbot/src/utils/platform.ts (2 sites) - extensions/signal/src/install-signal-cli.ts Also fixes CliBackendConfig type mismatch in followup-runner test. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3029475 to
02e8cfa
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 02e8cfafcf
ℹ️ 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".
| import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/sandbox"; | ||
| import { CONFIG_DIR, extractArchive, resolveBrewExecutable } from "openclaw/plugin-sdk/setup-tools"; | ||
| import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path"; |
There was a problem hiding this comment.
Remove duplicate temp-dir import binding
This change introduces a second resolvePreferredOpenClawTmpDir import while the existing temp-path import is still present, which creates a duplicate top-level binding and makes the module fail to parse (Identifier 'resolvePreferredOpenClawTmpDir' has already been declared). Any command path that loads this Signal installer file will fail at startup/build time until one import is removed or aliased.
Useful? React with 👍 / 👎.
|
Closing — all changes in this PR have already been merged to main via other PRs. The rebase confirmed no remaining diff. |
Summary
Replace all 14
os.tmpdir()calls flagged by theno-random-messagingguard withresolvePreferredOpenClawTmpDir()from the plugin SDK.Problem
The
check-additionalCI job fails onlint:tmp:no-random-messagingfor all PRs (including main itself) because 14 files useos.tmpdir()directly instead of the OpenClaw temp dir helper.Fix
Mechanical replacement:
os.tmpdir()→resolvePreferredOpenClawTmpDir()using the appropriate import path:src/files: relative import from../../infra/tmp-openclaw-dir.jsextensions/files:import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/sandbox"Unused
osimports removed wheretmpdirwas the only usage.Files Changed (13 files, 14 call sites)
src/infra/outbound/delivery-queue.test-helpers.tsextensions/browser/src/browser/chrome-mcp.tsextensions/diffs/src/test-helpers.tsextensions/google/video-generation-provider.tsextensions/memory-core/src/cli.runtime.tsextensions/memory-core/src/test-helpers.tsextensions/memory-wiki/src/test-helpers.tsextensions/openshell/src/backend.tsextensions/qa-lab/src/gateway-child.tsextensions/qa-lab/src/model-catalog.runtime.tsextensions/qqbot/src/utils/platform.tsextensions/signal/src/install-signal-cli.tssrc/auto-reply/reply/followup-runner.test.tsTest plan
pnpm run lint:tmp:no-random-messagingpasses (0 violations)pnpm tsgopasses (0 type errors)pnpm checkpasses🤖 Generated with Claude Code