Skip to content

test(infra): realpath sandbox migration temp root for macOS - #117261

Merged
steipete merged 1 commit into
mainfrom
fix/macos-sandbox-test-realpath
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/macos-sandbox-test-realpath

Conversation

@steipete

@steipete steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

src/infra/state-migrations.workspace-setup-sandbox.test.ts fails 14 of 18 tests locally on macOS (passing on Linux CI) with /var/folders vs /private/var/folders mismatches. The suite builds all expectations from a raw mkdtemp root under os.tmpdir(), which on macOS is a /var → /private/var symlink, while the production resolvers under test return canonical paths.

Why This Change Was Made

Root AGENTS.md prescribes the exact fix for this class: "Tests asserting resolver/root-containment paths: fs.realpath mkdtemp/tmp roots first." The suite has a single temp-root construction site (setup()), so the fix is one fs.realpathSync(...) around it plus the required invariant comment. The shared test/helpers/temp-dir.ts helper is deliberately untouched — canonicalizing it would change every consumer, beyond this fix's scope.

User Impact

None at runtime — test-only. Maintainers and agents on macOS get a green local run for this suite instead of 14 false failures.

Evidence

  • Before (macOS, main-based checkouts, verified twice on 2026-07-31): 14 failed | 4 passed.
  • After: node scripts/run-vitest.mjs src/infra/state-migrations.workspace-setup-sandbox.test.ts — 18/18 pass on macOS (Darwin 27).
  • Linux CI behavior unchanged: realpathSync is an identity transform on a non-symlinked tmpdir.
  • Three-line test-only diff; structured autoreview skipped as trivial under the repo's triviality provision.

🤖 Generated with Claude Code

@steipete
steipete marked this pull request as ready for review August 1, 2026 06:25
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 1, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 2:32 AM ET / 06:32 UTC.

ClawSweeper review

What this changes

The PR canonicalizes the sandbox-migration test’s temporary home directory so macOS /var aliases and production canonical paths compare consistently.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

This is a correct, narrowly scoped macOS test-infrastructure repair: the test builds paths from a raw temporary root while the state store canonicalizes workspace identities. Keep it open because the protected maintainer label requires an explicit maintainer landing decision, not because a code defect remains.

Priority: P3
Reviewed head: 144c6d91e53bb3233025045166cf446b66c17ad1
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, policy-aligned test repair with a clear owner-boundary explanation and no correctness or security finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-labeled test-only repair does not require external contributor proof; the PR body records a focused macOS run, while this review independently verified the source-level cause and fix boundary.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-labeled test-only repair does not require external contributor proof; the PR body records a focused macOS run, while this review independently verified the source-level cause and fix boundary.
Evidence reviewed 6 items Raw temporary root in current main: The shared test setup assigns the raw directory returned by the temporary-directory tracker to HOME, OPENCLAW_STATE_DIR, and all later sandbox expectations.
Production identity canonicalizes paths: Workspace identity resolution calls native realpath on existing path ancestors, so macOS paths beneath the /var temporary-directory alias become canonical /private/var paths.
Repository test policy matches the repair: The repository policy specifically requires realpath normalization for temporary roots in resolver/root-containment tests because macOS temporary-directory aliases diverge from production canonical paths.
Findings None None.
Security None None.

How this fits together

The Doctor workspace-migration suite creates a temporary OpenClaw home, derives sandbox workspace paths, and imports retired workspace state into SQLite. Sandbox layout helpers feed those paths into workspace-state identity code, which canonicalizes filesystem paths before migration assertions inspect the result.

flowchart LR
  A[Temporary macOS home] --> B[Test setup]
  B --> C[Sandbox workspace layout]
  C --> D[Doctor state migration]
  D --> E[Canonical workspace identity]
  E --> F[Migration assertions]
Loading

Decision needed

Question Recommendation
Should the maintainer approve this test-only macOS canonical-path repair under the protected maintainer label? Approve the scoped repair: Merge the setup-level realpath normalization, which matches production identity behavior and established test patterns.

Why: The patch is source-supported and has no actionable review finding, but protected-label policy requires an explicit maintainer landing decision.

Before merge

  • Add real behavior proof - Not applicable: This maintainer-labeled test-only repair does not require external contributor proof; the PR body records a focused macOS run, while this review independently verified the source-level cause and fix boundary.
  • Resolve merge risk (P1) - The reported macOS result is credible and source-supported, but this read-only review did not independently run the focused suite on Darwin.
Agent review details

Security

None.

PR surface

Tests +2. Total +2 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 3 1 +2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 3 1 +2

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/infra/state-migrations.workspace-setup-sandbox.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the scoped setup-level canonicalization after maintainer confirmation of the reported macOS run, while leaving the generic temporary-directory helper unchanged for its unrelated consumers.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the scoped setup-level canonicalization after maintainer confirmation of the reported macOS run, while leaving the generic temporary-directory helper unchanged for its unrelated consumers.

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

Yes, source establishes a high-confidence macOS path mismatch: the test seeds a raw mkdtemp root while workspace identity resolution uses native realpath. The PR body also reports the focused Darwin run, but this read-only review did not rerun it.

Is this the best way to solve the issue?

Yes. Normalizing once in this suite’s shared setup repairs every affected assertion at the boundary where the raw temporary path enters the test, without changing the generic helper’s behavior for unrelated callers.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0a146d5a18f1.

Labels

Label changes:

  • add P3: This is a contained test-infrastructure correction with no runtime, data, security, or operator-facing behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-labeled test-only repair does not require external contributor proof; the PR body records a focused macOS run, while this review independently verified the source-level cause and fix boundary.

Label justifications:

  • P3: This is a contained test-infrastructure correction with no runtime, data, security, or operator-facing behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-labeled test-only repair does not require external contributor proof; the PR body records a focused macOS run, while this review independently verified the source-level cause and fix boundary.

Evidence

What I checked:

Likely related people:

  • Jason (Json): Current-main blame attributes the raw temporary-root setup and the full sandbox migration suite to the initial normalized-agent-roster repair. (role: introduced affected test setup; confidence: high; commits: af687f920f61; files: src/infra/state-migrations.workspace-setup-sandbox.test.ts)
  • Peter Steinberger: Recent current-main history shows this contributor consolidating Doctor migration ownership immediately adjacent to the affected suite and migration implementation. (role: recent adjacent migration contributor; confidence: high; commits: a742bdb33376; files: src/infra/state-migrations.workspace-setup-sandbox.test.ts, src/infra/state-migrations.workspace-setup.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 78486e2 into main Aug 1, 2026
161 of 167 checks passed
@steipete
steipete deleted the fix/macos-sandbox-test-realpath branch August 1, 2026 06:37
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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