Skip to content

perf(github): avoid repeated publication commit fetches - #183799

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-project-repo-pack-growth-20260919
Oct 25, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-project-repo-pack-growth-20260919

Conversation

@steipete

@steipete steipete commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Publication and base refresh fetch immutable commits that are already local. In a partial clone, fetching a non-promisor commit can start a connectivity walk that enumerates every promisor object and all refs, consuming substantial memory and CPU even when no objects need downloading.

User Impact

Repeated publication/base preparation reuses the exact local commit. Missing commits still fetch from the selected authenticated repository; requested missing contents still hydrate. There is no configuration, schema, scheduler, or repository-maintenance change.

Why This Change Was Made

The publication transport now checks physical commit presence without lazy fetching or commit-graph substitution, using the existing project-clone owner's Git probe. Callers with a prepared commitPresent fact keep avoiding that probe. This removes unnecessary transfer/connectivity work at its owner without adding cached state.

Pack consolidation already exists in #182204, but does not eliminate Git's object-count-dependent promisor enumeration. This change does not delete externally created refs/remotes or claim to bound a genuinely new commit fetch.

Evidence

Synthetic real-Git fixture: 258 promisor packs, 524,288 blobs, 15,000 refs, 16 MiB payload; Git 2.56.0; five samples per revision in counterbalanced ABABA/BABAB order. The committed script invokes the actual publication owner against a local file remote. Host 1-minute load was 9.62–10.02.

Metric Base Candidate
Median owner wall time 94.949 ms 27.374 ms
Wall-time range 86.611–96.440 ms 25.080–43.142 ms
Median Git CPU 70 ms 10 ms
Median largest-process RSS 91.875 MiB 17.109 MiB
Fetch/connectivity children per operation 1 / 1 0 / 0

CPU resolution is 10 ms; RSS is largest-process rusage, not an aggregate process-tree total. Replaying the exact traced connectivity child separately gave median 73.921 ms wall, 60 ms CPU, and 91.859–93.922 MiB RSS. The candidate does not start that child. These small synthetic objects reproduce the mechanism, not a production repository's absolute memory usage.

Validation: the real partial-clone regression fails on base (one fetch instead of zero). All 41 focused tests pass across github-publication-git-index.test.ts, github-publication-base-refresh-actions.test.ts, and github-publication.test.ts (76.42 s wrapper wall; includes existing hydration, cancellation, recovery, and publication proof). Changed-file formatting/lint and export-name collision guard pass. Independent subagent review (autoreview route unavailable): no actionable P0/P1/P2 findings; configured route mismatch was left unchanged.

Production delta: +18/-1 lines (+17 net). The retained missing-commit fetch and missing-content hydration contracts require the new local-presence branch; no parallel transfer implementation or new cache is added. Regression +52 lines; benchmark usage is in its own header.

Gateway stress

Completed the canonical #183101 harness from tooling after ed32fdc against built main ffea090901760fd50c088c0255f8819ae8c0e764 and PR abe669c35de687b547f26a8a64f15bf3511c77d3: 10,800 sessions, 40 plugins, 65 WebSocket clients, four concurrent mock-provider turns per round, tool calls, native subagents, and sidebar/list/search churn. Two AB/BA timing pairs and two allocation pairs, ten measured minutes per arm. All twelve successful A/B and A/A arms completed 40 turns, 40 tool calls and 40 tool results each.

The final allocation baseline initially failed before measurement because its listener did not become ready. Its process exited; the missing baseline was recovered with the canonical single-build allocation mode, identical baseline entry fingerprint, seed and fixture timestamp. The startup failure and gap are retained as limitations, not counted as a measured run. No successful window was excluded, no maintenance pauses were trimmed, and no startup timeout or workload setting was weakened.

Across the two A/B timing-arm means: main-thread CPU 8.60→8.48%, GC 0.188→0.160 s/min, loop p99 33.03→33.75 ms (+0.72 ms), RSS 2624.4→2668.3 MiB (+43.9 MiB, +1.7%), and heap 700.4→681.9 MiB. Separate sampled allocation means were 31.18→29.66 MiB/s (−4.9%; each pair lower). These broad-workload differences are descriptive, not a claim that the Git change accelerated unrelated RPCs.

Client list p99 means rose 98.34→140.07 ms, and server-handler histogram p99 means rose 81.21→120.49 ms. Latency is inconclusive under host contention. Two full identical-baseline timing pairs were declared after the A/B timing results and completed before the landing decision. Identical code produced list p99 149.54–990.66 ms, server-handler p99 118.92–1033.75 ms, and loop p99 33.75–111.80 ms; per-arm mean host load ranged 25.83–85.18. A/A paired server-tail changes were +8.33 and −880.38 ms, far larger and mixed-sign compared with the A/B mean +39.28 ms. This protocol cannot establish a latency regression or improvement. No rejection is based on client tails alone, and the broad result is not described as latency-neutral.

