Skip to content

fix: avoid long pauses after workspace objects finish downloading - #197081

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-micro-base-hydration-refetch-critical-path-20260919
Nov 11, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-micro-base-hydration-refetch-critical-path-20260919

Conversation

@steipete

@steipete steipete commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an avoidable pause after Git finishes downloading the objects needed to prepare a workspace in a fragmented partial clone.

User Impact

Workspace preparation skips unused fetch-summary work. Object selection, checkout completeness, fetch repair, cancellation, and promisor behavior are unchanged.

Why This Change Was Made

Git computes unique object-name abbreviations for its fetch summary even for an object-only fetch that ultimately prints no useful summary. With tens of thousands of requested objects and many pack indexes, this can dominate the fetch after indexing finishes. Run explicit hydration with --quiet, and admit that flag through the existing repair parser. Production LOC delta: 0; no new cache, configuration option, background task, or schema.

This change does not deduplicate stale missing-object inventories. Default-base preparation already shares pending requests; lower-level stale-batch replays can still transfer the same objects. It also does not establish the cause of a particular production network stall.

Evidence

Acceptance rule, recorded before the controlled owner campaign: use the actual hydrateCommitObjects owner with native Git and a local synthetic remote; 62,000 target paths, approximately 1.14 GB logical baseline, 600,000 historical blobs, 13,000 session refs and 1,503 packs. Compare 85- and 58,523-OID batches, including immediate identical replays. Run five counterbalanced A/B pairs and five A/A pairs per shape, serially. Require identical requested/transferred objects and bytes, reduced large-batch wall/native CPU, and no unexplained >20% owner regression. Report JS CPU/exact V8 allocation separately from native Git CPU/RSS. Fixture setup, imports and copying are excluded.

Exploratory native diagnostic: 58,523-object fetch 26.071 → 7.406 s, immediate identical replay 21.119 → 3.946 s, with the same transfers. Trace2 places about 18 seconds of the original fetch after transfer and ref consumption. These are diagnostic samples, not the final acceptance distribution.

Focused owner tests: 105 passed across capacity, base-ref, git-fetch and relevant snapshot/removal cases. The new repair case fails on the parent with exit 128, and passes with quiet-fetch repair support. Test lines are unchanged. No Control UI imports of the changed production modules were found. Codex autoreview is scoped-clean through P2.

Controlled campaign completed: five counterbalanced A/B pairs and five A/A pairs per shape. Each sample performs initial hydration plus an identical stale-inventory replay. Values below are median / p95 (five samples, so p95 is the maximum); CPU and allocation cover the pair. Native CPU includes the local Git server.

Shape / metric Before median / p95 After median / p95 A/A median drift
small / initial_ms 1371.064 / 1498.618 1281.771 / 1286.772 -1.63%
small / replay_ms 1128.102 / 1151.719 1054.988 / 1236.935 +1.10%
small / pair_ms 2516.510 / 2623.175 2336.762 / 2523.710 -0.48%
small / native_cpu_ms 4060.000 / 4080.000 3890.000 / 4200.000 -0.50%
small / js_cpu_ms 202.001 / 207.904 190.122 / 193.468 +1.26%
small / v8_allocated_mib 71.444 / 72.267 68.553 / 72.241 -1.26%
small / native_peak_rss_mib 49.797 / 60.812 52.609 / 67.953 -2.85%
large / initial_ms 24009.336 / 24830.374 7330.531 / 8014.944 +2.42%
large / replay_ms 19447.836 / 20072.565 3416.539 / 3565.906 -2.47%
large / pair_ms 43225.486 / 44561.303 10747.071 / 11580.852 -0.32%
large / native_cpu_ms 52450.000 / 54310.000 20500.000 / 22380.000 -1.01%
large / js_cpu_ms 186.864 / 232.884 190.806 / 194.391 -5.08%
large / v8_allocated_mib 99.866 / 103.010 98.606 / 103.330 +5.32%
large / native_peak_rss_mib 150.141 / 150.531 149.828 / 150.250 +0.19%

All samples transferred identical object counts and bytes: small 170 objects / 53,778,672 bytes per pair; large 117,046 objects / 4,887,822 bytes. Both versions perform two fetches. Small peak native RSS increased 5.6% at the median / 11.7% at p95; large RSS and V8 allocation stayed approximately flat. The acceptance threshold passed. This is a large-batch CPU improvement, not proof of production network latency.

Reproduce on macOS with Git 2.56 and Node 26: save the parent's src/agents/worktrees/object-hydration.ts, run python3 scripts/perf/worktree-hydration-refetch-measure.py --prepare <fixture>, then --measure <fixture> --output <results> --base-file <saved-owner> --pairs 5. Raw timings, native CPU/RSS receipts and Trace2 transfers are emitted per sample.

