Skip to content

fix(ci): retry ci pr export on lane hash mismatch from concurrent pushes#10297

Merged
davidfirst merged 7 commits intomasterfrom
fix-ci-pr-lane-hash-mismatch-retry
Apr 15, 2026
Merged

fix(ci): retry ci pr export on lane hash mismatch from concurrent pushes#10297
davidfirst merged 7 commits intomasterfrom
fix-ci-pr-lane-hash-mismatch-retry

Conversation

@davidfirst
Copy link
Copy Markdown
Member

When two bit ci pr runs race on the same PR (e.g. bit-pull-request + bit-init-and-verify workflows, or back-to-back commits within minutes), both can pass the pre-export "existing remote lane" check, each create a fresh-hash lane locally, and then compete on export. The loser sees:

unable to merge "<scope>/<lane>" lane. a lane with the same id already exists with a different hash.

The export upload/merge phase can take 1-2 minutes, which is plenty of time for the other runner to persist its lane on the hub.

  • Added exportWithRetryOnLaneHashMismatch — on hash-mismatch the helper force-deletes the remote lane (now populated by the winning push) and re-exports. Bounded to 3 attempts. Other errors and the final attempt's error propagate unchanged.
  • Fixed cleanup in the finally block: track whether the rename to the final lane name happened, and skip the temp-lane cleanup when it did. This removes the misleading "Failed to clean up temporary lane: … was not found" log after post-rename failures.

Copilot AI review requested due to automatic review settings April 15, 2026 14:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to make bit ci pr more resilient to concurrent runs exporting the same PR lane, by retrying exports when the remote rejects a lane due to hash mismatch and by improving temporary-lane cleanup behavior.

Changes:

  • Add exportWithRetryOnLaneHashMismatch() to retry export on lane-hash-mismatch by deleting the remote lane and re-exporting (up to 3 attempts).
  • Track whether the temp lane was renamed to the final lane name to avoid misleading temp-lane cleanup logs after rename.

Comment thread scopes/git/ci/ci.main.runtime.ts
Copilot AI review requested due to automatic review settings April 15, 2026 14:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread scopes/git/ci/ci.main.runtime.ts Outdated
Comment thread scopes/git/ci/ci.main.runtime.ts Outdated
Copilot AI review requested due to automatic review settings April 15, 2026 15:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread scopes/git/ci/ci.main.runtime.ts Outdated
Comment thread scopes/git/ci/ci.main.runtime.ts Outdated
Comment thread scopes/git/ci/ci.main.runtime.ts Outdated
@davidfirst davidfirst merged commit 6cb2dec into master Apr 15, 2026
12 checks passed
@davidfirst davidfirst deleted the fix-ci-pr-lane-hash-mismatch-retry branch April 15, 2026 16:16
davidfirst added a commit that referenced this pull request Apr 15, 2026
…ompt (#10300)

Follow-up to #10297. The new \`isStaleCiRun\` helper runs \`git fetch
origin\` inside the hash-mismatch retry path. In the \`bit_pr\` CircleCI
job, \`origin\` is the default SSH remote and GitHub's host key isn't
seeded in \`known_hosts\` for that job's shell — so the fetch hits an
interactive "yes/no" host-key prompt and hangs the job until the
50-minute step timeout (seen on #10257). The \`bit_merge\` job avoids
this only because it rewrites \`origin\` to an HTTPS+token URL via
\`update_ssh_agent\`; \`bit_pr\` does not.

\`isStaleCiRun\` was added during PR review to guard a hypothetical
race: an older CI run finishing later could delete a newer run's lane
and re-export stale snaps. In practice that race is unlikely,
self-correcting (the next CI run on the latest commit publishes the
correct lane), and only affects a PR lane — not main. Removing the guard
restores the original simple retry from #10297, which is enough.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants