Skip to content

fix(test): exclude browser cache dirs from copyDirIfExists in live test staging - #91908

Closed
xzh-icenter wants to merge 1 commit into
openclaw:mainfrom
xzh-icenter:fix/test-env-exclude-cache-dirs
Closed

xzh-icenter wants to merge 1 commit into
openclaw:mainfrom
xzh-icenter:fix/test-env-exclude-cache-dirs

Conversation

@xzh-icenter

Copy link
Copy Markdown
Contributor

Problem

test/test-env.ts copyDirIfExists uses fs.cpSync with { recursive: true, force: true } but no filter option. When .gemini contains a browser profile (e.g. from the Antigravity browser), the entire multi-GB cache is copied blindly into the temp test home, causing ENOSPC.

Fixes #91893

Changes

  • Add COPY_EXCLUDE_SEGMENTS set with known cache/recording directory names: Cache, Cache_Data, GPUCache, browser_recordings, antigravity-browser-profile, CacheStorage
  • Add filter callback to fs.cpSync in copyDirIfExists that skips any path containing these segments
  • Auth files like .gemini/auth.json continue to be copied normally
  • Add regression test verifying cache dirs are excluded while auth files are preserved

Real behavior proof

Behavior or issue addressed: copyDirIfExists copies multi-GB browser cache directories during live test staging, causing ENOSPC

Real environment tested: Linux (Debian 12 bookworm, WSL2), Node v24.16.0, commit abf75e1f

Exact steps or command run after this patch:

cd /root/.openclaw/workspace/openclaw-repo
node scripts/run-vitest.mjs run test/test-env.test.ts

Evidence after fix:

[test] starting test/vitest/vitest.tooling.config.ts

 RUN  v4.1.7 /root/.openclaw/workspace/openclaw-repo

 ✓ tooling test/test-env.test.ts (5 tests) 385ms

 Test Files  1 passed (1)
      Tests  5 passed (5)
   Start at  09:11:01
   Duration  3.79s (transform 5.20s, setup 4.53s, import 692ms, tests 385ms, environment 0ms)

[test] passed 1 Vitest shard in 22.94s

Observed result after fix: All 5 tests pass, including the new regression test that verifies antigravity-browser-profile, browser_recordings, and CacheStorage directories are excluded from copying while .gemini/auth.json is still copied.

What was not tested: Live ENOSPC reproduction with actual multi-GB cache directories (would require creating large temp artifacts). The fix is validated through source inspection and unit tests with small fixtures.

…st staging

 used  with no filter, blindly copying
multi-GB browser cache/profile/recording directories (e.g. from
.antigravity-browser-profile) into temp test homes, causing ENOSPC.

Add a segment-based exclusion set that skips Cache, Cache_Data,
GPUCache, browser_recordings, antigravity-browser-profile, and
CacheStorage directories while preserving auth files like .gemini/auth.json.

Fixes openclaw#91893
@openclaw-barnacle openclaw-barnacle Bot added size: S proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 10, 2026
@clawsweeper

clawsweeper Bot commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as superseded: this PR targets a valid live-test ENOSPC bug, but an open sibling PR covers the same linked issue with a narrower external-auth-only filter and stronger proof, so keeping both landing candidates open is not useful.

Canonical path: Use the scoped external-auth-only filter from #91907, or an equivalent narrow implementation, as the canonical landing path for the linked live-test ENOSPC fix.

So I’m closing this here and keeping the remaining discussion on #91907.

Review details

Best possible solution:

Use the scoped external-auth-only filter from #91907, or an equivalent narrow implementation, as the canonical landing path for the linked live-test ENOSPC fix.

Do we have a high-confidence way to reproduce the issue?

Yes from source inspection: current main stages live tests by copying .gemini through an unfiltered recursive fs.cpSync path. I did not run the large-cache ENOSPC scenario because this review is read-only and should not create or copy multi-GB artifacts.

Is this the best way to solve the issue?

No for this branch as the landing candidate: it fixes the symptom but puts the exclusion in the shared copy helper, which is broader than the reported .gemini live-auth staging problem. The narrower sibling PR is the better solution because it scopes the filter to external auth staging and proves Gemini auth/settings files still copy.

Security review:

Security review cleared: The diff only changes test staging code and its regression test; it adds no dependency, workflow, package, credential-source, or supply-chain surface, and does not broaden secret access.

AGENTS.md: found and applied where relevant.

What I checked:

  • Repository policy read: Read the full root AGENTS.md and the scoped test/AGENTS.md; the review applied the OpenClaw requirement to inspect scoped test policy, related PRs, current source, and duplicate/supersession safety before closing. (AGENTS.md:1, 1ec04c6baa99)
  • Current main still has the reported unfiltered copy path: Current main lists .gemini in LIVE_EXTERNAL_AUTH_DIRS and sends every listed external auth directory through copyDirIfExists, whose fs.cpSync call has recursive and force but no filter. (test/test-env.ts:252, 1ec04c6baa99)
  • Existing adjacent tests cover staging but not browser-cache exclusion: The live test-env test verifies isolated live HOME staging copies selected config/auth state and skips some stale .claude/.codex paths, but current main has no cache/profile/recording exclusion assertion before this PR. (test/test-env.test.ts:73, 1ec04c6baa99)
  • This PR changes the shared copy helper: The PR adds COPY_EXCLUDE_SEGMENTS and passes a filter directly inside copyDirIfExists, so all current copyDirIfExists callers inherit the cache-segment skip behavior, including .openclaw credentials and external-plugin staging. (test/test-env.ts:266, abf75e1f20f2)
  • Open sibling PR is the safer canonical landing candidate: fix(test): skip live auth browser caches #91907 is open, mergeable clean, also closes the same linked issue, and scopes the filter to LIVE_EXTERNAL_AUTH_DIRS by passing a per-call filter from the staging loop instead of changing every copyDirIfExists call. (test/test-env.ts:432, b486b4cb2b2a)
  • Related issue context supports the same root cause: The linked report at test-env.ts: copyDirIfExists copies multi-GB browser cache causing ENOSPC in live tests #91893 describes ENOSPC from recursive .gemini staging, and the existing ClawSweeper comment kept that issue open as source-reproducible with the same expected fix shape. (test/test-env.ts:410, 1ec04c6baa99)

Likely related people:

  • steipete: Remote path history for test/test-env.ts shows recent commits shaping live auth staging and live external-plugin staging, which are the exact call sites affected by this PR. (role: recent area contributor; confidence: high; commits: e29abb260660, 1851aa7944d2, ecb6779a1632; files: test/test-env.ts, test/test-env.test.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 1ec04c6baa99.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Jun 10, 2026
@clawsweeper

clawsweeper Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

  • Action: closed this PR.
  • Close reason: duplicate or superseded.
  • Evidence: durable ClawSweeper review.
  • Coverage proof: PR B clearly carries PR A's core useful intent and is the safer current review/landing candidate; PR A's broader shared-helper change is the criticized implementation detail, not independent remaining work. Covering PR: fix(test): skip live auth browser caches #91907.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test-env.ts: copyDirIfExists copies multi-GB browser cache causing ENOSPC in live tests

1 participant