Repository navigation
fix: reduce GitHub publication delays in fragmented clones - #195488
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review endedClawSweeper stopped reviewing this revision because the pull request closed. |
steipete
marked this pull request as ready for review
November 9, 2026 01:01
Contributor
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 9, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Fixes slow Control UI GitHub publication actions when a managed repository has thousands of refs and fragmented packs, even when fetching only a few new objects.
User Impact
Repeated publication acquisitions avoid Git's scan of unrelated session histories while preserving commit ancestry, trees, content hydration and shallow boundaries. No configuration or operator action is required. The first filtered fetch for a new publication URL retains Git's normal source-side promisor registration; acquisition without a cached base retains normal common-history discovery.
This improves the metadata acquisition phase. Content hydration remains a separate fetch when needed. Temporary metadata adds some JavaScript CPU and allocation; those costs are disclosed below and require owner acceptance before landing. This PR is intentionally unmerged.
Why This Change Was Made
The expensive phase is
fetch-pack: mark_complete_local_refs, before negotiation. The negotiation tips from #195413 limit offered haves but do not remove that ref census. Publication now reuses the existing project-refresh transport: temporary bare Git metadata, copied shallow boundaries, and direct access to the authoritative object directory. Explicit cached-base tips preserve incremental negotiation. There are no pack copies, permanent alternates, new caches, configuration options, or ref-pruning policies.The shared helper replaces the private project-refresh implementation and remains responsible for native initialization, shallow metadata and cleanup, including uncertain child-process settlement. Publication stages only after the exact URL is already a registered promisor. Codex review caught the importance of that condition: otherwise an ordinary full clone, or a different fork URL, could receive missing blobs without a persistent source-side promisor for later lazy hydration. The regression now exercises that case through real Git.
MIDX rebuilding is not restored: #182204 intentionally superseded #165858's whole-repository repair because it escaped maintenance budgets. Git ignores commit graphs while shallow. Blanket ref deletion would discard refs whose owning lifecycle has not established staleness.
Evidence
Synthetic local Git only; no production access or data. Parent:
e673256f8a9351607912329020857906643a1c1c.The committed fixture generates 13,536 refs, 1,609 packs, 263,693 packed objects, two shallow roots, blob:none and three stale commit-graph layers, without a MIDX. Git 2.56.0, Apple Silicon/APFS, file transport. It deliberately does not reproduce 800 million entries, thousands of linked worktrees, btrfs or application database size. Linked-worktree behavior is covered by the native regression.
Five native samples per arm; p95 is the maximum. Staging setup is excluded here and included in the actual-owner measurements below.
The ordinary-alternates 21.5-second result is mainly negotiation (18.8 seconds), not completeness. Native A/A median drift was 2.98%. Large MIDX/A/A outliers are retained; five samples on a loaded host do not establish precise tail behavior. Both shallow graph writes returned success without changing the graph. A separate missing-parent nonshallow fixture failed both reachable and stdin-packs graph writes.
MIDX write on this small fixture took 170 ms wall / 150 ms CPU / 49.8 MiB RSS. At 800 million SHA-1 pack entries, index input alone is roughly 22.4 GB. Output and retained entry memory depend on unique objects, not duplicated pack entries: about 28 and 64 bytes per unique OID respectively, before allocator/sort/mapping overhead. Crude scaling from the small fixture gives minutes, not a request-safe bound; it does not justify reintroducing an unbounded maintenance rewrite.
Actual-owner proof uses the committed
publication-fetch-measure.ts, warmed spawn broker and real publication owner, rewriting only the synthetic GitHub URL to the file remote. Point the fixture'sseedsymlink at itsbasedirectory; save the parent's transport module for--base-file.Use
--base-file <parent-transport.ts>for A and--allocationfor separate heap-sampling runs. Acceptance: remove unrelated-ref reads, preserve ancestry/content and received-object counts, and reduce owner wall/native CPU while disclosing setup overhead.Five final counterbalanced A/B pairs and five separate allocation pairs, with changed-file/type/review checks active on the host (load approximately 17–26):
Both versions made two fetches, received three objects / 290 installed pack bytes, and offered one have. Completeness median: 715.491 → 0.123 ms. Median owner wall improves 52.6%, native CPU 62.5%, native RSS 47.0%. The cost is +11.07 ms JS CPU and +1.51 MiB sampled allocation per absent commit; the present-commit fast path is unchanged. This is a material measured tradeoff, not an all-metrics improvement.
Prior A/A controls on the unchanged baseline: median wall 1687 versus 1666 ms (1.25% drift), completeness 771.8 versus 786.5 ms. A retained 8582 ms A/A outlier and the final baseline 3847 ms and candidate 2409 ms outliers limit tail conclusions. Native CPU includes local upload-pack children. Node CPU profiles and Git Trace2 were collected; no claim of production endpoint timing or main-thread stall elimination is made.
The real-Git regression fails on the pinned parent in both full and shallow modes because acquisition reads an unrelated session pack. The corrected owner suite passes 24 tests, including a linked worktree, uncached-base discovery and ordinary full-clone lazy hydration. The final frozen-source run passes 32 suites / 604 tests, with 23 existing skips, including all 28 publication suites (523 passing tests), project clone/runtime/registry, native fetch and Doctor clone-shape coverage:
pnpm check:changed --base e673256f8a9351607912329020857906643a1c1cpasses all checks except the inherited changelog-attribution gate described below. Core/test/script types, lint, format, production/full-tree Knip, SQLite and other guards pass. The separate test-line ratchet passes without an allocation increase.Final-source Codex autoreview is clean at P0–P2 after fixing the promisor-registration issue and checking buffered cleanup propagation, including the optional-Error narrowing required by lint. The measurement source is pinned; a final-source smoke after that narrowing preserves 2 fetches/3 objects/1 have and measures 0.115 ms completeness.
Known inherited gate: changelog attribution rejects 20 existing automation-credit lines on exported exact-parent inputs. The current policy is from #194364 (
266a7aa0fe69e2b5fe6445c4ceb1e15b5360c957). The preceding policy also fails on different human-credit lines; this is an unresolved main gate, not a passing check or a PR-caused change.Production delta: +51 net lines: the shared helper replaces the project-only staging implementation; remaining growth preserves native Git initialization/cleanup, source promisor registration and no-tip discovery. Tests: +33 net lines, extending the existing real-Git case; no new test allocation is needed (6,588,335 lines against a 6,588,350 ceiling). No Control UI-imported module changed.