Skip to content

fix: keep dirty changed checks scoped to local edits - #124685

Merged
steipete merged 2 commits into
mainfrom
fix/crabbox-dirty-changed-base
Aug 16, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/crabbox-dirty-changed-base

Conversation

@steipete

@steipete steipete commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where developers running delegated changed checks from a dirty worktree could test dozens of unrelated recent-main files because the remote box retained stale Git metadata.

Why This Change Was Made

Dirty POSIX changed gates now use the existing isolated-checkout transport. A private Git index snapshots the exact final worktree tree without mutating the user's index, while the existing bundle bootstrap reconstructs the exact merge base and final tree remotely. WSL2 uses that same transport and includes the bootstrap in its generated POSIX script; native Windows keeps its existing PowerShell path.

User Impact

Delegated check:changed runs from staged, unstaged, deleted, or eligible untracked edits stay scoped to the user's actual changes. This makes remote validation faster and prevents unrelated baseline failures.

Evidence

  • node scripts/run-vitest.mjs test/scripts/crabbox-wrapper.test.ts — 239 passed.
  • The focused dirty WSL2 generated-script regression failed before the follow-up and passes with the exact-tree Git bootstrap.
  • Dirty-worktree Blacksmith Testbox proof: run 31957878108, lease tbx_01m05newzp26dy8yzsj462w9ba (completed). Sync reported exactly 3 targeted transport/changed files; remote classification was only scripts, testRoot, tooling; all changed checks passed in 2m56s.
  • Exact-head Blacksmith Testbox proof: run 31958898971, lease tbx_01m05pnda8z13v18p9csd62t9v (completed). Remote classification remained scripts, testRoot, tooling; all changed checks passed in 2m55s.
  • .agents/skills/autoreview/scripts/autoreview --mode local — clean, no accepted/actionable findings; overall correctness 0.98.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S maintainer Maintainer-authored PR labels Aug 16, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 16, 2026, 12:20 PM ET / 16:20 UTC.

ClawSweeper review

What this changes

This PR snapshots dirty POSIX worktree content through a private Git index and sends that exact tree to the remote changed-check checkout.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Needs maintainer review before merge - 3 items remain

Keep open: the private-index transport fixes dirty POSIX Testbox syncs, but the changed guard still excludes WSL2 even though that path executes a POSIX script; dirty WSL2 changed checks retain the stale-metadata behavior.

Priority: P2
Reviewed head: 819f7ec8a90e7b7630a510b78384f357c5d92b44

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The supplied Testbox proof is strong for the Linux path, but the patch misses the equivalent WSL2 execution branch.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The linked completed Testbox run exercises the real delegated transport from a dirty worktree and reports scoped remote classification with passing changed checks.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The linked completed Testbox run exercises the real delegated transport from a dirty worktree and reports scoped remote classification with passing changed checks.
Evidence reviewed 6 items Current-main failure path: Current main returns false for any dirty worktree before selecting the isolated checkout, leaving a dirty delegated changed check on the stale remote-metadata path.
Proposed owner-boundary repair: The PR creates an isolated index from HEAD, stages the final worktree with git add -A, and writes that tree for the transport bundle without changing the caller’s index.
WSL2 remains on a POSIX execution path: The existing WSL2 preparation writes and runs a POSIX script, and its adjacent test explicitly asserts that WSL2 stays on that path.
Findings 1 actionable finding [P2] Cover the WSL2 POSIX changed-check path
Security None None.

How this fits together

The Crabbox wrapper delegates changed-file validation to a remote machine. It prepares an isolated checkout and Git metadata so the remote classifier and checks operate on the developer’s intended local tree.

flowchart LR
  A[Developer worktree] --> B[Changed check request]
  B --> C[Remote sync selection]
  C --> D[Private Git index]
  D --> E[Remote checkout]
  E --> F[Changed-file classifier]
  F --> G[Scoped checks]
Loading

Before merge

  • Cover the WSL2 POSIX changed-check path (P2) - isWindowsRemoteTarget() is also true for WSL2, so a dirty WSL2 run falls through to isWorktreeClean() and never creates the private-tree bundle. That leaves the original stale-metadata behavior on a path whose generated script.sh is explicitly POSIX; include its Git bootstrap/tree transport there while leaving native Windows unchanged.
  • Resolve merge risk (P1) - Production code grows by 12 lines for the necessary private-index snapshot path; it should not merge until the equivalent dirty WSL2 execution path is covered.
  • Complete next step (P2) - This protected maintainer PR has one concrete WSL2 blocker that needs a focused update and review before merge.

Findings

  • [P2] Cover the WSL2 POSIX changed-check path — scripts/crabbox-wrapper.mts:3422
Agent review details

Security

None.

PR surface

Tests +36, Other +12. Total +48 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 40 4 +36
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 35 23 +12
Total 2 75 27 +48

Review metrics

Metric Value Why it matters
Production versus test LOC production +12, tests +36 The production growth implements private-index tree capture and cleanup; the focused test expansion covers the new transport behavior, but not WSL2.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Use the same final-worktree Git tree for WSL2’s generated POSIX script, while retaining the existing native-Windows path, and prove dirty staged, unstaged, deleted, and eligible untracked edits stay scoped remotely.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Use the same final-worktree Git tree for WSL2’s generated POSIX script, while retaining the existing native-Windows path, and prove dirty staged, unstaged, deleted, and eligible untracked edits stay scoped remotely.

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

Yes, from source: run a dirty delegated changed check with --target windows --windows-mode wsl2; the condition skips the isolated transport, while the WSL2 path runs a POSIX script without the Git bootstrap.

Is this the best way to solve the issue?

No: the private-index design is the right repair for POSIX transports, but the implementation excludes WSL2 instead of carrying the same bootstrap into its generated script.

Full review comments:

  • [P2] Cover the WSL2 POSIX changed-check path — scripts/crabbox-wrapper.mts:3422
    isWindowsRemoteTarget() is also true for WSL2, so a dirty WSL2 run falls through to isWorktreeClean() and never creates the private-tree bundle. That leaves the original stale-metadata behavior on a path whose generated script.sh is explicitly POSIX; include its Git bootstrap/tree transport there while leaving native Windows unchanged.
    Confidence: 0.95

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2b8e94ea4dba.

Labels

Label changes:

  • add P2: The incomplete repair leaves a supported delegated changed-check workflow mis-scoped on dirty WSL2 worktrees.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The linked completed Testbox run exercises the real delegated transport from a dirty worktree and reports scoped remote classification with passing changed checks.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (linked_artifact): The linked completed Testbox run exercises the real delegated transport from a dirty worktree and reports scoped remote classification with passing changed checks.

Label justifications:

  • P2: The incomplete repair leaves a supported delegated changed-check workflow mis-scoped on dirty WSL2 worktrees.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (linked_artifact): The linked completed Testbox run exercises the real delegated transport from a dirty worktree and reports scoped remote classification with passing changed checks.
  • proof: sufficient: Contributor real behavior proof is sufficient. The linked completed Testbox run exercises the real delegated transport from a dirty worktree and reports scoped remote classification with passing changed checks.

Evidence

What I checked:

  • Current-main failure path: Current main returns false for any dirty worktree before selecting the isolated checkout, leaving a dirty delegated changed check on the stale remote-metadata path. (scripts/crabbox-wrapper.mts:3420, 2b8e94ea4dba)
  • Proposed owner-boundary repair: The PR creates an isolated index from HEAD, stages the final worktree with git add -A, and writes that tree for the transport bundle without changing the caller’s index. (scripts/crabbox-wrapper.mts:3499, 819f7ec8a90e)
  • WSL2 remains on a POSIX execution path: The existing WSL2 preparation writes and runs a POSIX script, and its adjacent test explicitly asserts that WSL2 stays on that path. (scripts/crabbox-wrapper.mts:3221, 51964c1eee30)
  • Uncovered WSL2 branch: The changed condition treats every Windows target as non-POSIX, so dirty WSL2 falls through to isWorktreeClean() and never prepares the private-tree transport. (scripts/crabbox-wrapper.mts:3422, 819f7ec8a90e)
  • Git command contract: Git’s local help confirms read-tree loads a tree into an index, git add -A stages tracked and untracked changes, and write-tree emits the resulting tree; this supports the private-index approach. (scripts/crabbox-wrapper.mts:3504, 819f7ec8a90e)
  • After-fix behavior proof: The PR body links a completed dirty-worktree Blacksmith Testbox run reporting three targeted files, scoped classification, and passing changed checks. (819f7ec8a90e)

Likely related people:

  • steipete: Current-main blame attributes the existing isolated-checkout and WSL2 preparation paths to Peter Steinberger; the PR is also authored by steipete. (role: recent developer-tooling contributor; confidence: high; commits: 51964c1eee30; files: scripts/crabbox-wrapper.mts, test/scripts/crabbox-wrapper.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Make dirty WSL2 generate or invoke the same Git bootstrap, then add focused WSL2 dirty-worktree coverage showing the remote classification is limited to local edits.

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 eb63cb1 into main Aug 16, 2026
148 checks passed
@steipete
steipete deleted the fix/crabbox-dirty-changed-base branch August 16, 2026 16:40

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 P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants