Skip to content

fix(pr): avoid acceleration setup in native worktree entry - #150900

Merged
steipete merged 1 commit into
mainfrom
upd/redmain-lock-shell-worktree-add
Sep 17, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/redmain-lock-shell-worktree-add

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes spurious 10-second lock-shell timeouts when PR worktree entry also runs the full shared allocator. The added allocator cost came from #149585; a timed-out child reports status: null even when worktree creation is progressing normally.

User Impact

Native-Git provisioning avoids loading acceleration configuration it does not use. The shell tests retain their existing deadline and real Git registration, stale-branch reset, sparse-checkout, and lock assertions. Dedicated provisioning tests continue to exercise the real allocator.

Why This Change Was Made

Load the existing worktreeAcceleration !== false policy immediately before addManagedWorktree, and revalidate ownership after the dynamic import. Native hook and sparse-checkout paths do not consume that policy. The lock-test fixture overrides only the existing allocation function; its branch-reset cases now start from genuinely stale branch tips.

Prepare and merge retain the same shared path: prepare_init and merge_run call enter_worktree, whose cold path calls the provisioner. The managed branch still reads the policy before allocation. pr-worktree-provision.test.ts covers disabled acceleration, native hooks and authority loss, and real APFS cold/warm/sparse transitions.

Evidence

  • Before the fix, the deadline failure reproduced on macOS at 10.021 seconds. Linux history comparison measured 0.19–0.44 seconds before improve(pr): reuse managed source clones for cold worktrees #149585 and 7.22–9.57 seconds immediately afterward.
  • The native-provisioning import guard failed before the fix on both macOS and Linux, and passed afterward on macOS.
  • Post-fix macOS: 20 repetitions of each of the three shell cases, 60/60 passing, with entry times of 0.63–1.36 seconds.
  • Post-fix Linux Testbox: 60/60 repetitions passing (0.16–0.46 seconds), followed by both complete files once: 159 passed, 1 skipped (the APFS-only case, covered by the passing macOS run below). Testbox run. The native-provisioning import guard passes on Linux too.
  • pnpm check:changed: passed, including formatting, both typechecks, all export scans, and lint.
  • Fresh Codex branch autoreview against origin/main, through P1: scoped-clean, no actionable findings.

Known proof gaps

The loaded macOS host produced an earlier APFS integration timeout and a fresh-main fixture git ETIMEDOUT. A back-to-back comparison used an independently installed, detached origin/main worktree and then this committed patch, each with one worker and the unchanged 120-second budget:

Revision Case time Command wall User System Result
Main c801737ada1 138.806 s 173.10 s 75.86 s 89.10 s Timeout
Patched 212e079b1eb 113.376 s 138.48 s 66.26 s 72.63 s Pass

Main also exceeded the budget, while the patch passed. This is recorded as host overload; no timeout or assertion was weakened. The temporary comparison worktree was removed. Hosted CI is the proof of record.

@clawsweeper

clawsweeper Bot commented Sep 17, 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 scripts Repository scripts size: XS maintainer Maintainer-authored PR labels Sep 17, 2026
@steipete
steipete marked this pull request as ready for review September 17, 2026 12:46
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 17, 2026, 8:54 AM ET / 12:54 UTC.

ClawSweeper review

What this changes

The PR defers acceleration configuration loading until managed checkout allocation and separates shell worktree tests from allocator coverage while strengthening stale-branch assertions.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: inspected main still eagerly imports configuration on native provisioning paths. No actionable correctness or security defect was found, and the maintainer-authored PR is protected from cleanup closure.

Priority: P2
Reviewed head: 212e079b1eb35a9faf02450600f2bbea34b7f25f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful regression coverage and no identified blocking defect; reported validation was not rerun here.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-author exemption applies. Reported macOS/Linux provisioning runs exercise the changed owner, while shell repetitions use the allocation override; these are supporting validation claims, not independently verified runtime traces.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-author exemption applies. Reported macOS/Linux provisioning runs exercise the changed owner, while shell repetitions use the allocation override; these are supporting validation claims, not independently verified runtime traces.
Evidence reviewed 6 items Pinned production change: The verified introduced delta moves the configuration import into the managed branch and immediately revalidates ownership after awaiting it; the existing acceleration setting and allocation arguments remain intact.
Still necessary on inspected main: Fetched main retains the top-level configuration import despite using getRuntimeConfig only in the managed allocation branch. The provisioner path is absent from the supplied latest release tag v2026.9.4; no released replacement was established.
Preserved production boundary and regression coverage: The complete provisioner suite invokes review-init and retains disabled-acceleration, native hooks, lock-loss, and real APFS cold/warm/sparse cases. The new preload rejects configuration loading during native provisioning; shell fixtures retain real Git registration and now verify genuinely stale branch tips are reset.
Findings None None.
Security None None.

How this fits together

