Skip to content

fix: avoid oversized downloads during cold PR preparation - #188785

Merged
shakkernerd merged 2 commits into
mainfrom
guest-pr-cold-history-fetch
Oct 31, 2026
Merged

shakkernerd merged 2 commits into
mainfrom
guest-pr-cold-history-fetch

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Closes #188764.

What Problem This Solves

Cold preparation of an existing pull request downloads unrelated historical file versions before the workspace can use the PR's current files. On a large repository, this transfer can exhaust the fetch command's budget. A fork's separately fetched base can cause the same waste when it advances after the selected project snapshot.

User Impact

Preparing a PR in an empty workspace or an existing project retains its history and required current files while avoiding unused historical blobs. Ancestry-dependent review, integration and publication continue to work. Command deadlines, retries, credentials and workspace authority are unchanged.

Why This Change Was Made

The existing transport separates commit availability from current-file hydration. Every absent-commit fetch now requests blobless history, retaining commits and tree metadata for ancestry and workflow checks. Callers that need files continue through the existing explicit missing-object hydration. Keeping this selection in the shared owner also covers ancestry-only preparation callers without adding a new mode or downloading their unused tip contents.

The registered-action regression covers empty and selected-project sources with distinct fork/base URLs and an advanced base. It verifies that obsolete PR and base blobs stay absent while the required contents and history remain complete. The existing publication-history fixture now preserves the actual fetch arguments, and its normal publication case performs a native push from a cold metadata-only base with lazy fetching disabled. The 100 added test lines have an exact dedicated allocation; the shared baseline is unchanged.

Evidence

The unchanged production baseline reproduced the cold fetch timeout at 60.034 seconds with no completed pack. The original registered-action regression failed because an obsolete PR blob was downloaded. A separate registered-action probe exposed the same problem in the cold fork-base path before the completed correction.

The final tree passed changed-file formatting and lint, all selected production/test/consumer type checks, and 268 tests across 17 files. One existing opt-in real Podman test was skipped. The cases include non-shallow ancestry, exact current-tree completeness, distinct fork/base histories, populated reuse without fetching, merge-base hydration, retry/cancellation, and native publication without implicitly fetching the target base's file contents. The affected-test runs took 472.8 seconds in total across six native test invocations, including their existing setup and transformation work; this is not the added cases' isolated cost.

Retained large-repository owner proof completed the identical contents-hydration path in 19.502 seconds for history and 39.591 seconds for current blobs: 122,203 reachable commits, no shallow boundary, and zero missing current objects. Populated reuse took 47 ms without a fetch. These are scoped reproductions, not a general latency benchmark. The final correction preserves that path's arguments and hydration behavior; the metadata-only callers have the separate final-tree proof above.

A real Gateway running the qualified combined source 0d70033ab4b8994471689cafeff9fe7a3c7b8879, including this exact PR head 3fc5b0d02425dcbdf8271bad55434e189c17bb56, also completed natural PR preparation in an existing guest conversation. A current maintainer prepared a foreign-authored fixture from the native empty source; the normal model/tool action returned status: prepared and headChanged: false. The guest's creator, sandbox requirement, original PR head and branch were preserved, and GitHub was unchanged.

A read-only observer identified the actual receiver before the fetch and tracked the same physical Git common directory through completion, with lazy fetching disabled and no alternates. Before fetching, the requested head, base and all five controlled file versions were absent. When the head and base first arrived, all five blobs were still absent. After preparation, all 12 ancestry commits and all 10 current-tree blobs were present; the current file version was hydrated, while all four obsolete versions remained absent. No objects were deleted and no delay or synthetic caller was introduced. This is direct cold-path evidence, separate from the large-repository timing above.

The live recording has a gap during the asynchronous handoff; a continuation captures the settled result, and no request was replayed. The native completion and physical object observations establish the transfer behavior. No visual latency comparison is claimed for this small fixture.

The independent recheck and current-head automated re-review are clean, and exact-head hosted CI passed. On receiving main ef2feab6ddae, the original registered-action regression still failed specifically at obsolete-blob absence, with the other 22 tests passing. The exact proposed merge then passed 64 tests across preparation, native publication and refresh/hydration suites using that target's locked dependencies. The earlier large-repository timings remain scoped to their original execution environment.

@clawsweeper

clawsweeper Bot commented Oct 30, 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 gateway Gateway runtime size: XS labels Oct 30, 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 Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR fetches commit history without historical file blobs, then hydrates required files through the existing transport.