Landing rationale: the real publication-owner proof removes a fetch and its connectivity child on every already-present commit, cutting median Git CPU 85.7%, largest-process RSS 81.4%, and owner wall time 71.2%, with preserved missing-commit/content behavior and +17 production lines. The full Gateway workload completed, CPU/GC did not show a consistent adverse A/B change, and the A/A controls expose the tail-measurement limitation. Historic pack growth and genuinely new-commit fetch cost remain outside this fix.

All stress arms, host load, tail sample counts and GC maxima

Base/candidate

Mode/pair/arm Main CPU % Allocation MiB/s GC s/min Loop p99 ms (n) List p99 ms (n) Handler p99 ms (n) RSS / heap MiB Host load mean [min–max]
timing 1 base 7.41 — 0.148 29.85 (28662) 43.74 (1186) 30.67 (1173) 2613.2 / 707.0 10.28 [6.77–17.64]
timing 1 candidate 7.96 — 0.149 32.41 (28561) 99.97 (1186) 86.49 (1173) 2689.4 / 693.6 21.14 [7.93–29.98]
timing 2 candidate 9.00 — 0.172 35.09 (28187) 180.17 (1191) 154.50 (1173) 2647.2 / 670.1 27.45 [17.70–43.32]
timing 2 base 9.78 — 0.227 36.21 (27834) 152.94 (1193) 131.75 (1173) 2635.7 / 693.9 38.47 [22.34–52.11]
allocation 1 base 10.45 30.52 0.427 41.55 (27528) 892.86 (1187) 375.67 (1173) 2656.1 / 662.9 40.52 [27.06–90.61]
allocation 1 candidate 9.53 29.82 0.343 36.54 (27548) 116.24 (1198) 92.70 (1173) 2639.1 / 643.1 29.77 [15.01–43.88]
allocation 2 candidate 12.16 29.50 1.121 166.07 (21499) 2204.97 (1193) 2067.50 (1173) 2793.1 / 693.3 66.78 [42.89–91.36]
allocation 2 base 12.71 31.84 1.143 145.36 (22300) 2094.49 (1195) 1817.50 (1173) 2736.6 / 706.3 79.40 [48.60–108.94]

Handler tails are interpolated from server Prometheus histogram bucket deltas. Timing runs are untraced; allocation-pass latency is context only. Host load is sampled every 30 seconds during each measurement window.

Timing pair/arm Minor count / total ms / max ms Major count / total ms / max ms Incremental count / total ms / max ms Loop p95 / max ms
1 base 591 / 982.6 / 62.50 22 / 482.8 / 42.58 22 / 17.3 / 1.35 21.77 / 119.73
1 candidate 576 / 1044.1 / 20.71 19 / 431.3 / 38.63 19 / 15.5 / 0.97 22.41 / 164.23
2 candidate 578 / 1197.4 / 18.62 20 / 511.4 / 40.71 20 / 17.1 / 1.15 23.67 / 226.62
2 base 631 / 1550.6 / 39.60 26 / 696.1 / 63.91 26 / 23.4 / 1.52 24.94 / 211.42

Major-GC tails are context only: fewer than 50 collections per arm. Minor-GC p99 also has fewer than 1,000 samples per arm; total GC time remains the relevant comparison.

Identical-baseline control

Mode/pair/arm Main CPU % Allocation MiB/s GC s/min Loop p99 ms (n) List p99 ms (n) Handler p99 ms (n) RSS / heap MiB Host load mean [min–max]
timing 1 base 8.79 — 0.176 33.75 (27906) 201.70 (1195) 118.92 (1173) 2756.5 / 693.0 29.27 [19.81–38.08]
timing 1 candidate 8.92 — 0.239 37.32 (27354) 149.54 (1195) 127.25 (1173) 2646.1 / 678.5 25.88 [9.57–46.40]
timing 2 candidate 9.09 — 0.229 40.27 (27543) 187.82 (1194) 153.37 (1173) 2821.2 / 639.3 25.83 [12.82–49.12]
timing 2 base 11.75 — 0.943 111.80 (23417) 990.66 (1202) 1033.75 (1173) 2822.9 / 775.1 85.18 [71.06–108.96]

Handler tails are interpolated from server Prometheus histogram bucket deltas. Timing runs are untraced; allocation-pass latency is context only. Host load is sampled every 30 seconds during each measurement window.

