Repository navigation
fix: stop repeated cold fork fetches from empty workspaces - #197229
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@clawsweeper review Please review final head 49c389f, especially canonical PR-base project access/custody, retained Git negotiation refs, and the existing-empty-workspace recovery path. Focused regression proof and synthetic A/B/A controls are recorded in the PR body. |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR reuses accessible registered-project history for PR imports, retains fetched commits for subsequent negotiation, and adds cold-fetch recovery guidance. Example: Acquire a missing fork successor in the supplied 20,001-commit native Git fixture.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a concrete import failure that remains on main; the previous finding is fixed, and no new actionable defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway turns an inspected PR and current requester authority into a session-owned workspace, then acquires Git history and contents through the existing publication transport. flowchart TD
A[Conversation requests PR preparation] --> B[Inspect PR and requester authority]
B --> C[Resolve accessible base project]
C --> D[Allocate session workspace]
D --> E[Revalidate and bind workspace]
E --> F[Fetch and retain Git history]
F --> G[Prepare PR contents]
Technical reviewBest possible solution: Keep project access, workspace custody, binding and Git acquisition with their existing owners while retaining successful transfers for reuse. Do we have a high-confidence way to reproduce the issue? Current main always adopts an empty source and fetches absent commits without retaining a destination ref; the supplied native successor-acquisition measurements demonstrate the resulting repeated transfer without this review executing target code. Is this the best way to solve the issue? The patch repairs source selection and transfer retention at existing owners, preserves bound workspaces, and keeps interrupted-pack deletion with maintenance; the simplification review found no unnecessary production layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 04e941df2928. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +96, Tests +209, Docs +15, Other +163. Total +483 across 19 files. Added test files: 1. View PR surface stats
Preflight sourceSource 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
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 11, 2026, 8:55 AM ET / 13:55 UTC (Revision 2). |
|
Addressed all four “Before merge” items against b90fdbd:
Validation: all four adoption cases pass; the expanded authority case takes 5.4 seconds. Targeted gateway test typecheck, lint, formatting, line-cap and test-line guards pass. Fresh Codex autoreview is scoped-clean through P2. Production and benchmark inputs are unchanged. Restoring the original handoff owners makes the expanded test fail because the old path never selects a project or reaches the visibility probe; that is not a claim of a baseline authorization bypass. The PR body records the proof limits and the fixed initial CI failure. Final-head CI is pending. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…197229) * fix: stop repeated cold fork fetches from empty workspaces * test: recognize retained fetch refspecs in publication observers * test: prove project adoption authority through the preparation handler
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]>
What Problem This Solves
Large fork PR imports from an empty workspace can repeatedly download their entire commit/tree history, hit the command timeout, and leave temporary packs instead of making progress.
User Impact
An unbound conversation importing a PR now reuses an accessible registered project identified by the PR's base repository, including fork heads. An already-bound empty workspace without retained history gets project-session guidance before the cold fetch; existing files, published work and prepared imports remain intact. Unknown or inaccessible projects retain the existing import path.
Successful commit acquisitions retain a Git ref for later negotiation, and commit-fetch timeouts explain the project-workspace or standalone depth-limited-clone remedy. Epoch-zero roots no longer appear to be decades-stale project bases. Interrupted-pack cleanup remains with the existing lease-checked Linux maintenance owner; this change does not delete packs on timeout.
Why This Change Was Made
PR adoption always selected an empty source despite having inspected the authoritative base repository. Separately, by-SHA publication fetches suppressed FETCH_HEAD and retained no ref, leaving completed transfers unavailable to negotiation for subsequent missing commits. Reuse the project access/custody owners and the existing filtered transport; retain fetched refs in the source repository even when transport metadata is temporary.
This deliberately preserves existing workspace bindings instead of adding unowned foreign alternates after allocation. There is no schema change, configuration option, new cache, or new cleanup mechanism. Runtime production delta is +96 lines: the necessary growth supplies shared project selection, bounded cold-source guidance, retained refs and actionable diagnostics. This does not overlap #195404's separate initial-import file-count repair.
Evidence
Native owner fixture: 20,001 commits, 140,064 trees, 62,000 stable paths / 1.116 GB logical content, reused from prior synthetic proof. Five interleaved A/B trials and five A2 controls, Git 2.56.0 / Node 26.12.1, macOS and local file transport. No production data, session database, live service or deployment. This measures the actual fetch owner, not whole-session latency or production filesystem/network behavior.
A/A wall drift is -0.24%; JS CPU +2.77% and sampled allocation +1.57% remain explicit costs. Two owner Git commands / one fetch in either arm. Every candidate advertises the prior fork SHA. The first cold acquisition remains 160,066 objects in every arm and is excluded from successor timing. Repeating an identical already-present SHA already takes the offline presence fast path; this proves progress for subsequent missing commits. Reproduce with
scripts/perf/empty-source-fork-fixture.pyandscripts/perf/publication-fetch-measure.ts --sequential-fork --allocation.All 141 non-skipped focused tests have passing proof; one existing skip remains. Red-on-parent regressions cover project selection, retained refs, cold-fetch guidance, timeout guidance and synthetic-root warnings. The full seven-file run was followed by a 10-case authority rerun after adapting three transport observers to the source OID in a refspec. No assertions or authority checks were weakened. The expanded authenticated project-adoption case takes 5.4 seconds; acquisition suite is 23.6 seconds. Existing preparation/branch suites remain slower native Git and lifecycle proof. No changed production module is imported by the Control UI. The exact +208 test-line allocation covers the new regressions and coherent acquisition-suite extraction.
Final Codex autoreview is scoped-clean through P2 against parent
eafa24743a53d8079c32be72fb3c8ae4222e78ca.pnpm check:changedcompleted with exit 2: two test-callback implicit-any errors, now fixed and verified by the exact gateway-methods TypeScript check, plus the inherited dead-export failure below. Core/scripts lint, formatting, production/script types and all remaining guards passed. Targeted test-file lint also passed. The full command is not represented as green. The canonical dead-export failure reproduces identically on that exact parent: 57 production / 32 full-tree / 0 script findings across 20 unchanged owner files. Newly identified main regressions are #196767 (23 Knowledge exports), #196991 (two Telegram widget exports), and #196388 (three OpenClaw ID exports); the remaining 29 have the earlier #196854 lane's causal attribution. These are reported main defects, not passing checks.The first exact-head CI run (43028008473) found one additional stale fault injector in
github-publication-history.test.ts: it expected a standalone SHA and therefore missed the new refspec. This was a PR-caused test failure, reproduced locally, then fixed without weakening the fault-injection assertion. All 15 history cases pass after correction. A matching base-refresh fetch counter was corrected too, and its native recovery case passes. Production code and measurement inputs are unchanged; Final-head CI run 43032652923 passed on b90fdbd.The project handoff now has stronger in-process proof through the shipped
performSessionGitHubPreparationhandler. Real authenticated requester grants, project access, registry custody, native Git allocation, role mutation/invalidation, rollback and session binding demonstrate: an accessible canonical base uses project Git storage; a restricted requester receives no private project files/alternates/binding; revocation during visibility lookup prevents allocation; revocation after allocation prevents binding and rolls back; earlier conversation files remain readable only to their owner. All four adoption cases pass. This replaces the weaker internal-requester fixture. GitHub responses, container setup and PR-content import remain synthetic; this is not a live Gateway/model or Team run.Landed as
f5d0c194fcd1726fc5823adf031cedff480cb702from exact headb90fdbd86a75ac2e4b0697993b37f3c06ab56bf2. Final CI passed (59 successful jobs, 27 skipped), and ClawSweeper revision 2 has zero open items and no findings/security concern.