Skip to content

fix: unblock large repository review checkouts - #1519

Merged
steipete merged 1 commit into
mainfrom
codex/review-tree-metadata-projection-143547
Sep 10, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/review-tree-metadata-projection-143547

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: openclaw/openclaw#143547

What Problem This Solves

Fixes valid large-repository reviews failing before model execution with “remote blob size metadata is unavailable.” The complete tree response for the linked OpenClaw PR is 10.7 MB, exceeding the existing 8 MiB GitHub CLI output capture. The resulting ENOBUFS is reported as a checkout metadata failure.

Why This Change Was Made

Project the recursive-tree response inside gh --jq before capturing it. Keep the truncation flag and every entry's type, SHA, and size, which are the facts the existing checkout admission consumes. Preserve malformed container and entry shapes so the validator still rejects them. The CLI capture, private-workspace, file-count, deadline, and disk limits are unchanged.

User Impact

Reviews can prepare valid large repositories without unused paths and URLs filling the metadata response buffer. Incomplete, truncated, malformed, or oversized source remains rejected.

OpenClaw Bay Impact

Bay is unaffected. This changes internal source-preparation transport only; lifecycle, review publication, status, telemetry, and observer data contracts stay the same.

Documentation Impact

The active README review overview now describes the metadata projection and unchanged admission guarantees. The existing Unreleased changelog records the fix. No workflow or operator configuration changes are required: new sweep runs build the checked-out source with build:all.

Evidence

  • The synthetic large-response regression fails on the original source with the observed checkout error, then passes with the fix. It exercises the actual ghOnce capture limit, real jq evaluation, and real partial-clone Git materialization, preserving every required metadata fact.
  • Truncated responses, object-shaped tree containers, and null entries remain rejected. Existing manual-proof fixtures retain endpoint and request-count assertions while evaluating the actual filter.
  • Focused final suite: 7 passing cases. Full pnpm run check passed: 5,943 tests passed, 32 platform skips, and no failures, plus 13 passing changed-coverage tests.
  • Fresh managed P2 reviews of the local candidate and committed branch e0f926b1543aeb5d8aef0f5b53e2a0b9a1ba54cd are both clean, with no actionable findings.

Real Behavior Proof

On Node 24.20.0/macOS, the built createContextHydration(...).materializePullRequestReviewTree(...) path ran against the actual public OpenClaw head 70842b03a5aa392ede6a0a14e7e1b758a499a5d3, using the real GitHub CLI/API and Git transport. The standalone command was node live-proof.mjs after pnpm run build; the harness called the production owner and runtime directly and compared the captured response to the complete pinned GitHub tree.

The fixture had complete history and an explicitly chosen warm-base cache containing only blobs from b30ff87b771b694e67ab7ba4c860386ac18db708. This follows the hosted sequence of preparing a base checkout before private PR materialization; the seed is pinned rather than an assertion about current-main cache contents. Twelve changed-head objects were genuinely missing. The trace was:

{
  "sourceSha256": "bb11b8544fc2138aaada0adf083e1038952b6d11edebadb1212d185d1c9253ec",
  "missingBlobsBefore": 12,
  "metadataRequests": 1,
  "metadataBytes": 3258092,
  "metadataEntries": 42225,
  "allTypeShaSizeAndTruncatedFactsPreserved": true,
  "materializedHead": "70842b03a5aa392ede6a0a14e7e1b758a499a5d3",
  "cleanWorkingTree": true,
  "trackedFiles": 40292,
  "durationMs": 15581
}

The original full response was 10,686,262 bytes, truncated=false, with valid metadata for all 40,292 blobs. Its captured replay fails with ENOBUFS at the unchanged 8 MiB limit. The fixed real request captured 3,258,092 bytes and completed the exact-head checkout. No model, target code, Gateway, or publication operation ran during this proof. Earlier shallow-history and wholly cold bare-cache fixtures hit unchanged setup/fetch deadlines; those failures were retained, and this is not a claim of cold-cache checkout success. The real tree payload is not committed.

@clawsweeper

clawsweeper Bot commented Sep 10, 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 September 10, 2026 01:15
@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 9:19 PM ET / September 10, 2026, 01:19 UTC.

ClawSweeper review

What this changes

Reduce GitHub tree metadata captured during PR checkout preparation while preserving the fields needed to validate checkout size and completeness.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: current main still captures the oversized checkout metadata response. No actionable defects were found, and the supplied production-path trace sufficiently demonstrates the repaired behavior.

Priority: P2
Reviewed head: e0f926b1543aeb5d8aef0f5b53e2a0b9a1ba54cd

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with strong, source-matched runtime evidence and no actionable correctness findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied macOS/Node 24 trace exercises the changed materialization owner through real GitHub and Git transports, preserves all required metadata, and completes the pinned checkout with 12 genuinely missing blobs; its source hash matches this head and its warm-cache limit is explicit.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The supplied macOS/Node 24 trace exercises the changed materialization owner through real GitHub and Git transports, preserves all required metadata, and completes the pinned checkout with 12 genuinely missing blobs; its source hash matches this head and its warm-cache limit is explicit.
Evidence reviewed 8 items Introduced change and merge ownership: The introduced delta changes four files. GitHub's comparison of the verified test merge against its pinned main parent retains the metadata projection without removing main's separate historical-blob hydration changes.
Current main still needs the fix: The pinned main implementation still calls ghJsonOnce without projection for checkout tree metadata; ghOnce limits captured output to 8 MiB. The reported 10,686,262-byte response therefore exceeds that boundary.
Admission invariants remain intact: The tree validator consumes truncation, entry type, SHA, and size—the fields retained by the projection. It still rejects incomplete containers, invalid blob metadata, and excessive entry counts; downstream admission still checks missing sizes, disk capacity, and checkout budgets.
Findings None None.
Security None None.

