Skip to content

fix(worktrees): restore PR template acceleration - #164706

Merged
steipete merged 1 commit into
mainfrom
ci/fix1-pr-worktree
Oct 4, 2026
Merged

steipete merged 1 commit into
mainfrom
ci/fix1-pr-worktree

Conversation

@steipete

@steipete steipete commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes PR provisioning silently falling back to ordinary Git checkout instead of creating or reusing its filesystem template.

User Impact

Maintainer review and landing worktrees regain cold and warm template acceleration. Application behavior, database schemas, permissions, and provisioning deadlines are unchanged.

Why This Change Was Made

The worker move in #164517 routed template commands through the application runtime, which extracted PR wrappers intentionally omit. A portable extracted-wrapper reproduction fails with ERR_MODULE_NOT_FOUND(openclaw-state-worker-runtime.js) before this change.

The shared-state bootstrap now loads the existing template operations directly from their leaf owner. The wrapper includes that leaf while preserving the guard against loading the application runtime. Existing admission, transaction, and settlement behavior remains intact.

Evidence

  • The original APFS cold/warm provisioning and sparse-transition case passed three times after rebasing: 103.8, 97.0, and 110.1 seconds, within the unchanged 120-second deadline. Its other 15 cases passed in the earlier full-file run; that run still had the known APFS timing failure on the older base.
  • The extracted-wrapper regression exercises all seven template operations under a real lease and retains the application-runtime absence assertion. The complete eager-import guard passed all 17 tests; core types also passed after rebasing.
  • Linux proof passed focused wrapper/worker tests, check-changed, full test types, script types, architecture, source contracts, deadcode/Knip, build, boundary lint, and all 12,368 unit tests. Independent P2 review found no actionable issues.
  • The full infrastructure run passed 26,776 tests with one Doctor-maintenance failure. That same failure and two Docker provenance assertions reproduce on the unchanged proof base (7b9615fc20fe) without this patch. Fourteen other broad-run failure groups pass in isolation on both baseline and candidate (87 tests each); those broad timing failures remain unclassified beyond that comparison. Both Ruby-dependent fixture files pass after installing the missing runner prerequisite (44 tests).
  • Natural PR CI passed, and this PR merged as b97d4c03f364.

Remote proof capacity reached its limit, so this used the authorized ready-PR/auto-merge route. The broad local tooling run was stopped incomplete after preserving its results; natural PR CI supplied the remaining validation. No workflow was dispatched or rerun, and no assertion, timeout, skip, or import guard was weakened.

The worker move in 7283a5c routed template commands through the full
application runtime, which extracted PR wrappers intentionally omit.
Provisioning therefore fell back to ordinary Git checkout instead of
creating or reusing its filesystem template.

Load the seven template handlers independently in the shared-state
bootstrap worker and keep their existing admission, transaction, and
settlement behavior. Ship only the template leaf in the wrapper inventory,
and exercise its complete lifecycle without the application runtime.

Validation: P2 review, check-changed, full test types, script types,
architecture, source contracts, deadcode, build, boundary lint, 12,368
unit tests, and focused extracted-wrapper/worker tests pass. Full infra
has one Doctor-maintenance failure under investigation; tooling remains
in progress. The APFS scenario also exceeds its unchanged 120-second
deadline on the producer's parent. Three repaired attempts passed the
cold/warm clone assertions before hitting that existing deadline.
@clawsweeper

clawsweeper Bot commented Oct 4, 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.

@steipete
steipete enabled auto-merge (squash) October 4, 2026 02:22
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts agents Agent runtime and tooling size: S labels Oct 4, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 10:27 PM ET / October 4, 2026, 02:27 UTC.

ClawSweeper review

What this changes

The branch restores faster PR worktree creation by loading existing filesystem-template operations directly in the shared-state worker and including their module in extracted wrappers.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary: pinned main still routes template commands through an application runtime excluded from extracted wrappers. The focused repair preserves existing guards, and no actionable introduced defect was found.

Priority: P2
Reviewed head: 81aa4b869116010c5c3c70adfd44e4aece95e51a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with relevant real-filesystem observations and regression coverage; no blocking patch defect was found.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied APFS observations exercise review-init through production provisioning and the repaired template worker, reporting successful cold creation, warm reuse, sibling isolation, and sparse fallbacks after rebasing. The extracted-wrapper lifecycle regression supplements that proof. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied APFS observations exercise review-init through production provisioning and the repaired template worker, reporting successful cold creation, warm reuse, sibling isolation, and sparse fallbacks after rebasing. The extracted-wrapper lifecycle regression supplements that proof. No stored-data contract changes.
Evidence reviewed 8 items Pinned introduced change: Inspected the complete introduced diff between the supplied main and original PR head. It relocates the existing seven handlers, updates worker command types, adds the template worker to extraction, and extends existing boundary coverage.
Repair remains absent from pinned main: Main still registers template handlers in the application-domain dispatcher. The extracted wrapper intentionally omits the application runtime, whereas the proposed bootstrap handles template preparation and execution independently.
Admission and stored-state compatibility: The mutation wrapper retains its existing transaction-stage and commit-stage admission requests. Template records, SQL operations, asynchronous caller guards, and settlement behavior are unchanged; this changes dispatch ownership without changing the stored data model.
Findings None None.
Security None None.

How this fits together

PR tooling creates isolated Git worktrees for review and landing. Its filesystem-template cache uses a SQLite worker to record template creation, reuse, and retirement before materializing those worktrees.

flowchart TD
  A[PR review request] --> B[Worktree provisioning]
  B --> C[Shared-state worker]
  C --> D[Template registry owner]
  D --> E[SQLite template records]
  E --> B
  B --> F[Template clone or Git checkout]
  F --> G[Isolated PR worktree]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +33, Tests +25, Other +1. Total +59 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 69 36 +33
Tests 2 27 2 +25
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 7 97 38 +59

Review metrics

None.

Technical review

Best possible solution:

Keep template commands with their existing leaf owner so extracted wrappers can reuse filesystem templates while preserving worker admission, cleanup custody, and native Git fallbacks.

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

Yes, source establishes a focused reproduction path: execute a template operation from an extracted wrapper that lacks the application runtime. The PR reports the missing-module failure before the fix; this review did not execute it.

Is this the best way to solve the issue?

Yes, relocating the unchanged handlers to the bootstrap-accessible owner repairs the extraction boundary without bundling the full application runtime or duplicating template behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This restores maintainer worktree acceleration with limited operational impact; ordinary Git checkout remains the fallback.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied APFS observations exercise review-init through production provisioning and the repaired template worker, reporting successful cold creation, warm reuse, sibling isolation, and sparse fallbacks after rebasing. The extracted-wrapper lifecycle regression supplements that proof. No stored-data contract changes.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied APFS observations exercise review-init through production provisioning and the repaired template worker, reporting successful cold creation, warm reuse, sibling isolation, and sparse fallbacks after rebasing. The extracted-wrapper lifecycle regression supplements that proof. No stored-data contract changes.

Label justifications:

  • P2: This restores maintainer worktree acceleration with limited operational impact; ordinary Git checkout remains the fallback.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied APFS observations exercise review-init through production provisioning and the repaired template worker, reporting successful cold creation, warm reuse, sibling isolation, and sparse fallbacks after rebasing. The extracted-wrapper lifecycle regression supplements that proof. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied APFS observations exercise review-init through production provisioning and the repaired template worker, reporting successful cold creation, warm reuse, sibling isolation, and sparse fallbacks after rebasing. The extracted-wrapper lifecycle regression supplements that proof. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: Inspected the complete introduced diff between the supplied main and original PR head. It relocates the existing seven handlers, updates worker command types, adds the template worker to extraction, and extends existing boundary coverage. (src/state/openclaw-state.worker.ts:131, 81aa4b869116)
  • Repair remains absent from pinned main: Main still registers template handlers in the application-domain dispatcher. The extracted wrapper intentionally omits the application runtime, whereas the proposed bootstrap handles template preparation and execution independently. (src/agents/worktrees/dispatch.worker.ts:71, 1836ae214644)
  • Admission and stored-state compatibility: The mutation wrapper retains its existing transaction-stage and commit-stage admission requests. Template records, SQL operations, asynchronous caller guards, and settlement behavior are unchanged; this changes dispatch ownership without changing the stored data model. (src/agents/worktrees/template-registry.worker.ts:25, 81aa4b869116)
  • Extracted-wrapper regression: The extended existing test executes all seven asynchronous template operations against real SQLite under a real lease in copied wrapper sources, explicitly verifies that the application runtime is absent, and checks lease release. It protects the actual missing-module boundary rather than mocking dispatch. (test/scripts/eager-import-closure.test.ts:81, 81aa4b869116)
  • After-fix provisioning evidence: The captured PR body reports three successful APFS cold/warm provisioning and sparse-transition runs after rebasing: 103.8, 97.0, and 110.1 seconds within the unchanged 120-second deadline. Inspected the scenario: it enters through review-init, checks real template-clone output and reuse, and verifies sibling isolation and native sparse fallbacks. These are supplied execution observations; this read-only review did not rerun them. (test/scripts/pr-worktree-provision.test.ts:386, 81aa4b869116)
  • Related merged work and routing history: GitHub confirms perf(worktrees): reuse sandbox dependency templates #164517 merged as 7283a5c. Its recorded patch added the template worker mutation wrapper and application-domain registrations. Current-main history also connects Peter Steinberger to worker registration and Jason (Json) to PR provisioning and diagnostics. (src/agents/worktrees/template-registry.worker.ts:30, 7283a5cd90c2)

Likely related people:

  • Peter Steinberger: Raw commit 7283a5c adds src/agents/worktrees/template-registry.worker.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: 7283a5cd90c2; files: src/agents/worktrees/template-registry.worker.ts)
  • Jason (Json): 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 b97d4c0 into main Oct 4, 2026
153 of 154 checks passed
@steipete
steipete deleted the ci/fix1-pr-worktree branch October 4, 2026 02:32
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
The worker move in 00ba533 routed template commands through the full
application runtime, which extracted PR wrappers intentionally omit.
Provisioning therefore fell back to ordinary Git checkout instead of
creating or reusing its filesystem template.

Load the seven template handlers independently in the shared-state
bootstrap worker and keep their existing admission, transaction, and
settlement behavior. Ship only the template leaf in the wrapper inventory,
and exercise its complete lifecycle without the application runtime.

Validation: P2 review, check-changed, full test types, script types,
architecture, source contracts, deadcode, build, boundary lint, 12,368
unit tests, and focused extracted-wrapper/worker tests pass. Full infra
has one Doctor-maintenance failure under investigation; tooling remains
in progress. The APFS scenario also exceeds its unchanged 120-second
deadline on the producer's parent. Three repaired attempts passed the
cold/warm clone assertions before hitting that existing deadline.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: S 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