Timing pair/arm Minor count / total ms / max ms Major count / total ms / max ms Incremental count / total ms / max ms Loop p95 / max ms
1 base 588 / 1202.5 / 38.21 19 / 541.0 / 71.63 19 / 17.5 / 1.18 23.87 / 561.51
1 candidate 721 / 1629.2 / 130.83 27 / 740.2 / 63.80 27 / 24.3 / 1.85 24.84 / 415.24
2 candidate 592 / 1606.6 / 115.78 20 / 668.4 / 126.19 20 / 21.4 / 3.89 24.22 / 301.47
2 base 663 / 7640.8 / 219.49 19 / 1762.9 / 372.09 19 / 21.6 / 1.92 43.45 / 1048.58

Major-GC tails are context only: fewer than 50 collections per arm. Minor-GC p99 also has fewer than 1,000 samples per arm; total GC time remains the relevant comparison.

Timing stall-event counts in execution order were 0/6/7/3 for A/B and 5/15/24/200 for A/A; allocation-pass counts were 49/25/392/313. These events are retained, not filtered. Sampled allocation instrumentation affects timing, so its latency/GC rows are context rather than the untraced timing gate.

Final validation

Exact-head CI passed: CI, build artifacts, and security review. No CI reruns were requested. Source-closure checks: 22 passed. Existing managed Git maintenance performance tests: 16 passed, 1 skipped; this change does not alter maintenance bounds, interruption behavior or locking. One targeted scripts typecheck passed. No Testbox lease was used; focused local checks and PR CI supplied validation.

@clawsweeper

clawsweeper Bot commented Oct 25, 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 marked this pull request as ready for review October 25, 2026 19:34
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts size: M labels Oct 25, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T19:36:48.158780Z abe669c Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 25, 2026
@clawsweeper

clawsweeper Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Skip publication commit fetches when the exact commit is physically present locally, while retaining missing-commit fetches and requested content hydration.

Example: Prepare an already-local commit in the reported synthetic partial clone containing 524,288 blobs and 15,000 refs.

  • Before: Preparation launches one fetch and one connectivity child.
  • After: Preparation launches neither child; reported median owner time falls from 94.949 ms to 27.374 ms.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused production-owner measurements support the optimization, with confidence limited to the exercised synthetic workload.
Proof confidence 🦐 gold shrimp (3/6) Sufficient (live_output): The committed benchmark invokes the production publication owner with real Git and a synthetic file remote; reported after-fix traces eliminate fetch/connectivity children, supported by a real-Git absent-commit regression.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Repeated publication and base refresh can consume unnecessary CPU and memory despite already having the requested commit.
Reason: The maintainer-authored direction removes measured redundant work through the existing owner without changing configuration or adding persistent state.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR removes measurable redundant Git work at the existing transport owner, and no actionable correctness or security defect was found.

Priority: P2
Reviewed head: abe669c35de687b547f26a8a64f15bf3511c77d3

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The author's requested Gateway stress campaign remains pending before merge.
Agent review details

How this fits together

The Gateway publication transport receives a selected repository and immutable commit, prepares local Git objects, and supplies publication and sandbox base-refresh operations.

flowchart TD
  A[Publication or base refresh] --> B[Guarded Git transport]
  B --> C[Physical commit probe]
  C --> D[Fetch absent commit]
  C --> E[Prepare requested contents]
  D --> E
  E --> F[Publication or workspace integration]
Loading

Technical review

Best possible solution:

Retain the narrow physical-presence check in the existing publication transport and preserve its authenticated fetch and content-hydration contracts.

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

Current main visibly performs the redundant fetch, and the PR supplies a committed real-Git reproducer with before/after measurements; no target code was executed during this review.

Is this the best way to solve the issue?

This is a focused owner-level repair: it reuses an established physical-presence probe, adds no cache, and leaves missing-object preparation intact.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 2c8189c adds src/gateway/github-publication-git-transport.ts:61 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2c8189c63d3f; files: src/gateway/github-publication-git-transport.ts)
  • Shakker: Raw commit ac5faa4 adds src/gateway/github-publication-git-transport.ts:180 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ac5faa479233; files: src/gateway/github-publication-git-transport.ts)

PR surface

Source +17, Tests +52, Docs +3, Other +285. Total +357 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 18 1 +17
Tests 1 52 0 +52
Docs 1 3 0 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 1 285 0 +285
Total 4 358 1 +357

Labels

Label changes:

  • add P2: Redundant publication fetches impose demonstrated CPU and memory costs in partial clones without establishing an urgent availability incident.
  • 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: Redundant publication fetches impose demonstrated CPU and memory costs in partial clones without establishing an urgent availability incident.
  • 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 execution lanes are retired.

Reviewed October 25, 2026, 3:50 PM ET / 19:50 UTC.

@steipete
steipete merged commit db90233 into main Oct 25, 2026
222 of 225 checks passed
@steipete
steipete deleted the steipete/perf-micro-project-repo-pack-growth-20260919 branch October 25, 2026 22:41
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime 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: M 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