Repository navigation
fix: shorten sandbox freezes when importing pull requests - #201410
Conversation
Prepare the canonical pristine snapshot and manifest while the guest runs under the existing reconciliation lease. Bind that prepared view to the accepted baseline and retain the paused guest manifest comparison, dirty and staged edit checks, and source history checks.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review Please review the canonical pristine preparation and its accepted-baseline binding across the two existing reconciliation leases. The guest projection remains captured while paused. Focused regressions cover dirty and staged-only edits during preparation and a checkpoint that changes canonical bytes without changing Git HEAD. Performance measurements are continuing against this unchanged head. |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR moves first-import canonical verification into the existing preparation lease while retaining the paused guest comparison. Example: Import a PR into a managed workspace containing 62,000 files and 1.10 GB of synthetic content.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses canonical verification still performed while paused on main, and inspection found no actionable correctness or security defects. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway publication owner receives a verified PR source, checks the canonical checkout and sandbox projection, and applies source through the existing reconciliation and recovery owners. flowchart TD
A[Verified PR source] --> B[Preparation lease]
B --> C[Canonical snapshot and manifest]
C --> D[Observe guest Git state]
D --> E[Integration lease and baseline check]
E --> F[Paused guest manifest comparison]
F --> G[Existing source application and recovery]
Technical reviewBest possible solution: Prepare canonical verification under the existing lease, retain the paused guest comparison, and reject a changed accepted baseline before applying source. Do we have a high-confidence way to reproduce the issue? Current-main source confirms canonical verification runs inside the paused first-import callback, and the author supplies a Docker reproduction; this read-only review ran no target code. Is this the best way to solve the issue? The patch is a small relocation through existing owners: it preserves filesystem equality beyond Git trees and binds the prepared view to the accepted baseline without adding another cache, lease, or persistence mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7fc1f2487bfc. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +13, Tests +95, Docs +7. Total +115 across 4 files. Added test files: 0. 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 Reviewed November 18, 2026, 2:39 PM ET / 19:39 UTC. |
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. |
|
Merged via squash.
|
…01410) Prepare the canonical pristine snapshot and manifest while the guest runs under the existing reconciliation lease. Bind that prepared view to the accepted baseline and retain the paused guest manifest comparison, dirty and staged edit checks, and source history checks.
What Problem This Solves
Importing a repository into a workspace can freeze its sandbox for several seconds while pull request preparation verifies that the workspace is pristine. The frozen phase included a settled canonical snapshot and two full filesystem manifests.
User Impact
The sandbox keeps running during canonical verification. In the synthetic 62,000-file workload, median pristine pause falls 62% and total guest pause falls 53%. Dirty files, staged-only edits, unexpected history, and projection differences still prevent an unsafe initial import. No configuration, schema, or migration changes are required.
Why This Change Was Made
The guest writes the projection; the Gateway owns the canonical checkout under its reconciliation lease. Move the canonical snapshot and manifest into the existing source-preparation lease, where the guest is running. Bind the prepared view to the accepted baseline so a checkpoint between phases causes a retry before integration. The final comparison retains the paused guest manifest. Git tree equality cannot replace raw filesystem equality, including authored empty directories.
The pristine phase now captures one full manifest instead of two, and performs zero settled canonical snapshots instead of one. Total capture work and the earlier per-entry Git batching remain unchanged. Production code grows by 13 lines to carry the prepared manifest and baseline identity across the existing phases.
Evidence
The pause-placement regression fails on the parent and passes with this change. All 83 focused publication tests pass, including dirty and staged-only edits during preparation, unexpected history, projection mismatch, and a checkpoint that changes canonical bytes without changing Git HEAD.
pnpm check:changedpasses. Independent Codex review found no actionable P0–P2 findings. ClawSweeper reviewed this exact head with zero findings and zero open items.Five interleaved A/A/B groups used 62,000 synthetic files / 1.10 GB, 512 MiB of synthetic Git history, a real Docker guest heartbeat, and the registered publication owner. Every sample verified final contents. No samples were discarded. Each arm below has five samples; p95 is the nearest-rank estimate, which is the maximum at this sample count.
Against all ten baseline controls, median owner elapsed falls 13.2%, Node-process CPU falls 4.5%, and guest CPU falls 6.6%. Main-isolate allocation rises 1.5% (about 12.2 MB). Host contention produced large baseline and candidate outliers, retained above. The frozen source and committed candidate match byte for byte. A separate CPU/allocation profiling pass failed before reaching pristine verification because Git ran out of disk space during fetch; the Docker daemon then became unavailable during cleanup. Its partial profiles are excluded. A separate completed diagnostic profile used the same real Git, publication, and reconciliation owners with the harness’s supported simulated guest; contents verified, and its timings are excluded. The main isolate was predominantly idle waiting for workers and Git, with canonical-path selection the largest named application CPU frame. The ordinary-sample CPU and V8 allocation counters above remain valid.
The workload is
scripts/perf/github-publication-pause-measure.ts, run serially against frozen parent and candidate source roots with--native-imageset to the installed Node 26 image. CPU includes Node worker threads but excludes host native Git subprocess CPU; guest CPU is measured separately. Allocation is the main V8 isolate's exact counter. The host filesystem is APFS through the container runtime, not btrfs. The agent database is small and synthetic: this workload does not cover a 35 GiB database or thousands of sessions. No production data was used.Exact-head dispatched CI passed. Normal ready-PR CI failed in Git setup for three Node jobs because the upstream Git PPA returned HTTP 503; no tests ran in those jobs. CodeQL and security review passed. Other tested lanes, including UI, typechecks, lint, and docs, passed. After the package endpoint recovered to HTTP 200, only the failed jobs were retried in attempt 2 at the unchanged PR head; attempt 2 and the aggregate CI gate passed. Both successful CI runs cover the unchanged reviewed head
f031e939a47a73fe091cfaf72d11e537361699f9.Two additional projection authority tests fail on exact parent
3da0bc802e100faebc8352f7398fea89410def27, introduced by #201334 (04cb8179ccd66c88f2b32eb8bca8c53d2e8b9cb5): “rejects canonical checkpoint writes after original operator authority ends” and “denies guest filesystem writes after role revocation and a late involvement receipt.” They still expect mid-request role revocation after that change made authority fixed per request. These are separately reported main test regressions, not passing proof or a CI waiver for this PR.