How this fits together

ClawSweeper prepares a private checkout before reviewing a PR. GitHub metadata supplies missing blob sizes, which checkout admission checks before fetching objects and materializing the pinned revision.

flowchart TD
  A[Pinned PR revision] --> B[GitHub recursive tree]
  B --> C[Project required metadata]
  C --> D[Validate completeness and sizes]
  D --> E[Check checkout budgets]
  E --> F[Fetch missing objects]
  F --> G[Private review checkout]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production versus test delta Production +10 net lines; tests +115 net lines The production growth is narrowly justified by reducing captured metadata, with most additions exercising the boundary.
Observed metadata capture 10,686,262 bytes → 3,258,092 bytes The supplied real request fits the unchanged 8 MiB capture limit while preserving all required metadata.

Technical review

Best possible solution:

Admit valid large pinned checkouts within the existing resource limits while continuing to reject incomplete or malformed metadata.

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

Yes: current main captures the full recursive-tree response through an 8 MiB buffer, and the supplied replay documents ENOBUFS for a 10.7 MB response. This review verified the source path without executing it.

Is this the best way to solve the issue?

Yes: projecting unused metadata before capture is a narrow repair that preserves the existing validator and budgets; the real transport trace supports the intended result.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: Repairs source preparation for large repositories without changing review policy or operator configuration.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied macOS/Node 24 trace exercises the changed materialization owner through real GitHub and Git transports, preserves all required metadata, and completes the pinned checkout with 12 genuinely missing blobs; its source hash matches this head and its warm-cache limit is explicit.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The supplied macOS/Node 24 trace exercises the changed materialization owner through real GitHub and Git transports, preserves all required metadata, and completes the pinned checkout with 12 genuinely missing blobs; its source hash matches this head and its warm-cache limit is explicit.

Label justifications:

  • P2: Repairs source preparation for large repositories without changing review policy or operator configuration.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The supplied macOS/Node 24 trace exercises the changed materialization owner through real GitHub and Git transports, preserves all required metadata, and completes the pinned checkout with 12 genuinely missing blobs; its source hash matches this head and its warm-cache limit is explicit.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied macOS/Node 24 trace exercises the changed materialization owner through real GitHub and Git transports, preserves all required metadata, and completes the pinned checkout with 12 genuinely missing blobs; its source hash matches this head and its warm-cache limit is explicit.

Evidence

What I checked:

  • Introduced change and merge ownership: The introduced delta changes four files. GitHub's comparison of the verified test merge against its pinned main parent retains the metadata projection without removing main's separate historical-blob hydration changes. (src/clawsweeper-context-hydration.ts:1099, 63b24a55006c)
  • Current main still needs the fix: The pinned main implementation still calls ghJsonOnce without projection for checkout tree metadata; ghOnce limits captured output to 8 MiB. The reported 10,686,262-byte response therefore exceeds that boundary. (src/clawsweeper-context-hydration.ts:1115, cd76da8aa7b0)
  • Admission invariants remain intact: The tree validator consumes truncation, entry type, SHA, and size—the fields retained by the projection. It still rejects incomplete containers, invalid blob metadata, and excessive entry counts; downstream admission still checks missing sizes, disk capacity, and checkout budgets. (src/clawsweeper-review-blobs.ts:1081, e0f926b1543a)
  • Real behavior proof matches the changed source: The supplied PR body records Node 24.20.0/macOS execution of the production materialization owner using real GitHub CLI/API and Git transport. With 12 missing blobs, one request captured 3,258,092 bytes and all 42,225 metadata entries, then produced a clean 40,292-file pinned checkout in 15,581 ms. The recorded source SHA-256 matches the inspected file. Proof explicitly covers a warm-base cache, excludes cold-cache success, and reports no target-code or publication execution. (src/clawsweeper-context-hydration.ts:1090, e0f926b1543a)
  • Focused regression coverage: The new regression exercises the actual capture boundary with a response over 8 MiB, real jq evaluation, and Git materialization. It checks preservation of all projected facts and rejection of truncated trees, object-shaped containers, and null entries. Tests were inspected, not executed during this read-only review; the body reports a passing full check. (test/review-blob-hydration.test.ts:1661, e0f926b1543a)
  • Related merged work is distinct: fix(review): hydrate blob sizes from bounded trees #1518 is merged at pinned main and changes historical diff-blob metadata acquisition. Its patch does not project the separate checkout request through ghJsonOnce, so it does not supersede this fix. The latest release remains v0.3.0; no shipped implementation of this projection was established. (cd76da8aa7b0)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RomneyDa: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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