Skip to content

fix(worktrees): create workspaces from nested Windows repositories - #164249

Merged
steipete merged 2 commits into
mainfrom
codex/node-parity-r3-windows-paths
Oct 3, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/node-parity-r3-windows-paths

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes managed workspace creation failing on native Windows with fatal: '$GIT_DIR' too big when the source repository is deeply nested. Git for Windows rejects an overlong explicit metadata argument before reading core.longpaths.

User Impact

Windows users can create and reuse managed workspaces from nested source repositories while preserving inherited relative Git environment paths.

Why This Change Was Made

Keep metadata reads at their original repository working directory and pass the shorter of the captured absolute and relative metadata paths, measured in UTF-8 bytes. The captured registration remains authoritative while cloning replaces the destination's .git pointer, including cancellation and rollback. Index paths still resolve against the original working directory.

The real-Git acceleration fixture now covers a deep source, source-index isolation, and relative GIT_COMMON_DIR. Two existing recovery assertions use Git porcelain's separator convention. No Git command count or ordering changes.

Evidence

  • The deep-source regression failed on pre-fix production with the expected Windows metadata error. It passes with the final correction (190-character source; metadata exceeds 220 characters). The added relative-environment regression also failed on the prior published implementation at the registration query and passes on the correction in 515 ms.
  • Whole service.acceleration.test.ts and empty-source.test.ts: 31/31 passed on native Windows, one worker. Combined Vitest time 175.73 s; command wall time 398.88 s, including 214.96 s of compiled-worker preparation. The deep-source case took 3.346 s. Final-head CI ran the whole acceleration file in 29.98 s Vitest / 52.96 s shard wall time. These existing integration files exercise real Git cloning, rollback, cancellation, and snapshot recovery; the new environment case adds no separate process fixture.
  • Core production types (236.18 s), agents-tools test types (106.65 s), and changed-file pnpm exec oxfmt --check passed on the Windows lease. Independent local and final committed-branch reviews are scoped-clean through P2. The rebase onto main preserved the patch byte-for-byte.
  • The earlier native runtime candidate completed six local and six node pongs. Five-warm-turn median tails before/after the checkout repair were local 283 → 289 ms and node 3,774 → 3,673 ms. Warm turns do not execute this checkout-creation path; these measurements make no performance claim.
  • The public creation flow also reached a 232-character metadata path from a 190-character source. A later node-result fast-import failure at deep ref paths is a separate reconciliation defect; this PR covers creation.

The prior head's CI run failed in an unchanged session-lifecycle test with AgentDatabaseRegistryChangedError. On its clean merge-base, the original three-file/two-worker shard on native Windows produced 13 passes and 15 different failures (cleanup handles, CRLF, and a session-authority rejection). The originally failing case then passed alone (19.532 s case; 399.62 s command). These replays do not establish the cause of the Linux CI failure. No GitHub job was rerun. Final-head CI passed, including openclaw/ci-gate; ClawSweeper completed its exact-head review with no findings.

The sibling service.capacity.test.ts previously produced the same 14 failures with original and repaired production (9 passed in each run): 11 CRLF assumptions, two porcelain separator comparisons, and one shell-setup assumption on Windows. These inherited fixtures remain outside this focused repair.

External Git metadata on another drive cannot use a shorter relative argument and remains subject to Git's own path limits. Production LOC: +4 / -5, net −1.

@clawsweeper

clawsweeper Bot commented Oct 3, 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 docs Improvements or additions to documentation agents Agent runtime and tooling size: XS labels Oct 3, 2026
@steipete
steipete marked this pull request as ready for review October 3, 2026 10:36
@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 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 3, 2026, 8:45 AM ET / 12:45 UTC (Revision 4).

ClawSweeper review

What this changes

The PR shortens Git metadata arguments when creating managed Windows workspaces, preserves relative Git environment paths, and updates regression coverage and documentation.

Merge readiness

✅ Ready for maintainer review

The repair remains necessary on current main and the latest release. The earlier relative-path blocker is resolved, and no blocking correctness findings remain.

Priority: P2
Reviewed head: a86185d09d3fcc21d3184ea57ad8336cacd9c11b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with relevant native Windows evidence and no remaining blocking findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied native Windows evidence connects the checkout owner to successful public workspace creation with deep metadata paths, supplemented by real-Git regressions for relative environment paths and recovery. 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 native Windows evidence connects the checkout owner to successful public workspace creation with deep metadata paths, supplemented by real-Git regressions for relative environment paths and recovery. No stored-data contract changes.
Evidence reviewed 8 items Introduced repair: The pinned introduced delta captures the metadata location through the existing resolver and chooses the shorter UTF-8 representation. Registration and index queries retain the original repository working directory; existing rollback guards remain intact.
Current-main necessity: Fetched main still captures an absolute Git directory and passes it explicitly to registration queries, retaining the reported Windows metadata-argument failure mechanism.
Latest-release check: GitHub's contents endpoint for v2026.9.8 confirms the same absolute metadata argument. The local release blob was unavailable, so release source was inspected through the read-only API.
Findings None None.
Security None None.

How this fits together

Managed workspaces give OpenClaw sessions isolated Git checkouts. The checkout owner registers each workspace, materializes its files, and preserves registration identity during recovery.

flowchart TD
  A[Source repository] --> B[Register isolated workspace]
  B --> C[Capture Git metadata location]
  C --> D[Choose shorter metadata argument]
  D --> E[Verify registered checkout]
  E --> F[Clone template or use Git checkout]
  F --> G[Ready workspace or guarded recovery]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -1, Tests +43, Docs +2. Total +44 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 4 5 -1
Tests 1 47 4 +43
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 53 9 +44

Review metrics

None.

Technical review

Best possible solution:

Keep the existing checkout owner and use shorter metadata arguments while preserving repository-relative environment semantics and recovery guards.

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

Yes: current source exposes the absolute metadata-argument mechanism, and the supplied native Windows evidence records the expected pre-fix failure and after-fix success. This read-only review did not execute it.

Is this the best way to solve the issue?

Yes: the patch reuses the existing metadata resolver, preserves working-directory semantics, and leaves command ordering and recovery ownership intact.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs a bounded native Windows workspace-creation failure for deeply nested source repositories.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster 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 native Windows evidence connects the checkout owner to successful public workspace creation with deep metadata paths, supplemented by real-Git regressions for relative environment paths and recovery. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied native Windows evidence connects the checkout owner to successful public workspace creation with deep metadata paths, supplemented by real-Git regressions for relative environment paths and recovery. No stored-data contract changes.

Evidence

What I checked:

  • Introduced repair: The pinned introduced delta captures the metadata location through the existing resolver and chooses the shorter UTF-8 representation. Registration and index queries retain the original repository working directory; existing rollback guards remain intact. (src/agents/worktrees/checkout.ts:401, a86185d09d3f)
  • Current-main necessity: Fetched main still captures an absolute Git directory and passes it explicitly to registration queries, retaining the reported Windows metadata-argument failure mechanism. (src/agents/worktrees/checkout.ts:403, 3bfa7cd91059)
  • Latest-release check: GitHub's contents endpoint for v2026.9.8 confirms the same absolute metadata argument. The local release blob was unavailable, so release source was inspected through the read-only API. (src/agents/worktrees/checkout.ts, fc23bc864e45)
  • Regression and review continuity: The current test exercises relative GIT_COMMON_DIR with real Git and verifies both source and destination cleanliness. The extended service fixture covers deep metadata paths and source isolation. The supplied prior review reports the earlier blocker resolved on this exact head; its older reviewed SHA is unavailable locally. (src/agents/worktrees/service.acceleration.test.ts:92, a86185d09d3f)
  • Native behavior evidence: The captured PR body, source identity 6c81401e24f3cd048008d88b394e05c2b890933930886c67d4d734b995c46e54, reports public Windows workspace creation reaching a 232-character metadata path, before/after failing regressions, and 31 passing real-Git acceleration and empty-source cases. Warm-turn pongs do not prove checkout creation. The later fast-import failure concerns separate reconciliation behavior. (a86185d09d3f)
  • Verified merge ownership: The test merge's raw parents are the pinned base followed by the exact PR head. Comparing its result against that base preserves the same checkout repair, without the unrelated endpoint-drift changes. (src/agents/worktrees/checkout.ts:401, ee5f7659f74a)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • fuller-stack-dev: 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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-03T10:41:20.197Z sha d686a5b482dce613354de89f2be2229a3ca9dd1f :: needs maintainer review before merge. :: none
  • reviewed 2026-10-03T11:23:15.637Z sha d686a5b482dce613354de89f2be2229a3ca9dd1f :: blocked before merge. :: [P1] Preserve relative Git configuration paths when changing cwd
  • reviewed 2026-10-03T12:28:48.708Z sha a86185d :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added 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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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 3, 2026
Run metadata queries from the captured Git directory with a short explicit
Git directory argument, and resolve the returned index against that same
directory. This preserves registration authority while cloning replaces
the destination marker and avoids Git for Windows' metadata argument limit.

Extend the existing real-Git acceleration case with a deep source and
source-index isolation, and normalize two Windows porcelain expectations.
Native regression, whole-file checks, core/test types, and public session
creation validate the repair. A separate deep-path fast-import limitation
in node-result reconciliation remains documented for a focused follow-up.
Production LOC is net -1.

Committed with --no-verify because the sparse local worktree has no
node_modules. All three changed files passed pnpm exec oxfmt --check
on the native Windows lease before commit.
Keep captured registration and index reads at the repository working
folder, and pass the shorter UTF-8 representation of the captured Git
metadata path. This avoids the Windows metadata argument limit without
reinterpreting inherited relative Git environment paths during cloning.

Add a real-Git regression that fails on the published implementation.
All 31 acceleration and empty-source tests passed on native Windows,
along with core types, agents-tools test types, and formatting. The
complete PR remains net -1 production line.

Committed with --no-verify because this local task worktree has no
node_modules. All three changed PR files passed pnpm exec oxfmt --check
on the native Windows lease before commit.
@steipete
steipete force-pushed the codex/node-parity-r3-windows-paths branch from d686a5b to a86185d Compare October 3, 2026 12:23
@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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 3, 2026
@steipete
steipete merged commit 88342ca into main Oct 3, 2026
147 of 148 checks passed
@steipete
steipete deleted the codex/node-parity-r3-windows-paths branch October 3, 2026 12:48
@steipete

steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Oct 3, 2026
* origin/main:
  fix(test): restore fixture state and await async completion (#164222)
  refactor(sessions): stage and settle pending inputs in workers (#164284)
  fix: speech-only replies fail when models include reasoning (#164285)
  fix(nextcloud-talk): avoid webhook migration for unconfigured channels
  fix: guide background skill reviews through Workshop proposals (#164292)
  test(build): reject AI dependencies in retained config repairs
  refactor(channels): require canonical private-network settings (#163535)
  fix(memory): migrate embedding cache in bounded batches and record oversized rows (#164303)
  feat(state): incognito actor memory and Codex history routing (P5c, inactive) (#164224)
  refactor(synology-chat): remove unused route account ID (#164280)
  test(ui): await web push preference publications (#164295)
  perf(scripts): avoid compiler projects for runtime import parsing (#164243)
  fix(worktrees): create workspaces from nested Windows repositories (#164249)
  test(agents,channels,cli): remove low-value tests (batch d173) (#164302)
  perf(workboard): serve cards per board revision and push changes instead of polling (#164301)
  refactor(sqlite): deslop sqlite stores (#164271)
  chore(ui): refresh control ui locales (#164299)
  refactor(events): deslop listener and disposal plumbing (#164221)
  fix: canonicalize fresh worker reasoning signatures (#164287)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
…penclaw#164249)

* fix(worktrees): create workspaces from nested Windows repositories

Run metadata queries from the captured Git directory with a short explicit
Git directory argument, and resolve the returned index against that same
directory. This preserves registration authority while cloning replaces
the destination marker and avoids Git for Windows' metadata argument limit.

Extend the existing real-Git acceleration case with a deep source and
source-index isolation, and normalize two Windows porcelain expectations.
Native regression, whole-file checks, core/test types, and public session
creation validate the repair. A separate deep-path fast-import limitation
in node-result reconciliation remains documented for a focused follow-up.
Production LOC is net -1.

Committed with --no-verify because the sparse local worktree has no
node_modules. All three changed files passed pnpm exec oxfmt --check
on the native Windows lease before commit.

* fix(worktrees): preserve relative Git environment paths

Keep captured registration and index reads at the repository working
folder, and pass the shorter UTF-8 representation of the captured Git
metadata path. This avoids the Windows metadata argument limit without
reinterpreting inherited relative Git environment paths during cloning.

Add a real-Git regression that fails on the published implementation.
All 31 acceleration and empty-source tests passed on native Windows,
along with core types, agents-tools test types, and formatting. The
complete PR remains net -1 production line.

Committed with --no-verify because this local task worktree has no
node_modules. All three changed PR files passed pnpm exec oxfmt --check
on the native Windows lease before commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation 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. 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