Skip to content

fix: large PR imports fail in empty workspaces - #195404

Closed
roboclaw-bot wants to merge 3 commits into
mainfrom
openclaw/initial-import-repair-1108
Closed

roboclaw-bot wants to merge 3 commits into
mainfrom
openclaw/initial-import-repair-1108

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes chats failing to start after importing a large pull request into an empty managed workspace.

User Impact

Users can work on the imported repository and resume initial imports rejected by an older Gateway without deleting saved source files. Ordinary edits and later refreshes retain the 50,000-path limit; file-size, total-byte and integrity checks remain enforced.

Why This Change Was Made

The first repository import establishes the workspace rather than representing thousands of authored edits. Recognize that host-owned operation using its reserved source reference and deterministic empty baseline throughout staging, loading and application. Revalidate the retained source and baseline before recovering an older rejection. Keep accepted-checkpoint cleanup with the existing checkpoint owner.

Evidence

  • All 68 tests in github-pr-workspace-preparation.test.ts and github-pr-workspace-refresh.test.ts pass (275.91 seconds including compiler preparation; 277.95 seconds wrapper wall time).
  • The registered github_publish prepare_pr path imports 50,001 source files, preserves the guest Git index and subsequent local work, and makes no remote writes. The original implementation rejected this reproduction at 50,055 changed paths.
  • A persisted initial-import rejection recovers after database shutdown/reopen. The regression failed before the recovery change and now passes.
  • All 8 large-inventory tests pass, including ordinary worker-result rejection with the same empty baseline and historical-checkpoint safeguards (40.90 seconds including compiler preparation; 44.01 seconds wrapper wall time).
  • Core and both affected test-shard typechecks pass. Targeted type-aware lint, formatting, diff checks and test/max-lines budgets pass.
  • Local autoreview: Codex gpt-6.1-sol, P0–P2, complete working-tree snapshot against 9dc3499, identical source committed as 62d2444: scoped clean, no actionable findings.
  • CI exposed a missing trusted-wrapper inventory entry for the new shared identity module. The one-line inventory correction was reproduced red locally, then all 23 eager-import-closure tests passed, including extracted dependency resolution. The correction changes packaging only; the runtime implementation is unchanged.
  • Exact-head CI at 84db8e901ccd7b418e33684c5755427c27cf8496 passed, including the required CI gates; GitHub reports CLEAN and MERGEABLE. CI run.
  • Live GitHub import transport and deployment were not exercised by these isolated boundary tests. This PR remains unmerged.

The 50,001-file regression takes about 49 seconds because it exercises real Git import, both workspace copies and repeated preparation; a small synthetic inventory would miss this integration failure. Net test growth: 82 lines, recorded in the dedicated allocation. The production change shares the existing empty-source identity and keeps checkpoint recovery and cleanup with one owner; it adds no new persisted state.

Thanks to @vyctorbrzezowski for reporting and directing this repair.

Work sessions

Linked for team reference; these sessions aren’t public.

Worked on by

roboclaw-bot and others added 2 commits November 8, 2026 20:35
Recognize the host-owned initial source import without counting the repository as authored workspace edits. Resume retained initial imports rejected by the previous path limit while keeping ordinary result and payload safety checks.

Co-authored-by: vyctorbrzezowski <[email protected]>
Worked on by:
- @vyctorbrzezowski

Co-authored-by: vyctorbrzezowski <[email protected]>
OpenClaw-Publication: 8c6ed3ff-8bdd-4fdd-a568-e5ee2bf96d1b
@clawsweeper

clawsweeper Bot commented Nov 8, 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 docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: M labels Nov 8, 2026
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Nov 8, 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. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 8, 2026
@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR exempts the first host-owned repository import from the workspace changed-path limit and recovers previously rejected initial imports.

Example: Prepare a PR containing 50,001 source files in an empty managed workspace.

  • Before: Preparation rejects the repository as exceeding 50,000 changed paths.
  • After: Preparation imports the repository while preserving byte limits, integrity checks, and subsequent local work.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, useful repair with meaningful integration coverage and green exact-head CI; compatibility validation remains incomplete.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored PR is outside the ordinary contributor live-proof gate; supplied evidence exercises the registered tool through a real-Git in-process harness, with synthetic GitHub and sandbox transport. Persisted recovery compatibility remains insufficient because no latest-stable upgrade run is supplied.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A conversation cannot begin useful work after importing a large PR into its empty managed workspace.
Reason: The maintainer-authored direction restores an existing import workflow, and the body credits @vyctorbrzezowski for reporting and directing the repair.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this PR addresses a current large-repository import failure, and the reviewed diff contains no discrete introduced bug.

Priority: P1
Reviewed head: 84db8e901ccd7b418e33684c5755427c27cf8496

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Provide an upgrade run from v2026.11.2 preserving existing workspace files and settings; the same-build database reopen does not establish that upgrade contract.
Agent review details

How this fits together

GitHub PR preparation stages verified repository contents into the managed workspace, then reconciles canonical and sandbox files through durable checkpoint owners.

flowchart TD
A[Prepare PR tool] --> B[GitHub source verification]
B --> C[Host source staging]
C --> D[Initial import classification]
D --> E[Workspace reconciliation]
E --> F[Canonical and sandbox files]
E --> G[Durable checkpoint owner]
Loading

Technical review

Best possible solution:

Keep initial-source classification shared across the existing staging, loading, reconciliation, and checkpoint owners.

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

Current main counts the initial repository against the 50,000-path limit, and the supplied real-Git tool regression exercises that boundary; this read-only review ran no target code.

Is this the best way to solve the issue?

The patch fixes the admission distinction at all existing consumers, preserves ordinary-result safeguards, and adds no competing state owner or unnecessary test scaffolding.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Shakker: Raw commit 23173ed adds src/gateway/worker-environments/workspace-result-inventory.ts:15 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 23173ed1f61b; files: src/gateway/worker-environments/workspace-result-inventory.ts)

PR surface

Source +77, Tests +82, Docs +5, Other +4. Total +168 across 13 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 8 120 43 +77
Tests 2 82 0 +82
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 2 4 0 +4
Total 13 211 43 +168

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.

Review metrics

Metric Value Why it matters
Production versus test growth Production +120/-43 lines; tests +82/-0 lines Growth implements shared import classification and retained-rejection recovery, with distinct import, restart, and ordinary-worker boundary coverage.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Large-repository PR imports can leave the conversation unable to start or continue its agent workflow.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.

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 8, 2026, 4:16 PM ET / 21:16 UTC.

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

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants