Skip to content

fix: keep test compiler caches out of workspace synchronization - #176802

Merged
shakkernerd merged 2 commits into
mainfrom
guest-cache-sync
Oct 19, 2026
Merged

shakkernerd merged 2 commits into
mainfrom
guest-cache-sync

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Refs #176778.

What Problem This Solves

Ordinary tests can leave disposable compiler caches in a managed workspace's pending changes. If the host later removes a cache directory that an older result still records, synchronization treats its changed descendants as conflicting work. Review and refresh can then remain blocked even when the actual source edits already agree.

The missing paths are .artifacts/vitest-worker-cache/, .cache/bun-transpiler/, and the generated .artifacts/vitest-shard-timings.json scheduler data. Existing exclusions cover other test caches but not these current producer outputs.

User Impact

These test caches stay with the runtime that created them instead of becoming authored workspace results. The existing recovery path also recognizes them in older authenticated results, allowing the preserved source work to settle normally.

Source edits, ignored reports and logs, nested fixtures, explicitly staged inputs, genuine source conflicts, and invalid-result rejection remain protected. The change does not exclude all ignored files or general .artifacts, .cache, or dist contents.

Why This Change Was Made

Capture, transfer, manifest comparison, staged-result validation and recovery already use one shared classification rule. The rule now covers the three verified producer paths. Historical manifest projection and remote non-Git capture also omit parent directories whose contents are entirely excluded caches, while retaining genuine empty directories. This keeps the existing capture paths consistent without relocating caches or adding another synchronization mechanism.

The recovery regression retains the original manifest bytes and digest, with the cache-only parent absent from the host. Raw manifest validation and authentication still happen before projection; actual obstructions continue to conflict. A producer check calls the existing worker-cache retention, test-process environment and shard-timing writers, then captures their output through the workspace owner. That connects the exclusion to the paths the tools actually select.

Evidence

On the original production source, authenticated pending-result settlement returns the preserved-workspace conflict, and cache-only expiry fails as unaccepted work. The corrected source passes those same recovery paths, including the case where source changes were already copied, while keeping independent source-conflict and malformed-tree controls.

Remote Linux validation passed:

  • Original production source rejects the cache-bearing pending result. The final source admits the source edit and report with their old cache-only parent absent; a real parent-file obstruction still conflicts.
  • Cache-only remote capture now reports no change in both non-Git and historical Git cases. Remote canonical lookup resolves the same logical manifest as the host, without rewriting the original bytes.
  • The final nine-file owner batch passed 48 tests in 45.97 seconds of native test-runner wall time. It covers manifest parsing, capture, lookup, Git transfer, hash memoization, limits and the actual cache producers.
  • Broader consumer coverage passed across local projection, transfer, materialization, repository ownership and node clients. Its final 33-file batch passed 388 tests with three explicit platform/opt-in skips; the required existing E2E build took 5m02s, and the test stage including preparation took 641.97 seconds. All three destination-authority cases passed. These unchanged paths were not rerun merely for the final shared-function move.
  • Changed-file formatting/lint and all 38 selected compiler graphs passed. Tests preserve ignored reports, explicit staged inputs, genuine empty directories and invalid-result rejection.

The literal-file batches use the existing native test runner; equivalent focused commands include pnpm test src/gateway/worker-environments/workspace-generated-paths.test.ts --maxWorkers=1 and pnpm test test/scripts/workspace-test-caches.test.ts --maxWorkers=1 (the latter's final Vitest wall time was 1.01 seconds).

Independent review is clean after two corrected findings; the scoped automated review is also clean. Current-head CI passed every selected family except an inherited mock-export ratchet in test/scripts/ci-node-test-plan.test.ts and its aggregate status. The identical failure was reproduced on unchanged upstream source; this patch changes none of its causal inputs. ClawSweeper reported no findings, with Gold overall and Platinum patch quality. A containing-runtime guest recheck follows source delivery; no running server was changed by this PR. Initial fixture setup, typing and formatting failures were corrected and retained in the validation record.

@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: S labels Oct 19, 2026
@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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR excludes three generated test outputs and their cache-only parent directories from workspace capture and retained-result recovery.

Example: A test run produces .artifacts/vitest-worker-cache/run-cache-0/outputs/dist/worker.js alongside source.txt.

  • Before: The compiler cache enters the pending workspace result and can cause a false conflict after local cleanup.
  • After: Synchronization retains source.txt while excluding the compiler cache and ancestry containing only excluded caches.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported repair with meaningful production-owner regression coverage; supplied evidence stops short of the shipped runtime flow.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its body reports Linux production-owner recovery and remote-script validation, with the containing-runtime recheck explicitly pending.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Running tests can leave disposable compiler outputs in pending workspace changes and block refresh or recovery despite matching source edits.
Reason: This maintainer-authored repair extends the established runtime-file boundary without a new option, synchronization mechanism, or blanket ignored-file exclusion.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored PR open: it addresses a current workspace synchronization defect through the existing owner, and inspection found no definite introduced bug.

Priority: P2
Reviewed head: 1ebae13674e6cc4bd92d0fb90952de6cf71d84d9

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied validation exercises real filesystem, Git, manifest, and recovery owners, but does not show the containing runtime completing a sandbox command and subsequent refresh.
Agent review details

How this fits together

The Gateway workspace owner captures local and remote filesystem inventories, authenticates retained manifests, and reconciles eligible source changes into the managed checkout.

flowchart TD
  A[Test tools generate caches] --> B[Workspace inventory]
  B --> C[Shared path projection]
  D[Authenticated historical manifests] --> C
  C --> E[Eligible workspace changes]
  E --> F[Reconciliation and recovery]
Loading

Technical review

Best possible solution:

Extend the existing exact-root classifier and shared manifest projection while preserving authenticated receipts, authored files, staged inputs, and genuine empty directories.

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

Current-main producer paths and exclusions establish the mismatch, and the linked report records cache-bearing pending results; this review did not independently execute the reproduction.

Is this the best way to solve the issue?

The smallest complete fix uses the existing classification owner plus one serializable projection shared by local parsing and remote capture; the added tests cover distinct producer, transport, empty-directory, and historical-recovery failures.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b34a4659de9c.

Provenance checked

  • Exact-root generated-path exclusions keeps the original intent (11300aa: Keep runtime-owned test caches and locks out of authored workspace results while preserving neighboring user files and historical receipt authentication.)
  • Serializable shared workspace policy keeps the original intent (86d353b: Explicit serializable source prevents transformed function closures from breaking standalone worker scripts.)
  • Cache-only directory ancestry keeps the original intent (9012743: Generated tool outputs remain with their producing runtime; this PR aligns historical and remote directory projection with the existing local capture behavior.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Shakker: Raw commit 9012743 adds src/gateway/worker-environments/workspace-path-exclusions.ts:17 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 90127436fa45; files: src/gateway/worker-environments/workspace-path-exclusions.ts)
  • Peter Steinberger: Raw commit 9ea7df4 adds src/gateway/worker-environments/workspace-manifest.ts:201 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9ea7df4c321a; files: src/gateway/worker-environments/workspace-manifest.ts)

PR surface

Source +36, Tests +244, Docs +2. Total +282 across 9 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 4 59 23 +36
Tests 4 246 2 +244
Docs 1 4 2 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 309 27 +282

Root-cause cluster

Relationship: same_root_cause
Canonical: #176778
Summary: The canonical report and competing PR address the same omitted compiler-cache roots; last-file directory preservation has a separate application-layer cause.

Members:

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Disposable test outputs can block managed coding-workspace synchronization and recovery while the pending source work remains preserved.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-19T02:30:23.120Z sha 9975aea :: needs maintainer review before merge. :: none

Reviewed October 18, 2026, 11:24 PM ET / October 19, 2026, 03:24 UTC (Revision 2).

@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@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. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 19, 2026
@shakkernerd
shakkernerd merged commit 6e4883f into main Oct 19, 2026
158 of 162 checks passed
@shakkernerd
shakkernerd deleted the guest-cache-sync branch October 19, 2026 03:44
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: generated test caches no longer block workspace synchronization or recovery of preserved source changes.

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 P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant