Skip to content

fix(worktrees): heal fetches with missing commit-graph tips - #167473

Merged
steipete merged 2 commits into
mainfrom
steipete/perf-micro-shared-repo-broken-tip-self-heal-20260919
Oct 8, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/perf-micro-shared-repo-broken-tip-self-heal-20260919

Conversation

@steipete

@steipete steipete commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes shared project clones that repeatedly fail to fetch because their commit graph still contains ref tips whose objects are missing. This can leave worktree creation using stale cached refs or prevent project refresh entirely.

User Impact

Worktree origin fetches and managed-project refreshes attempt one bounded repair. Recovery preserves local branches, tags, and worktree HEADs, respects dry-run and explicit no-prune requests, and records an actionable warning when it cannot finish. No OpenClaw configuration or state migration is required.

Why This Change Was Made

The existing Git owner inventories physical tips without lazy fetching or replacement lookup, prunes only safe obsolete origin tracking refs, and fetches missing objects by ID without ref updates, configured pruning, or automatic maintenance. Admission accepts the current default-branch owner's canonical origin refspec without mistaking option values for remote authority. Caller authority and isolated, URL-pinned project transport remain in force.

The repair owner carries protected-ref facts through project refresh's final publication. Both pruning and publication use command-wide no-dereference, so replacing a tracking ref with a local-branch alias cannot delete the local branch. Existing symbolic dependencies and linked-worktree HEADs retain their tracking targets.

Empty native Git locks have no PID. Reclamation uses the existing cross-process file-lock owner and requires an unchanged empty lock on a supported local Linux filesystem whose inode predates the current boot by at least one hour. Same-boot and otherwise uncertain locks remain for operator inspection. The native lock tests run only on Linux, matching this contract.

Production LOC: +500, plus two wrapper inventory entries. Growth implements the previously absent recovery contract, bounded inspection, safe publication, and positive stale-owner proof. There is no persistent health cache or new configuration. Healthy fetches do not perform recovery inventories.

Evidence

Heavy validation ran on AWS Crabbox after the configured Blacksmith Testbox lease stayed queued. No local test suites, builds, or typechecks ran on the development Mac.

  • Original-code proof on cbx_62440e921102: all three entry-point regressions failed before the fix. The candidate recovered the exact native exit-128 failure; 745 worktree/project/Git sibling tests passed, with 34 platform-specific skips. Export-name and CI test-plan guards passed.
  • Earlier cbx_ddbe1ea36620 and cbx_9f86f101d8ca runs proved lock ownership, replacement handling, pruning configuration, dry-run forms, wrapper closure, and all 27 core-test typecheck graphs. Main's unrelated unused-export defect was incorporated by rebasing onto d76f6ec, not copying it. A deliberately weakened no-dereference variant deleted a synthetic local branch and failed the race test as intended.
  • Initial hosted CI run 37850161123 exposed the newer branch-specific fetch contract on main. ClawSweeper also identified the later project-publication deletion. Both are addressed in the current candidate; neither is treated as an inherited exception.
  • Final integration proof on cbx_3c2313a41161, public base 6ae2aee, candidate tree 26e251012baf: the prior implementation failed all four new checks, then the corrected candidate passed 19 recovery tests, eight Linux lock tests, 93 current Git/project siblings, and all 20 wrapper closure assertions. Recovery took 95–130 ms. The recovery file took 4.455 s test time / 27.39 s wall time; the lock file took 0.114 s test time / 3.78 s wall time, using pnpm test <file> --maxWorkers=1.

Hosted CI run 37859157197 passed on f265b7392960 in 630 seconds overall. Its recovery file passed 19 cases in 4.422 seconds and its Linux lock file passed eight cases in 0.094 seconds. Fresh ClawSweeper review has no findings.

Independent review is scoped-clean through P2. The complete changed-file gate passed, including core types, all 27 core-test typecheck graphs, lint, export scanning, runtime import cycles, and the state/schema guards. Measurements use small local Git fixtures; production-network latency remains unmeasured. No live Gateway or production clone was modified.

@clawsweeper

clawsweeper Bot commented Oct 8, 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 scripts Repository scripts agents Agent runtime and tooling size: L labels Oct 8, 2026
@steipete
steipete marked this pull request as ready for review October 8, 2026 21:55
@steipete
steipete enabled auto-merge (squash) October 8, 2026 22:00
@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The branch repairs missing Git ref-tip objects during managed fetches and conservatively reclaims abandoned origin-tracking locks.

Example: The user starts a worktree from origin/main in a clone with missing commit-graph tips.

  • Before: Fetching exits 128, and base selection can retain the older cached commit.
  • After: OpenClaw repairs eligible tracking refs, fetches missing objects, and selects the refreshed remote commit.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation is useful and has no open findings; native-Git boundary proof is convincing but remains an in-process production harness rather than a full shipped Gateway flow.
Proof confidence 🦐 gold shrimp (3/6) Sufficient (live_output): The reported AWS runs drive the production worktree and project owners through real native Git and a local Git transport after injecting missing objects, observing successful recovery and preservation of local branches and linked HEADs. This satisfies the internal-reliability boundary proof; the unrelated screenshots add no coverage. Existing Git storage formats and OpenClaw settings remain unchanged, with preservation exercised against populated clones.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Users cannot refresh damaged shared clones, or their new worktrees start from stale cached repository state.
Reason: The patch repairs a concrete failure of existing managed-repository behavior without adding configuration or changing the public contract. The established area contributor's direction and native-Git regressions support its value.

Merge readiness

✅ Ready for maintainer review

This PR retains useful recovery work absent from current main. Both prior findings are addressed, and the current review found no additional blocking defect.

Priority: P2
Reviewed head: f265b7392960638bc82b177d6f6216d5a03585e0

Before merge

None.

Findings

None.

Agent review details

How this fits together

Managed worktrees give agent sessions isolated repository checkouts. Their Git and project-refresh owners fetch repository objects and publish remote-tracking refs before checkout preparation.

flowchart TD
  A[Worktree or project refresh] --> B[Owned Git operation]
  B --> C{Missing ref-tip failure?}
  C -->|No| D[Return normal result]
  C -->|Yes| E[Inventory refs and protect local work]
  E --> F[Repair eligible locks and missing objects]
  F --> G[Retry fetch and publish protected refs]
Loading

Technical review

Best possible solution:

Keep bounded recovery in the shared Git owner while preserving isolated project transport, local refs, and current checkout authority.

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

Yes: the real-Git fixture removes ref-tip objects after writing a commit graph and exercises worktree selection, project refresh, and pinned-commit fetch. The supplied runs report failures before repair; this read-only review did not execute them.

Is this the best way to solve the issue?

Yes: persistent missing objects require repair rather than another transport retry, and the patch keeps recovery within existing Git and checkout owners.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +500, Tests +475, Docs +19, Other +2. Total +996 across 8 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 4 537 37 +500
Tests 2 475 0 +475
Docs 1 19 0 +19
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 8 1033 37 +996

Labels

Label changes:

  • add P2: Persistent repository damage can block managed refresh or leave worktrees using stale refs, with a bounded affected surface.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Persistent repository damage can block managed refresh or leave worktrees using stale refs, with a bounded affected surface.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-08T22:05:35.198Z sha d7a77dbb22dd1c9c52f4f9dc88c071f01087e63a :: needs changes before merge. :: [P2] Admit the current remote-default fetch refspec into recovery | [P2] Preserve protected tracking refs through final project publication

Reviewed October 8, 2026, 7:28 PM ET / 23:28 UTC (Revision 2).

Recover broken shared-clone fetches in the existing Git owner with bounded physical-tip hydration and safe origin tracking-ref pruning. Preserve local refs, worktree HEADs, caller authority, and uncertain native-process outcomes; retain unsafe-to-reclaim locks with visible diagnostics.
Admit the current default-branch fetch refspec and carry protected ref facts into project publication. Use non-dereferencing publication writes, cover both production flows, and keep Linux-native lock tests on Linux.
@steipete
steipete force-pushed the steipete/perf-micro-shared-repo-broken-tip-self-heal-20260919 branch from d7a77db to f265b73 Compare October 8, 2026 23:23
@steipete

steipete commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both findings in f265b73 after rebasing onto current main. Recovery now admits the default-branch owner's canonical refspec without accepting arbitrary option values as remote authority. The repair owner's protected-ref facts survive staged project fetch and final publication, and publication uses command-wide no-dereference.

The prior implementation failed all four integration regressions; the corrected candidate passed all 19 recovery cases, eight Linux lock cases, 93 current Git/project siblings, both wrapper closure suites, and the complete changed-file gate on AWS lease cbx_3c2313a41161. The candidate tree was verified byte-for-byte. The PR body contains the timings and remaining lock-reclamation limits. Independent review is scoped-clean through P2.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 8, 2026
@steipete
steipete merged commit 290266a into main Oct 8, 2026
161 of 163 checks passed
@steipete
steipete deleted the steipete/perf-micro-shared-repo-broken-tip-self-heal-20260919 branch October 8, 2026 23:35
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 9, 2026
…#167473)

* fix(worktrees): heal fetches with missing commit-graph tips

Recover broken shared-clone fetches in the existing Git owner with bounded physical-tip hydration and safe origin tracking-ref pruning. Preserve local refs, worktree HEADs, caller authority, and uncertain native-process outcomes; retain unsafe-to-reclaim locks with visible diagnostics.

* fix(worktrees): retain recovery protections through publication

Admit the current default-branch fetch refspec and carry protected ref facts into project publication. Use non-dereferencing publication writes, cover both production flows, and keep Linux-native lock tests on Linux.
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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

1 participant