Example: Prepare a fork PR whose pr.txt changes from obsolete PR contents to current PR contents.

  • Before: The cold fetch also downloads the obsolete file version, potentially exhausting the fetch budget.
  • After: Preparation retains complete ancestry and current files while leaving the obsolete blob absent.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, minimal repair supported by reported shipped-path observations, distinct real-Git regressions, and successful exact-head CI.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR records after-fix output from a real Gateway's normal model/tool preparation on source containing the exact head: preparation completed, all 12 ancestry commits and 10 current-tree blobs were available, and four obsolete versions stayed absent; these detailed live results address the prior rank-up request without relying on the unlinked recording.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Preparing an existing PR can download unrelated historical contents and fail before its current files become available.
Reason: The maintainer-authored direction restores the existing preparation contract with a minimal shared-owner change.

Merge readiness

✅ Ready for maintainer review

This PR addresses a current cold-preparation defect with a focused shared-transport fix; no actionable correctness or security findings remain.

Priority: P2
Reviewed head: 3fc5b0d02425dcbdf8271bad55434e189c17bb56

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Gateway's GitHub publication transport receives authenticated repository and commit selections and supplies Git objects for workspace preparation, base integration, review, and publication.

flowchart TD
  A[GitHub action] --> B[Workspace or publication owner]
  B --> C[Shared Git transport]
  C --> D[Blobless commit and tree fetch]
  D --> E[Explicit required file hydration]
  E --> F[Prepared workspace and review base]
  D --> G[Ancestry and workflow checks]
Loading

Technical review

Best possible solution:

Use the existing shared transport to fetch blobless history and explicitly hydrate only the tree versions each consumer requires.

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

Current-main source shows the unrestricted cold fetch, and the linked report documents a deterministic real-Git obsolete-blob reproduction; no target code was executed during this review.

Is this the best way to solve the issue?

This is the smallest complete repair: change object selection at the existing transport owner while preserving explicit hydration, full ancestry, and populated reuse.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Commit fetching and explicit content hydration keeps the original intent (ac5faa4: Prepare missing selected-tip and merge-base contents through authenticated transport before offline integration.)
  • Physical local-commit reuse keeps the original intent (db90233: Avoid unnecessary fetches and promisor connectivity walks for immutable commits already present locally.)
  • Publication-history regression fixture keeps the original intent (02dc7fe: Reject remote divergence before changing local history and reuse unchanged attributed publications.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Shakker: Raw commit ac5faa4 adds src/gateway/github-publication-git-transport.ts:150 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 +1, Tests +100, Other +2. Total +103 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 2 1 +1
Tests 2 106 6 +100
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 4 110 7 +103

Review metrics

Metric Value Why it matters
Production versus regression growth Production +2/-1 lines; tests +106/-6 lines The regression growth protects distinct preparation and publication consumers using existing fixtures, without adding production machinery.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: Unnecessary downloads can prevent cold PR preparation on large repositories, with limited demonstrated blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-30T22:48:14.702Z sha de56b85 :: needs maintainer review before merge. :: none

Reviewed October 30, 2026, 9:36 PM ET / October 31, 2026, 01:36 UTC (Revision 2).

@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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 Oct 31, 2026
@shakkernerd
shakkernerd merged commit ec52f22 into main Oct 31, 2026
161 checks passed
@shakkernerd
shakkernerd deleted the guest-pr-cold-history-fetch branch October 31, 2026 01:50
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: cold PR preparation preserves ancestry while avoiding unused historical file downloads.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
…88785)

Fetch publication ancestry without unrelated historical blobs and hydrate requested trees explicitly.

Fixes openclaw#188764.
RomneyDa added a commit that referenced this pull request Nov 17, 2026
RomneyDa added a commit that referenced this pull request Nov 17, 2026
Allow initial guest PR preparation from the recorded project's published
history while preserving unpublished work and original PR identity.

(cherry picked from commit 2757947)

Stable adaptation: preserve the existing linked-identity fixture; expand
its options type and allocate exactly 89 regression LF instead of 84.
Production and documentation patches are unchanged from the source.

Companions: #188785 is present-equivalent. Later #188784, #190223,
#190576, #190542, #195413, #197229, #197243, #199717, #195787,
#197510, #193664, #199851, #199864, #197656, #198851, #193873,
#197594, #189006, #188904, #194025, #196200, #192283, #189010,
#188816 and e0466ff are not prerequisites to this scoped repair;
retain their separate intake dispositions. No later PR-number mentions.

Proof: baseline 4 failed/20 passed through registered agent action;
fixed 41/41 across preparation, refresh and base-action suites.
Type-aware lint4, formatting5, docs MDX1419 and diff check pass.
No live GitHub or full release qualification claim.

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime 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.

Cold PR preparation downloads unrelated historical file contents

1 participant