pnpm check:changed failed only the unused-export check: the exact parent 84a72ed32320a44ac161e1e0be4f858d44861b3c reproduces the identical 56 production / 31 full-tree / 0 script findings. All other changed-file guards, types, lint and format passed. The separate standalone-command unused-file check reports zero production findings and three identical parent findings. Newly identified main regressions: knowledge exports (#196767, 9b7dcdc7a66dc), rebind/tunnel exports (#196388, 5f2f21a7ee19), sidebar export (#196456, 65c2e61b164e), and missing Knip entrypoint registration (#196685, 8743f1bfafa4; #196501, 09723cdcad18). These aggregate checks are not claimed green.

Local file://, macOS/APFS proof does not reproduce production network latency, btrfs, or a large agent database; the measured Git phase does not read that database.

Object-only refetches spend time abbreviating requested object names for an unused summary after indexing. Run hydration quietly while preserving repair support and the existing object, authority, and cancellation contracts. Add a reproducible fragmented-clone owner benchmark; stale-batch deduplication remains separate.
@clawsweeper

clawsweeper Bot commented Nov 11, 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 scripts Repository scripts agents Agent runtime and tooling size: S labels Nov 11, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment 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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 11, 2026
@clawsweeper

clawsweeper Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR makes workspace object hydration fetch quietly while preserving automatic fetch repair.

Example: Preparing a fragmented partial clone requires fetching 58,523 objects.

  • Before: Git computes unique object abbreviations for an unused fetch summary after downloading the objects.
  • After: Quiet hydration skips that summary computation while requesting the same objects.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused implementation is sound on inspection, but performance acceptance and validation remain incomplete.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Workspace preparation can pause after object downloading finishes in a fragmented partial clone.
Reason: The maintainer-authored direction removes unused native work with a minimal production change and preserves existing behavior.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it removes a source-verified Git bottleneck with a focused production change and no identified correctness defects; the author explicitly keeps it in draft.

Priority: P2
Reviewed head: 8a0aae4a85b728b2b8baccce88a4cc67f5f0447a

Before merge

None.

Findings

None.

Provenance

  • Historical source coverage: original intent not found (unknown: Scoped git log -G and a historical git show --stat encountered unavailable promisor blobs; readable current source, blame, commit messages, and linked PR bodies establish the relevant contracts.)

Tests

  • Missing end-to-end proof: Complete the declared native-Git hydration-owner comparison for small and large batches and immediate replays, retaining object/byte equivalence and resource measurements.
Agent review details

How this fits together

Managed workspace sizing and snapshot preparation share the object hydrator, which passes missing object IDs to the existing Git execution and repair owners.

flowchart TD
  A[Workspace preparation] --> C[Shared object hydrator]
  B[Snapshot preparation] --> C
  C --> D[Git execution and repair]
  D --> E[Promisor remote]
  E --> F[Local checkout objects]
Loading

Technical review

Best possible solution:

Retain quiet fetching in the shared hydrator and its existing repair parser, then complete the declared performance acceptance campaign.

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

Current main invokes the native Git path that computes unused abbreviations, and the body reports matching exploratory measurements; this read-only review did not execute a reproduction.

Is this the best way to solve the issue?

The patch removes the unnecessary work at the shared owner and preserves repair eligibility; the measurement tooling extends existing fixtures without introducing production state or a competing implementation.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit c45ec21 adds src/agents/worktrees/object-hydration.ts:72 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c45ec219c40e; files: src/agents/worktrees/object-hydration.ts)
  • RoboClaw: Raw commit a583332 adds src/agents/worktrees/object-hydration.ts:59 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a583332bd0a1; files: src/agents/worktrees/object-hydration.ts)

PR surface

Source 0, Tests 0, Other +176. Total +176 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 3 3 0
Tests 1 4 4 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 179 3 +176
Total 5 186 10 +176

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: Avoidable workspace preparation latency affects fragmented partial clones, with no demonstrated outage or data loss.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish 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: Avoidable workspace preparation latency affects fragmented partial clones, with no demonstrated outage or data loss.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Publish the completed controlled hydration-owner campaign against its recorded acceptance rule.

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 November 11, 2026, 1:40 AM ET / 06:40 UTC.

@steipete
steipete marked this pull request as ready for review November 11, 2026 06:48
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T06:51:16.316086Z 8a0aae4 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.

@steipete
steipete merged commit e9fcf00 into main Nov 11, 2026
226 of 229 checks passed
@steipete
steipete deleted the steipete/perf-micro-base-hydration-refetch-critical-path-20260919 branch November 11, 2026 07:01
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 12, 2026
Object-only refetches spend time abbreviating requested object names for an unused summary after indexing. Run hydration quietly while preserving repair support and the existing object, authority, and cancellation contracts. Add a reproducible fragmented-clone owner benchmark; stale-batch deduplication remains separate.
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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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