Skip to content

fix(gateway): workspace sync captures retained test compiler caches - #176835

Closed
LiuwqGit wants to merge 1 commit into
openclaw:mainfrom
LiuwqGit:feat/issue-176778-workspace-cache-exclusions
Closed

LiuwqGit wants to merge 1 commit into
openclaw:mainfrom
LiuwqGit:feat/issue-176778-workspace-cache-exclusions

Conversation

@LiuwqGit

@LiuwqGit LiuwqGit commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

AI-assisted: yes

Closes #176778

What Problem This Solves

Why This Change Was Made

  • Intended outcome: Known disposable test compiler caches stay with the runtime that produced them: both roots are added to the existing exact-root derived-path inventory that workspace capture, transfer, manifest projection, and retained-result recovery all consume, so neither fresh capture nor older authenticated pending results count these files as authored work.
  • Out of scope: No producer changes (vitest-worker-cache.mts / vitest-process.mts keep writing the same roots), and no blanket exclusion of .artifacts/ or .cache/ — guest-created files under those directories, nested paths, staged inputs, and genuine source conflicts still reconcile exactly as before.
  • Highest-risk area: Over-exclusion would hide real guest work under the two roots; mitigated by exact-root prefix matching plus negative assertions that neighboring user files (.artifacts/vitest-worker-cache-notes.md, fixtures/.cache/bun-transpiler/input.txt, etc.) are still captured, transferred, and recovered.

User Impact

  • Success criteria: After tests populate both caches, capturing a managed sandbox result no longer includes cache entries; workspace refresh/review preparation is not blocked by them; recovery of an older pending result applies the same classification while preserving authored artifacts and still failing on genuine concurrent source conflicts.
  • What should reviewers focus on? src/gateway/worker-environments/workspace-path-exclusions.ts (two added roots) and the regression fixtures in workspace-generated-paths.test.ts / local-workspace-generated-paths.test-support.ts (capture/transfer plus legacy-manifest expiry/recovery proofs).

Evidence

  • Real environment tested: Isolated worktree of openclaw at commit 8a23c56a833 on Linux (EL8, Node v26.7.0), running the real manifest-capture, rsync-transfer, and projection recovery code paths (real filesystem, real git fast-import, no mocks).
  • Exact steps or commands run after this patch:
    # 1. Regression tests on the unpatched worktree first (RED):
    NODE_OPTIONS="--max-old-space-size=2048" OPENCLAW_VITEST_MAX_WORKERS=2 capped.sh \
      node scripts/run-vitest.mjs run \
      src/gateway/worker-environments/workspace-generated-paths.test.ts \
      src/gateway/worker-environments/local-workspace-projection.test.ts
    # 2. Apply the exclusion fix, then the same suites plus full validation:
    skills/fix-pr/scripts/validate.sh \
      src/gateway/worker-environments/workspace-path-exclusions.ts \
      src/gateway/worker-environments/workspace-generated-paths.test.ts \
      src/gateway/worker-environments/local-workspace-generated-paths.test-support.ts
    # 3. Directed test-type shard for the touched directory:
    OPENCLAW_TYPECHECKER=tsgo capped.sh \
      node scripts/run-tsgo.mts -b test/tsconfig/tsconfig.core.test.gateway-other.json --builders 1
  • Evidence after fix:
    workspace-generated-paths.test.ts > excludes only generated runtime roots from capture and transfer
      ✓ 363ms  (capture manifest, remote manifest, rsync transfer, size-limit assertions)
    local-workspace-projection.test.ts: Test Files 1 passed (1) — Tests 27 passed | 1 skipped (28)
    validate.sh: oxfmt ✓  oxlint ✓  vitest ✓  tsgo:core ✓ (exit 0)
    
  • Observed result after fix: Cache entries under .artifacts/vitest-worker-cache/ and .cache/bun-transpiler/ are absent from captured manifests and rsync transfers; projection expiry and legacy pending-result recovery succeed with cache churn present while neighboring authored files (-notes.md, nested fixtures/ paths) are preserved in both copies and concurrent source edits still produce a conflict.
  • Real Gateway flow after fix (follow-up proof, 2026-10-19): A real Gateway runtime (node dist/index.js gateway run, loopback qa-lab gateway child) with an in-process paired node worker host (real supervisor and workspace runtime, real git/rsync transfers) ran a managed session on a published git workspace. Between two real worker turns, the worker sandbox received the two cache roots (.artifacts/vitest-worker-cache/run-cache-0/package.json, .cache/bun-transpiler/transpiled.js) plus two authored neighbors (.artifacts/vitest-worker-cache-notes.md, guest-test-summary.txt), simulating a test run. After the second turn's capture, transfer, and reconciliation settled (workspaceResultReconciling cleared via sessions.describe), the Gateway-side managed worktree contained both authored files and neither cache root, while the worker sandbox retained both caches.
    workspace-cache-exclusion-verdict.json (repoHead ea2af47ac8a):
      status: "pass"  mode: "green-patched"
      authoredFilesPreservedInGatewayWorkspace: { cacheNotes: true, testSummary: true }
      cacheRootsInGatewayWorkspace: { vitestWorkerCache: false, bunTranspilerCache: false }
      cacheRootsRetainedOnWorker: { vitestWorkerCache: true, bunTranspilerCache: true }
    
  • Environment note for that run: this EL8 host cannot load the prebuilt native process-ownership module (@openclaw/proc-safe requires glibc >= 2.34), so the local dist build used for the run dropped the worker-native-process-owner-v1 feature advertisement and exercised the process-group ownership fallback. Workspace path classification, capture, transfer, and reconciliation ran unmodified; the logs contain no IPs, keys, or non-public endpoints.
  • Before evidence: Same suites on the unpatched worktree fail through the real production paths: Error: Cloud workspace result is too large: .artifacts/vitest-worker-cache/run-cache-0/package.json (manifest comparison) and Error: Local sandbox has unaccepted edits; restore its worktree before cleanup (projection expiry) — 4 failed / 24 passed before the two-root fix.
  • What was not tested: A live managed sandbox refresh against the reporter's historical 20,191-file pending result was not executed locally; the classification behavior is proven through the repo's own integration fixtures (real capture/recovery code paths) instead. CI lanes (full check:test-types, test-projects --changed) run on GitHub Actions.
  • Proof tier: L2
  • Proof limitations: none
  • Review state: Head rebased onto latest main (the previous check-test-types failure came from an unrelated extensions/codex test fixed on main); real-flow proof added above. Note: the same two roots (plus .artifacts/vitest-shard-timings.json) landed on main via fix: keep test compiler caches out of workspace synchronization #176802 after this PR opened, so maintainers may prefer to supersede — the regression fixtures and docs here remain applicable to that landed behavior.

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime docker Docker and sandbox tooling size: XS labels Oct 19, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

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

This PR is superseded by the merged #176802, which covers both cache roots and adds broader historical-result recovery coverage.

Root-cause cluster
Relationship: superseded
Canonical: #176802
Summary: The merged replacement addresses the same two producer-root omissions and the associated retained-result recovery problem.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Canonical path: Keep the merged shared-owner repair and its broader regressions, and close this PR as superseded.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Keep the merged shared-owner repair and its broader regressions, and close this PR as superseded.

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

The base source admits the reported compiler-cache files, but current main explicitly excludes both roots and includes capture and recovery regressions; no target code was executed during this read-only review.

Is this the best way to solve the issue?

Extending the existing exact-root inventory is the appropriate minimal repair, and the merged replacement already delivers it with additional cache-ancestor recovery handling.

Security review:

Security review cleared: The two exact-root additions introduce no concrete authorization, credential, dependency, or supply-chain concern.

AGENTS.md: found and applied where relevant.

What I checked:

  • Merged replacement: GitHub confirms the replacement is merged at 6e4883f; its body explicitly references the same reported problem at Workspace synchronization captures retained test compiler caches #176778 and names both cache roots. (6e4883fca44e)
  • Current main implements both exclusions: Current main contains .cache/bun-transpiler and .artifacts/vitest-worker-cache in the existing exact-root inventory, which also generates rsync exclusions; the fixing commit is an ancestor of fetched main. (src/gateway/worker-environments/workspace-path-exclusions.ts:17, 7bea9809d767)
  • Equivalent and broader regression coverage: Main already tests both roots through local capture, remote capture, and rsync while preserving neighboring files, nested fixtures, and staged inputs; it additionally tests cache-only ancestry and historical Git-manifest lookup. (src/gateway/worker-environments/workspace-generated-paths.test.ts:26, 7bea9809d767)
  • Historical recovery remains covered: The merged recovery fixtures retain original manifest bytes and digests, cover a missing cache-only ancestor, preserve authored work, and retain genuine-conflict and malformed-result controls. (src/gateway/worker-environments/local-workspace-generated-paths.test-support.ts:102, 7bea9809d767)
  • Contributor discussion and supplied proof: LiuwqGit supplied current-head Gateway flow output showing authored files synchronized and both caches retained only on the worker, disclosed the process-ownership fallback used by the environment, and explicitly acknowledged the merged replacement. (ea2af47ac8a5)
  • Fix provenance and release status: The fixing commit records the same issue reference and has commit time 2026-10-19T03:44:32Z; no local release tag contains it, and the latest published release predates it, so the verified fix is on main. (6e4883fca44e)

Likely related people:

  • Shakker: Raw commit 11300aa adds src/gateway/worker-environments/workspace-path-exclusions.ts:59 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 11300aa2c590; files: src/gateway/worker-environments/workspace-path-exclusions.ts)
  • Peter Steinberger: Raw commit a45cef0 adds src/gateway/worker-environments/workspace-path-exclusions.ts:15 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a45cef0d4026; files: src/gateway/worker-environments/workspace-path-exclusions.ts)

Codex review notes: model internal, reasoning medium; reviewed against 7bea9809d767; fix evidence: commit 6e4883fca44e, main fix timestamp 2026-10-19T03:44:32Z.

Exclude the retained Vitest worker cache (.artifacts/vitest-worker-cache/) and
Bun transpiler cache (.cache/bun-transpiler/) from managed workspace capture,
transfer, and pending-result recovery using the existing exact-root exclusion
policy, while neighboring guest-created files and genuine source conflicts
still reconcile.

Fixes openclaw#176778
@LiuwqGit
LiuwqGit force-pushed the feat/issue-176778-workspace-cache-exclusions branch from f7b6de6 to ea2af47 Compare October 19, 2026 04:26
@LiuwqGit

Copy link
Copy Markdown
Contributor Author

Follow-up summary (CI + requested real-behavior proof):

CI failure attribution and fix. The failed check-test-types run was the extension-test-types sub-step (extensions/codex/src/app-server/native-subagent-monitor.parent-retention.test.ts(37,5): TS2353), unrelated to this PR's files; main already carries the repair (f9da044ee30, #176834). The branch was rebased onto latest main (was 40 commits behind) and pushed — head is now ea2af47ac8a, no other changes.

Real managed-workspace flow proof. Per the review's before-merge item, I ran the patched flow through a real Gateway runtime (node dist/index.js gateway run, loopback qa-lab gateway child) with an in-process paired node worker host (real supervisor + workspace runtime) and a published git workspace:

  1. Session created as a managed worktree of the wire workspace and dispatched to the node worker; first worker turn completed and settled.
  2. Between turns the worker sandbox received .artifacts/vitest-worker-cache/run-cache-0/package.json, .cache/bun-transpiler/transpiled.js, plus authored neighbors .artifacts/vitest-worker-cache-notes.md and guest-test-summary.txt (simulating a test run populating retained caches).
  3. Second worker turn completed; after capture/transfer/reconciliation settled, the Gateway-side managed worktree contained both authored files and neither cache root, while the worker sandbox retained both caches:
{
  "status": "pass",
  "mode": "green-patched",
  "repoHead": "ea2af47ac8a5ebf02bb83da33126f11c9626ccbd",
  "authoredFilesPreservedInGatewayWorkspace": { "cacheNotes": true, "testSummary": true },
  "cacheRootsInGatewayWorkspace": { "vitestWorkerCache": false, "bunTranspilerCache": false },
  "cacheRootsRetainedOnWorker": { "vitestWorkerCache": true, "bunTranspilerCache": true }
}

This is now in the PR body's Evidence section. One environment note (also in the body): the EL8 proof host cannot load the prebuilt @openclaw/proc-safe native module (glibc 2.28 < 2.34), so the local dist build used for the run dropped the worker-native-process-owner-v1 advertisement and exercised the process-group ownership fallback; path classification, capture, transfer, and reconciliation ran unmodified, and the logs contain no IPs, keys, or non-public endpoints.

Overlap disclosure. #176802 (refs the same issue #176778) landed on main after this PR opened and excludes the same two roots plus .artifacts/vitest-shard-timings.json. Maintainers should feel free to supersede this PR if they prefer — the regression fixtures and doc alignment here remain applicable to the landed behavior either way. Not requesting a re-review.

@LiuwqGit

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The before-merge item (real behavior proof) has been addressed on the current head ea2af47ac8a: the PR body's Evidence section now includes a real managed-workspace flow through a live Gateway runtime (capture, transfer, and retained-result reconciliation with the two cache roots present), with the pass verdict recorded in the follow-up summary above. CI on this head is green apart from lanes still queued.

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper recorded closeout evidence for this proposed close.

  • Action: close remains subject to final live verification.
  • Close reason: duplicate or superseded.
    Review evidence: durable ClawSweeper review.
  • Coverage proof: The source report records concrete verification that merged PR B implements both exclusions and equivalent or broader recovery coverage on main. It identifies no remaining material behavior, proof, or review work requiring PR A; documentation differences are incidental. Covering PR: fix: keep test compiler caches out of workspace synchronization #176802.

@clawsweeper clawsweeper Bot closed this Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Docker and sandbox tooling docs Improvements or additions to documentation gateway Gateway runtime proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workspace synchronization captures retained test compiler caches

1 participant