OpenClaw’s PR tooling provisions isolated Git worktrees for review, preparation, and merging. The provisioner checks operation ownership and repository policy, then selects native Git or managed source-cache allocation.

flowchart TD
  A[PR review or preparation] --> B[Worktree entry]
  B --> C[Validate lock and allocation lease]
  C --> D{Native Git required?}
  D -->|Yes| E[Native Git checkout]
  D -->|No| F[Load acceleration policy]
  F --> G[Managed checkout]
  E --> H[Verify checkout identity]
  G --> H
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +30, Other +3. Total +33 across 3 files.

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

Review metrics

None.

Technical review

Best possible solution:

Keep native provisioning independent of unused configuration startup while retaining the shared allocator, existing acceleration preference, and live ownership checks.

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

Yes for the unnecessary import: current main loads configuration before selecting native Git, and the added import guard targets that path. The host-dependent timeout was reported in the PR but was not independently reproduced during this read-only review.

Is this the best way to solve the issue?

Yes. Moving the existing import to its sole consumer is a narrow repair, and dedicated production-boundary coverage supports removing allocator startup from the separate shell tests.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs bounded PR-tooling startup overhead and timeout-sensitive coverage without changing user-facing configuration or runtime defaults.
  • 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: The maintainer-author exemption applies. Reported macOS/Linux provisioning runs exercise the changed owner, while shell repetitions use the allocation override; these are supporting validation claims, not independently verified runtime traces.

Label justifications:

  • P2: This repairs bounded PR-tooling startup overhead and timeout-sensitive coverage without changing user-facing configuration or runtime defaults.
  • 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: The maintainer-author exemption applies. Reported macOS/Linux provisioning runs exercise the changed owner, while shell repetitions use the allocation override; these are supporting validation claims, not independently verified runtime traces.

Evidence

What I checked:

  • Pinned production change: The verified introduced delta moves the configuration import into the managed branch and immediately revalidates ownership after awaiting it; the existing acceleration setting and allocation arguments remain intact. (scripts/pr-lib/worktree-provision.mts:266, 212e079b1eb3)
  • Still necessary on inspected main: Fetched main retains the top-level configuration import despite using getRuntimeConfig only in the managed allocation branch. The provisioner path is absent from the supplied latest release tag v2026.9.4; no released replacement was established. (scripts/pr-lib/worktree-provision.mts:14, f87c65300767)
  • Preserved production boundary and regression coverage: The complete provisioner suite invokes review-init and retains disabled-acceleration, native hooks, lock-loss, and real APFS cold/warm/sparse cases. The new preload rejects configuration loading during native provisioning; shell fixtures retain real Git registration and now verify genuinely stale branch tips are reset. (test/scripts/pr-worktree-provision.test.ts:90, 212e079b1eb3)
  • Merged feature history: GitHub verifies improve(pr): reuse managed source clones for cold worktrees #149585 as merged at this commit. Comparing the commit with its raw recorded parent shows the provisioner was added there; this is related feature history, not a replacement fix for the current PR. (scripts/pr-lib/worktree-provision.mts:12, 387f69830a81)
  • Reported validation and its limits: The captured PR body reports before/after import-guard results, 60 successful shell repetitions on each platform, 159 passing Linux tests, and a passing macOS APFS comparison at the pinned head. The linked Testbox workflow metadata reports cancellation and a different workflow head, so that metadata alone does not independently verify those test results. The reported shell timings exercise the allocation override, while the dedicated provisioner suite covers the changed production path.
  • Read-only review and policy: Root, scripts, and test AGENTS.md guidance was read and applied. No maintainer-notes directory exists. The pinned diff passes whitespace inspection and the checkout remains clean; tests were not executed under the read-only review contract. A deeper follow-history lookup hit an unavailable object, but the relevant raw-parent comparison succeeded. (AGENTS.md:1, 212e079b1eb3)

Likely related people:

  • Jason (Json): Raw commit 387f698 adds scripts/pr-lib/worktree-provision.mts:12 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 387f69830a81; files: scripts/pr-lib/worktree-provision.mts)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 218cb52 into main Sep 17, 2026
136 checks passed
@steipete
steipete deleted the upd/redmain-lock-shell-worktree-add branch September 17, 2026 13:17
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…150900)

Avoid spurious PR worktree-entry lock-shell timeouts caused by loading unused acceleration configuration on native Git paths. Load the existing acceleration policy only before managed allocation, then revalidate operation ownership after the dynamic import.

Preserve native hooks, sparse checkout, Git registration and stale-branch reset behavior. Keep the shell fixture focused on the existing allocation seam while dedicated provisioner tests retain real allocator coverage. No timeout budgets or configuration options change.

Validation: exact-head CI run 35223020951 passed for 212e079 with zero pending checks; the authorized Codex review and exact-head ClawSweeper review found no actionable defects.
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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts 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