feat(ci): reuse lane across PR commits + adopt-on-conflict for concurrent runs#10388
Open
davidfirst wants to merge 3 commits into
Open
feat(ci): reuse lane across PR commits + adopt-on-conflict for concurrent runs#10388davidfirst wants to merge 3 commits into
davidfirst wants to merge 3 commits into
Conversation
…rent runs bit ci pr now reuses the existing remote lane on subsequent commits to the same PR, preserving lane history and any cloud-side edits. When two CI runners race the first push, the loser fetches the winner's lane, rebases its snapped Version parents onto the remote heads, and re-exports. - snapPrCommit: switch-to-existing-lane + merge-main-into-lane (brings forward config-only changes like deps/env set that landed on main during the PR). - writeObjectsToTheFS: validate LaneId uniqueness before writing files so a rejected concurrent push leaves no stale objects on the remote. - export.pushToRemotesCarefully: clean up pending dirs on persist failure so a retry isn't blocked by the export queue.
…d-rebase-on-conflict
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the bit ci pr flow to preserve and reuse a PR’s remote lane across subsequent commits, and adds a conflict-recovery path for concurrent CI exports so racing runners can converge on a single remote lane without forcing a costly re-snap/build.
Changes:
- Reuse existing remote PR lanes (instead of delete/recreate) and merge
maininto the PR lane to propagate non-git-tracked config changes. - Add “adopt-on-conflict” recovery for concurrent lane export hash mismatches by rebasing local snapped
Versionparents onto the remote lane heads and retrying export. - Add early LaneId uniqueness validation before writing objects to disk, and improve export pending-dir cleanup on persist failures.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| scopes/scope/objects/objects/scope-index.ts | Adds a pre-write LaneId uniqueness validator and strengthens lane indexing against same-id/different-hash races. |
| scopes/scope/objects/objects/repository.ts | Reloads scope-index and runs LaneId uniqueness validation before persisting lane-related objects. |
| scopes/scope/export/export.main.runtime.ts | Ensures pending dirs are cleaned up when persistRemotes() fails to avoid stuck export queues. |
| scopes/git/ci/ci.main.runtime.ts | Reuses remote lanes across PR commits, merges main into PR lanes, and implements adopt-on-conflict export recovery for concurrent runs. |
| e2e/harmony/ci-commands.e2e.ts | Adds/updates E2E coverage for lane reuse, main→lane config propagation, and concurrent CI runner behavior. |
- scope-index: validateLaneIdUniqueness and addOne now also reject the rename case where the target LaneId already belongs to a different lane (different hash). - export: wrap pending-dir cleanup in try/catch so a cleanup failure logs a warning instead of masking the original persist error. - ci: add TODO documenting the older-runner-wins regression case for the adopt-on-conflict rebase.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
`bit ci pr` now reuses the existing remote lane on subsequent commits to the same PR rather than deleting and recreating it. This preserves lane history, lane-based cloud UI edits, and prevents archived-lane pileup. When two CI runners race the first push, the loser adopts the winner's lane and rebases its snapped Version parents onto the remote heads — preserving both runners' snaps chained on the lane and avoiding a costly re-snap with `--build`.
Changes
Test plan