Skip to content

improve(pr): reuse managed source clones for cold worktrees - #149585

Merged
fuller-stack-dev merged 9 commits into
mainfrom
openclaw/wde-pr-acceleration-20260916
Sep 17, 2026
Merged

fuller-stack-dev merged 9 commits into
mainfrom
openclaw/wde-pr-acceleration-20260916

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Closes #149583

What Problem This Solves

Cold scripts/pr worktrees perform full Git checkouts even where OpenClaw already has a filesystem-clone source cache. The adapter also needs to preserve Git hooks, caller policy and native recovery ownership while using that cache.

User Impact

PR source creation can reuse the managed source cache on supported filesystems. Repositories with hooks, filesystem monitors, conditional/per-worktree Git configuration or replaced command-count settings keep native Git behavior. Native PR paths, caller branches, private main checkpoints, operation locks, full-checkout checks and cleanup ownership remain unchanged.

Why This Change Was Made

The adapter calls the existing managed checkout owner under its renewable allocation lease. It preserves caller-owned seed branches and partial checkouts on failure. The trusted wrapper carries the runtime source and installed package dependencies needed by that path.

This branch is integrated with main after #149581 and #149587 landed; their generic/setup changes remain owned by those PRs. Current-source qualification found and repaired missing extracted plugin-manifest modules, missing fixture package links, and an overly broad policy check that treated the supervisor's preserved GIT_CONFIG_PARAMETERS maintenance settings as a reason to disable acceleration.

Evidence

  • Private repository-pinned pnpm 12.4.0 frozen install passed with normal lifecycle scripts and no store growth.
  • Owning core/script/root-test types, type-aware lint and both production/all-exports Knip checks passed; affected lint/type checks passed again after the final policy/test correction.
  • Native Git 2.55 fixtures verified relative and branch-conditional hook timing, including exactly one hook invocation and retained edits.
  • All 15 locally applicable provisioner cases passed across disjoint current-source runs, including real APFS cold/warm source reuse, sibling index isolation, sparse/full transitions, hook/fsmonitor policy, both Git configuration transports, lock loss and retained failed checkout state.
  • Main-refresh and containment coverage passed across disjoint runs (153 original passes, then the three repaired cases); original failure evidence remains. The cold snapshot fixture now uses the native operation supervisor, and Git lookup preserves the caller PATH. Final fixture types/lint and independent P0–P2 review pass. All 13 selected extracted-wrapper cases, 11 selected lock cases and four checkout siblings passed across focused runs. Linked cleanup fixtures retain all assertions with a bounded allowance for transitive anchor verification.

No full-corpus/profile proof is replayed. The Linux unsupported-filesystem cell cannot run on the local macOS host; hosted exact-head CI remains required. Original failed/interrupted qualification and the corrected successor evidence are retained separately.

@fuller-stack-dev fuller-stack-dev self-assigned this Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 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 agents Agent runtime and tooling labels Sep 16, 2026
@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review September 16, 2026 01:55
@openclaw-barnacle openclaw-barnacle Bot added size: XL maintainer Maintainer-authored PR labels Sep 16, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 16, 2026, 7:58 PM ET / 23:58 UTC (Revision 9).

ClawSweeper review

What this changes

The PR routes cold PR worktree creation through the existing filesystem-clone checkout owner while preserving native Git policy, branch ownership, and recovery state.

Merge readiness

⛔ Blocked before merge - 3 items remain

This remains a useful, maintainer-sponsored implementation that current main and the latest release do not provide. No blocking code defect was established; the previous compatibility and performance qualification gaps remain.

Priority: P2
Reviewed head: f707d13ebdfd863f4d8e587f83a0a8cb2bd5dc17

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The implementation coherently reuses existing owners and has focused behavioral coverage, with compatibility and performance qualification still outstanding.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate; reported real APFS and native Git fixture results support the checkout behavior, while extracted-wrapper upgrade qualification and scoped performance measurements remain separate validation gaps.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR is exempt from the external-contributor proof gate; reported real APFS and native Git fixture results support the checkout behavior, while extracted-wrapper upgrade qualification and scoped performance measurements remain separate validation gaps.
Evidence reviewed 10 items Current main still needs the adapter: Fetched main still creates cold PR worktrees directly with git worktree add; its checkout owner does not contain this branch’s existing-branch adapter. The related merged work does not supersede the native PR integration.
Latest release retains ordinary provisioning: The v2026.9.4 source uses direct git worktree add at line 291, without the proposed provisioner.
Re-review delta: The exact latest commit adds only src/memory/root-memory-files.ts to the wrapper inventory. Its recorded parent matches the previous reviewed head; it does not change the earlier admission or validation concerns.
Findings None None.
Security None None.

How this fits together

The native PR tooling creates isolated checkouts for review and landing. This adapter connects that tooling to OpenClaw’s managed source-template cache, while Git continues to own branches and indexes and native PR tooling retains cleanup responsibility.

flowchart TD
  A[PR review command] --> B[Operation lock and pinned seed]
  B --> C[Allocation lease and disk checks]
  C --> D{Native Git policy required?}
  D -->|Yes| E[Ordinary Git checkout]
  D -->|No| F[Managed template or Git fallback]
  E --> G[Verify checkout identity]
  F --> G
  G --> H[Native PR review and recovery]
Loading

Before merge

  • Resolve merge risk (P1) - Previously working cold PR creation can stop when shared state is inaccessible or incompatible, or a checked volume falls below the managed reserve, including with acceleration disabled; existing-operator compatibility remains unqualified.
  • Resolve merge risk (P1) - The larger extracted runtime and repeated authority checks add startup work, but candidate cold/warm timing and RSS versus ordinary Git are not supplied.
  • Complete next step (P2) - Complete the extracted-wrapper compatibility qualification and before/after seconds/RSS measurements, and make the new state and disk-reserve requirements visible in the PR.
Agent review details

Security

None.

PR surface

Source +39, Tests +539, Other +1413. Total +1991 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 1 45 6 +39
Tests 7 570 31 +539
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 5 1432 19 +1413
Total 13 2047 56 +1991

Review metrics

Metric Value Why it matters
Production versus test growth Production/tooling +426 net lines; source inventory +1,026; tests/support +539 The stated growth supports native-policy adaptation and trusted runtime extraction; measured performance benefit remains outstanding.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #149583
Summary: This PR implements the paired open request; the merged prerequisites do not replace the native PR adapter.

Members:

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

Merge-risk options

Maintainer options:

  1. Qualify the new prerequisites (recommended)
    Demonstrate extracted-wrapper provisioning with fresh and existing state, disabled acceleration, and disk-pressure refusal, and document the operator requirements.

Technical review

Best possible solution:

Reuse the managed checkout owner while retaining native PR custody, with documented state and reserve requirements and demonstrated compatibility for fresh and existing operator setups.

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

Not applicable as a defect reproduction: this is an internal optimization, and source confirms that current main still performs ordinary cold Git checkout.

Is this the best way to solve the issue?

Yes, reusing the existing checkout owner is the maintainable direction; end-to-end compatibility and measured performance still need qualification.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded maintainer-tooling optimization with no demonstrated urgent user-facing regression.
  • merge-risk: 🚨 compatibility: Cold PR creation gains shared-state and disk-reserve prerequisites even when acceleration is disabled.
  • 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 MEMBER-authored PR is exempt from the external-contributor proof gate; reported real APFS and native Git fixture results support the checkout behavior, while extracted-wrapper upgrade qualification and scoped performance measurements remain separate validation gaps.

Evidence

What I checked:

  • Current main still needs the adapter: Fetched main still creates cold PR worktrees directly with git worktree add; its checkout owner does not contain this branch’s existing-branch adapter. The related merged work does not supersede the native PR integration. (scripts/pr-lib/worktree.sh:323, 1b0243f7303e)
  • Latest release retains ordinary provisioning: The v2026.9.4 source uses direct git worktree add at line 291, without the proposed provisioner. (scripts/pr-lib/worktree.sh:291, 3a9d69db306c)
  • Re-review delta: The exact latest commit adds only src/memory/root-memory-files.ts to the wrapper inventory. Its recorded parent matches the previous reviewed head; it does not change the earlier admission or validation concerns. (scripts/pr-lib/wrapper-components.txt:738, f707d13ebdfd)
  • New cold-provisioning prerequisites: Every cold creation enters the shared-state allocation lease and checks destination, Git, repository, and state volumes before selecting native or accelerated checkout. Disabling acceleration does not bypass these prerequisites. (scripts/pr-lib/worktree-provision.mts:167, f707d13ebdfd)
  • Reserve and state behavior: Capacity admission reserves 10% of each checked volume, bounded between 4 and 16 GiB, plus allocation demand. The reused allocation owner opens the shared state database, whose lease acquisition propagates non-contention storage failures. (src/agents/worktrees/capacity.ts:44, f707d13ebdfd)
  • Proof coverage and its boundary: The captured body reports real APFS cold/warm fixture success, hook preservation, sibling isolation, and lock-loss coverage. The extracted-wrapper test invokes the adapter without arguments and checks its usage rejection; that establishes importability, not successful provisioning and lease-worker operation from the extracted tree with existing operator state. (test/scripts/pr-wrappers.test.ts:869, f707d13ebdfd)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Complete extracted-wrapper provisioning evidence with fresh and existing state, disabled acceleration, and disk-pressure refusal; document state and reserve requirements.
  • Record candidate cold/warm seconds and RSS against ordinary Git, as required for agent performance changes.

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.

History

Review history (8 earlier review cycles)
  • reviewed 2026-09-16T02:02:52.120Z sha b8cab0c :: blocked before merge. :: none
  • reviewed 2026-09-16T02:47:44.258Z sha cb577d1 :: blocked before merge. :: none
  • reviewed 2026-09-16T04:32:23.071Z sha cb577d1 :: blocked before merge. :: none
  • reviewed 2026-09-16T05:32:01.396Z sha cb577d1 :: blocked before merge. :: none
  • reviewed 2026-09-16T22:59:43.235Z sha c81a031 :: blocked before merge. :: none
  • reviewed 2026-09-16T23:19:32.361Z sha 635a223 :: blocked before merge. :: none
  • reviewed 2026-09-16T23:30:37.449Z sha e12c11a :: blocked before merge. :: none
  • reviewed 2026-09-16T23:45:50.406Z sha fa75209 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 16, 2026
@fuller-stack-dev
fuller-stack-dev merged commit 387f698 into main Sep 17, 2026
206 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the openclaw/wde-pr-acceleration-20260916 branch September 17, 2026 00:17
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

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

* fix(worktrees): preserve caller-owned branches during allocation

* fix(worktrees): preserve caller Git policy in capacity worker

* improve(pr): reuse managed source clones for cold worktrees

* fix(pr): complete provisioning closure and fixture setup

* test(pr): preserve native ownership in provisioning fixtures

* test(pr): allow bounded linked-wrapper cleanup verification

* fix(pr): preserve aliased worktree parents during provisioning

* fix(pr): include current memory path helper in wrapper closure
steipete added a commit that referenced this pull request Sep 17, 2026
Let the verified anchor child complete and validate its package pins when an
older parent hands it an incomplete dependency context. Preserve pinned real
package directories and bootstrap older anchors against their own manifest.

Extend the extracted-source guard to cover pinned bare imports, package export
subpaths, and copied workspace aliases. Keep the inventory repair with #150399.

Refs: #149585, #133913, #150312, #150399.
steipete added a commit that referenced this pull request Sep 17, 2026
Let the verified anchor child complete and validate its package pins when an
older parent hands it an incomplete dependency context. Preserve pinned real
package directories and bootstrap older anchors against their own manifest.

Extend the extracted-source guard to cover pinned bare imports, package export
subpaths, and copied workspace aliases. Keep the inventory repair with #150399.

Refs: #149585, #133913, #150312, #150399.
steipete added a commit that referenced this pull request Sep 17, 2026
* fix(pr): give materialized wrappers their dependency context

Let the verified anchor child complete and validate its package pins when an
older parent hands it an incomplete dependency context. Preserve pinned real
package directories and bootstrap older anchors against their own manifest.

Extend the extracted-source guard to cover pinned bare imports, package export
subpaths, and copied workspace aliases. Keep the inventory repair with #150399.

Refs: #149585, #133913, #150312, #150399.

* test(pr): resolve workspace aliases within the extracted root

Bind the TypeScript resolution host to the selected closure root so alias
lookups cannot fall back to the calling checkout during anchor validation.

Refs: #150399, #150504.
shreyanshjain05 added a commit to shreyanshjain05/openclaw that referenced this pull request Sep 17, 2026
…ier assertions

- Add src/agents/model-provider-local.ts to scripts/pr-lib/wrapper-components.txt
  (sorted between model-extra-params.ts and model-ref-profile.ts). The file was
  imported by internal-runtime-context.ts in openclaw#149585 but not added to the
  anchored-copy inventory; fixture copies lacked the module, causing
  ERR_MODULE_NOT_FOUND in shards 23/25/36/40/42.

- Sync wrapper-components.txt with current main (includes entries added since
  the branch's last merge).

- Remove 'test-provider' from CLOUD_PROVIDER_ID_PREFIXES in
  internal-runtime-context.ts. The entry existed to keep two integration suites
  green after openclaw#140799 added the findIndex(carrier) > userIndex assertion, but
  'test-provider' is a fixture name leaking into production and prefix-matches
  any user config named test-provider-*.

- Update agent-runner-memory.private-transcript.test.ts:317 and
  agent-runner-required-maintenance.pending-input.test.ts:409 to assert
  toBeLessThan(userIndex): the test fixtures use openai-completions on
  http://127.0.0.1:<port>/v1, which isLocalProviderBaseUrl classifies as a
  local/self-hosted endpoint, so shouldRelocateRuntimeContextCarrierToTail
  returns false and the carrier stays in chronological position before the
  steering user. This matches the documented behaviour in
  attempt-session-boundary-carrier.test.ts ("does not relocate carrier to tail
  for custom provider with loopback baseUrl").
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…w#150504)

* fix(pr): give materialized wrappers their dependency context

Let the verified anchor child complete and validate its package pins when an
older parent hands it an incomplete dependency context. Preserve pinned real
package directories and bootstrap older anchors against their own manifest.

Extend the extracted-source guard to cover pinned bare imports, package export
subpaths, and copied workspace aliases. Keep the inventory repair with openclaw#150399.

Refs: openclaw#149585, openclaw#133913, openclaw#150312, openclaw#150399.

* test(pr): resolve workspace aliases within the extracted root

Bind the TypeScript resolution host to the selected closure root so alias
lookups cannot fall back to the calling checkout during anchor validation.

Refs: openclaw#150399, openclaw#150504.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL 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.

[Feature]: Reuse managed source clones for native PR worktrees

1 participant